<?
$sub_menu = "300100";
include_once("./_common.php");
include_once ("$g4[path]/lib/cheditor4.lib.php");

auth_check($auth[$sub_menu], "w");

$token = get_token();

function b_draw($pos, $color='red') {
    return "border-{$pos}-width:1px; border-{$pos}-color:{$color}; border-{$pos}-style:solid; ";
}

$sql = " select count(*) as cnt from $g4[group_table] ";
$row = sql_fetch($sql);
if (!$row[cnt])
    alert("请先建立论坛版块", "./boardgroup_form.php");

$html_title = "论坛";
if ($w == "") {
    $html_title .= " 创建";

    $bo_table_attr = "required alphanumericunderline";

    $board[bo_count_delete] = '1';
    $board[bo_count_modify] = '1';
    $board[bo_read_point] = $config[cf_read_point];
    $board[bo_write_point] = $config[cf_write_point];
    $board[bo_comment_point] = $config[cf_comment_point];
    $board[bo_download_point] = $config[cf_download_point];

    $board[bo_gallery_cols] = '4';
    $board[bo_table_width] = '97';
    $board[bo_page_rows] = $config[cf_page_rows];
    $board[bo_subject_len] = '60';
    $board[bo_new] = '24';
    $board[bo_hot] = '100';
    $board[bo_image_width] = '600';
    $board[bo_upload_count] = '2';
    $board[bo_upload_size] = '1048576';
    $board[bo_reply_order] = '1';
    $board[bo_use_search] = '1';
    $board[bo_skin] = 'basic';
    $board[gr_id] = $gr_id;
    $board[bo_disable_tags] = "script|iframe";
    $board[bo_use_secret] = 0;
} else if ($w == "u") {
    $html_title .= " 修改";

    if (!$board[bo_table])
        alert("您访问的论坛不存在");

    if ($is_admin == "group") {
        if ($member[mb_id] != $group[gr_admin]) 
            alert("版块错误！");
    }

    $bo_table_attr = "readonly style='background-color:#dddddd'";
}

if ($is_admin != "super") {
    $group = get_group($board[gr_id]);
    $is_admin = is_admin($member[mb_id]);
}

$g4[title] = $html_title;
include_once ("./admin.head.php");
?>

<script src="<?=$g4[cheditor4_path]?>/cheditor.js"></script>
<?=cheditor1('bo_content_head', '100%', '200');?>
<?=cheditor1('bo_content_tail', '100%', '200');?>

<form name=fboardform method=post onsubmit="return fboardform_submit(this)" enctype="multipart/form-data">
<input type=hidden name="w"     value="<?=$w?>">
<input type=hidden name="sfl"   value="<?=$sfl?>">
<input type=hidden name="stx"   value="<?=$stx?>">
<input type=hidden name="sst"   value="<?=$sst?>">
<input type=hidden name="sod"   value="<?=$sod?>">
<input type=hidden name="page"  value="<?=$page?>">
<input type=hidden name="token" value="<?=$token?>">
<table width=100% cellpadding=0 cellspacing=0 border=0>
<colgroup width=5% class='left'>
<colgroup width=20% class='col1 pad1 bold right'>
<colgroup width=75% class='col2 pad2'>
<tr>
    <td colspan=3 class=title align=left><img src='<?=$g4[admin_path]?>/img/icon_title.gif'> <?=$html_title?></td>
</tr>
<tr><td colspan=3 class='line1'></td></tr>
<tr class='ht'>
    <td></td>
    <td>TABLE</td>
    <td><input type=text class=ed name=bo_table size=30 maxlength=20 <?=$bo_table_attr?> itemname='TABLE' value='<?=$board[bo_table] ?>'>
        <? 
        if ($w == "") 
            echo "只能使用英文，数字，下划线及组合(20字节以内)";
        else 
            echo "<a href='$g4[bbs_path]/board.php?bo_table=$board[bo_table]'><img src='$g4[admin_path]/img/icon_view.gif' border=0 align=absmiddle></a>";
        ?>
    </td>
</tr>
<tr class='ht'>
    <td></td>
    <td>所属版块</td>
    <td>
        <?=get_group_select('gr_id', $board[gr_id], "required itemname='版块'");?>
        <? if ($w=='u') { ?><a href="javascript:location.href='./board_list.php?sfl=a.gr_id&stx='+document.fboardform.gr_id.value;">所属版块内其他论坛</a><?}?></td>
</tr>
<tr class='ht'>
    <td></td>
    <td>论坛名称</td>
    <td>
        <input type=text class=ed name=bo_subject size=60 maxlength=120 required itemname='论坛名称' value='<?=get_text($board[bo_subject])?>'>
    </td>
</tr>
<tr class='ht'>
    <td></td>
    <td>顶部样式图片</td>
    <td>
        <input type=file name=bo_image_head class=ed size=60>
        <?
        if ($board[bo_image_head])
            echo "<br><a href='$g4[path]/data/file/{$board['bo_table']}/$board[bo_image_head]' target='_blank'>$board[bo_image_head]</a> <input type=checkbox name='bo_image_head_del' value='$board[bo_image_head]'> 删除";
        ?>
    </td>
</tr>
<tr class='ht'>
    <td></td>
    <td>底部样式图片</td>
    <td>
        <input type=file name=bo_image_tail class=ed size=60>
        <? 
        if ($board[bo_image_tail]) 
            echo "<br><a href='$g4[path]/data/file/{$board['bo_table']}/$board[bo_image_tail]' target='_blank'>$board[bo_image_tail]</a> <input type=checkbox name='bo_image_tail_del' value='$board[bo_image_tail]'> 删除";
        ?>
    </td>
</tr>

<? if ($w == "u") { ?>
<tr class='ht'>
    <td></td>
    <td>统计整理</td>
    <td>
        <input type=checkbox name=proc_count value=1> 请定期整理统计数据
        (当前主题 : <?=number_format($board[bo_count_write])?> , 回帖 : <?=number_format($board[bo_count_comment])?>)
        <?=help("当论坛主题/回帖数量与实际数量有差别时使用")?>
    </td>
</tr>
<? } ?>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td>
        <input type=checkbox name=chk_admin value=1>
        <?=help("如果需要将版块内其他论坛设置成当前设置时选择此项");?>
    </td>
    <td>论坛版主</td>
    <td><input type=text class=ed name=bo_admin maxlength=20 value='<?=$board[bo_admin]?>'></td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_list_level value=1></td>
    <td>目录浏览权限</td>
    <td>
        <?=get_member_level_select('bo_list_level', 1, 10, $board[bo_list_level]) ?>
        <?=help("等级1为游客, 等级2以上为注册会员.\n最高权限等级为10（站点管理员）.", 50)?>
    </td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_read_level value=1></td>
    <td>主题浏览权限</td>
    <td><?=get_member_level_select('bo_read_level', 1, 10, $board[bo_read_level]) ?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_write_level value=1></td>
    <td>发表主题权限</td>
    <td><?=get_member_level_select('bo_write_level', 1, 10, $board[bo_write_level]) ?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_reply_level value=1></td>
    <td>回帖权限</td>
    <td><?=get_member_level_select('bo_reply_level', 1, 10, $board[bo_reply_level]) ?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_comment_level value=1></td>
    <td>评论权限</td>
    <td><?=get_member_level_select('bo_comment_level', 1, 10, $board[bo_comment_level]) ?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_link_level value=1></td>
    <td>超链接权限</td>
    <td><?=get_member_level_select('bo_link_level', 1, 10, $board[bo_link_level]) ?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_upload_level value=1></td>
    <td>上传权限</td>
    <td><?=get_member_level_select('bo_upload_level', 1, 10, $board[bo_upload_level]) ?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_download_level value=1></td>
    <td>下载权限</td>
    <td><?=get_member_level_select('bo_download_level', 1, 10, $board[bo_download_level]) ?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_html_level value=1></td>
    <td>HTML编辑权限</td>
    <td><?=get_member_level_select('bo_html_level', 1, 10, $board[bo_html_level]) ?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_trackback_level value=1></td>
    <td>引用通告功能权限</td>
    <td>
        <?=get_member_level_select('bo_trackback_level', 1, 10, $board[bo_trackback_level]) ?>
        <?=help("引用通告功能是将自己发表的文章告知其他好友的功能，详情参考百度百科", 50, -70)?>
    </td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_count_modify value=1></td>
    <td>修改主题内容限制</td>
    <td>回帖及评论超出 <input type=text class=ed name=bo_count_modify size=3 required numeric itemname='修改主题内容限制数量' value='<?=$board[bo_count_modify]?>'>以上禁止修改主题内容</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_count_delete value=1></td>
    <td>删除主题内容限制</td>
    <td>回帖及评论内容超出 <input type=text class=ed name=bo_count_delete size=3 required numeric itemname='删除主题内容限制数量' value='<?=$board[bo_count_delete]?>'>以上禁止删除主题内容</td>
</tr>
<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td></td>
    <td>积分设置</td>
    <td><input type=checkbox name="chk_point" onclick="set_point(this.form)"> 选择基本设定相同积分设置</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_read_point value=1></td>
    <td>阅读主题积分</td>
    <td><input type=text class=ed name=bo_read_point size=10 required itemname='阅读主题积分' value='<?=$board[bo_read_point]?>'></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_write_point value=1></td>
    <td>发表主题积分</td>
    <td><input type=text class=ed name=bo_write_point size=10 required itemname='发表主题积分' value='<?=$board[bo_write_point]?>'></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_comment_point value=1></td>
    <td>发表回帖积分</td>
    <td><input type=text class=ed name=bo_comment_point size=10 required itemname='发表回帖积分' value='<?=$board[bo_comment_point]?>'></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_download_point value=1></td>
    <td>下载积分</td>
    <td><input type=text class=ed name=bo_download_point size=10 required itemname='下载积分' value='<?=$board[bo_download_point]?>'></td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_category_list value=1></td>
    <td>话题分类 </td>
    <td><input type=text class=ed name=bo_category_list style='width:80%;' value='<?=get_text($board[bo_category_list])?>'>
        <input type=checkbox name=bo_use_category value='1' <?=$board[bo_use_category]?'checked':'';?>><b>开启</b>
        <?=help("多个话题分类请使用|分割 (如: 提问|回答) 首个字母请勿使用#字 (如: #提问|#回答 [X])", -120)?>
    </td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_sideview value=1></td>
    <td>显示作者简介</td>
    <td><input type=checkbox name=bo_use_sideview value='1' <?=$board[bo_use_sideview]?'checked':'';?>>开启 (点击作者名称显示作者简介)</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_file_content value=1></td>
    <td>附件简介功能</td>
    <td><input type=checkbox name=bo_use_file_content value='1' <?=$board[bo_use_file_content]?'checked':'';?>>开启</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_comment value=1></td>
    <td>回帖使用新窗口</td>
    <td><input type=checkbox name=bo_use_comment value='1' <?=$board[bo_use_comment]?'checked':'';?>>开启 (发表回复时在新窗口编辑发表)</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_secret value=1></td>
    <td>内容加密功能</td>
    <td>
        <select name=bo_use_secret id='bo_use_secret'>
        <option value='0'>不使用
        <option value='1'>选择使用
        <option value='2'>强制使用
        </select>
        &nbsp;<?=help("'选择使用'可以使作者自行选择是否加密\n\n'强制使用'时所发表的主题将自动加密 (管理员始终显示选择使用)\n\n可能有部分论坛skin不支持此选项，请参考Skin说明")?>
        <script type='text/javascript'>document.getElementById('bo_use_secret').value='<?=$board[bo_use_secret]?>';</script>
    </td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_dhtml_editor value=1></td>
    <td>DHTML功能</td>
    <td>
        <input type=checkbox name=bo_use_dhtml_editor value='1' <?=$board[bo_use_dhtml_editor]?'checked':'';?>>开启
        &nbsp;<?=help("开启后发表主题时可使用可视化编辑器发表内容\n\n可能有部分论坛skin不支持此选项，请参考Skin说明")?>
    </td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_rss_view value=1></td>
    <td>RSS功能</td>
    <td>
        <input type=checkbox name=bo_use_rss_view value='1' <?=$board[bo_use_rss_view]?'checked':'';?>>开启
        &nbsp;<?=help("开启此功能需要满足游客允许阅读目录及内容才能使用")?>
    </td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_good value=1></td>
    <td>推荐功能(顶)</td>
    <td><input type=checkbox name=bo_use_good value='1' <?=$board[bo_use_good]?'checked':'';?>>开启</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_nogood value=1></td>
    <td>反对功能(踩)</td>
    <td><input type=checkbox name=bo_use_nogood value='1' <?=$board[bo_use_nogood]?'checked':'';?>>开启</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_name value=1></td>
    <td>作者实名</td>
    <td><input type=checkbox name=bo_use_name value='1' <?=$board[bo_use_name]?'checked':'';?>>开启</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_signature value=1></td>
    <td>签名功能</td>
    <td><input type=checkbox name=bo_use_signature value='1' <?=$board[bo_use_signature]?'checked':'';?>>开启</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_ip_view value=1></td>
    <td>IP地址显示</td>
    <td><input type=checkbox name=bo_use_ip_view value='1' <?=$board[bo_use_ip_view]?'checked':'';?>>开启</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_trackback value=1></td>
    <td>引用通告功能</td>
    <td><input type=checkbox name=bo_use_trackback value='1' <?=$board[bo_use_trackback]?'checked':'';?>>开启 (此设置优先于引用通告权限设置)</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_list_content value=1></td>
    <td>预览内容功能</td>
    <td><input type=checkbox name=bo_use_list_content value='1' <?=$board[bo_use_list_content]?'checked':'';?>>开启 (开启后可在目录页面显示部分主题内容)</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_list_view value=1></td>
    <td>显示全部目录</td>
    <td><input type=checkbox name=bo_use_list_view value='1' <?=$board[bo_use_list_view]?'checked':'';?>>开启</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_email value=1></td>
    <td>邮件提醒功能</td>
    <td><input type=checkbox name=bo_use_email value='1' <?=$board[bo_use_email]?'checked':'';?>>开启</td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_skin value=1></td>
    <td>论坛Skin</td>
    <td><select name=bo_skin required itemname="skin">
        <?
        $arr = get_skin_dir("board");
        for ($i=0; $i<count($arr); $i++) {
            echo "<option value='$arr[$i]'>$arr[$i]</option>\n";
        }
        ?></select>
        <script type="text/javascript">document.fboardform.bo_skin.value="<?=$board[bo_skin]?>";</script>
    </td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_gallery_cols value=1></td>
    <td>每行图片数量</td>
    <td><input type=text class=ed name=bo_gallery_cols size=10 required itemname='每行图片数量' value='<?=$board[bo_gallery_cols]?>'>
        <?=help("在相册Skin目录中需要显示的每行图片数量")?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_table_width value=1></td>
    <td>论坛宽度</td>
    <td><input type=text class=ed name=bo_table_width size=10 required itemname='论坛宽度' value='<?=$board[bo_table_width]?>'> 100以下为百分比</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_page_rows value=1></td>
    <td>每页显示主题数量</td>
    <td><input type=text class=ed name=bo_page_rows size=10 required itemname='每页显示主题数量' value='<?=$board[bo_page_rows]?>'></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_subject_len value=1></td>
    <td>标题长度限制</td>
    <td><input type=text class=ed name=bo_subject_len size=10 required itemname='标题长度限制' value='<?=$board[bo_subject_len]?>'> 超出制定长度显示...符号</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_new value=1></td>
    <td>new 图标</td>
    <td><input type=text class=ed name=bo_new size=10 required itemname='new 图标' value='<?=$board[bo_new]?>'> 发表主题后显示new图标的时间</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_hot value=1></td>
    <td>hot 图标</td>
    <td><input type=text class=ed name=bo_hot size=10 required itemname='hot 图标' value='<?=$board[bo_hot]?>'> 超出制定点击数显示hot图标</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_image_width value=1></td>
    <td>图片显示宽度限制</td>
    <td><input type=text class=ed name=bo_image_width size=10 required itemname='图片宽度' value='<?=$board[bo_image_width]?>'> 像素 (允许在论坛内容中显示的最大图片宽度)</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_reply_order value=1></td>
    <td>回帖排列方式</td>
    <td>
        <select name=bo_reply_order>
        <option value='1'>最新回复排在最后显示 (默认)
        <option value='0'>最新回复排在最前显示
        </select>
        <script type='text/javascript'> document.fboardform.bo_reply_order.value = '<?=$board[bo_reply_order]?>'; </script>
    </td>
</tr>

<?/*?>
<tr class='ht'>
    <td><input type=checkbox name=chk_disable_tags value=1></td>
    <td>禁用代码</td>
    <td><input type=text class=ed name=bo_disable_tags style='width:80%;' value='<?=get_text($board[bo_disable_tags])?>'>
        <?=help("多个代码之间，请使用 | 符号分割 (如: <b>script</b>|<b>iframe</b>)\n\nHTML 请在这里编辑需要禁用的网页代码", -50)?></td>
</tr>
<?*/?>

<tr class='ht'>
    <td><input type=checkbox name=chk_sort_field value=1></td>
    <td>论坛文章排列顺序</td>
    <td>
        <select name=bo_sort_field>
        <option value=''>wr_num, wr_reply : 默认排序（速度优先）
        <option value='wr_datetime asc'>wr_datetime asc : 发帖时间倒序
        <option value='wr_datetime desc'>wr_datetime desc : 发帖时间正序
        <option value='wr_hit asc, wr_num, wr_reply'>wr_hit asc : 点击数倒序
        <option value='wr_hit desc, wr_num, wr_reply'>wr_hit desc : 点击数正序
        <option value='wr_last asc'>wr_last asc : 最新回帖倒序
        <option value='wr_last desc'>wr_last desc : 最新回帖正序
        <option value='wr_comment asc, wr_num, wr_reply'>wr_comment asc : 回帖数倒序
        <option value='wr_comment desc, wr_num, wr_reply'>wr_comment asc : 回帖数正序
        <option value='wr_good asc, wr_num, wr_reply'>wr_good asc : 推荐数倒序
        <option value='wr_good desc, wr_num, wr_reply'>wr_good asc : 推荐数正序
        <option value='wr_nogood asc, wr_num, wr_reply'>wr_nogood asc : 反对数倒序
        <option value='wr_nogood desc, wr_num, wr_reply'>wr_nogood asc : 反对数正序
        <option value='wr_subject asc, wr_num, wr_reply'>wr_subject : 标题倒序
        <option value='wr_subject desc, wr_num, wr_reply'>wr_subject : 标题正序
        <option value='wr_name asc, wr_num, wr_reply'>wr_name : 作者倒序
        <option value='wr_name desc, wr_num, wr_reply'>wr_name : 作者正序
        <option value='ca_name asc, wr_num, wr_reply'>ca_name : 分类名称倒序
        <option value='ca_name desc, wr_num, wr_reply'>ca_name : 分类名称正序
        </select>
        <script type='text/javascript'> document.fboardform.bo_sort_field.value = '<?=$board[bo_sort_field]?>'; </script>
        <?=help("请选择主题排列方式\n\n'默认'选项是最佳速度体验设置，其他设置负荷及速度上要慢于默认状态", -50)?>
    </td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_write_min value=1></td>
    <td>发帖最少字节限制</td>
    <td><input type=text class=ed name=bo_write_min size=5 numeric value='<?=$board[bo_write_min]?>'>
        (请输入发帖时需要的最少内容字节数. 设置为0时不限制)</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_write_max value=1></td>
    <td>发帖最长字节限制</td>
    <td><input type=text class=ed name=bo_write_max size=5 numeric value='<?=$board[bo_write_max]?>'>
        (请输入发帖时需要的最长内容字节数. 设置为0时不限制)</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_comment_min value=1></td>
    <td>回帖最少字节限制</td>
    <td><input type=text class=ed name=bo_comment_min size=5 numeric value='<?=$board[bo_comment_min]?>'>
        (请输入发表回帖/评论时需要的最少内容字节数. 设置为0时不限制)</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_comment_max value=1></td>
    <td>回帖最长字节限制</td>
    <td><input type=text class=ed name=bo_comment_max size=5 numeric value='<?=$board[bo_comment_max]?>'>
        (请输入发帖时需要的最长内容字节数. 设置为0时不限制)</td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_upload_count value=1></td>
    <td>附件上传限制</td>
    <td><input type=text class=ed name=bo_upload_count size=10 required itemname='附件数量' value='<?=$board[bo_upload_count]?>'> 每个主题允许上传附件数量 (设置为0不限制上传数量)</td>
</tr>
<?
$upload_max_filesize = ini_get("upload_max_filesize");
if (!preg_match("/([m|M])$/", $upload_max_filesize)) {
    $upload_max_filesize = (int)($upload_max_filesize / 1048576);
}
?>
<tr class='ht'>
    <td><input type=checkbox name=chk_upload_size value=1></td>
    <td>附件容量限制</td>
    <td>限制单个附件最大容量为 <input type=text class=ed name=bo_upload_size size=10 required itemname='附件容量' value='<?=$board[bo_upload_size]?>'> bytes 以下 (当前服务器最大单文件支持上传 <?=ini_get("upload_max_filesize")?> 以下) <?=help("1 MB = 1,024,768 bytes")?></td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_include_head value=1></td>
    <td>顶部样式文件</td>
    <td><input type=text class=ed name=bo_include_head style='width:80%;' value='<?=$board[bo_include_head]?>'></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_include_tail value=1></td>
    <td>底部样式文件</td>
    <td><input type=text class=ed name=bo_include_tail style='width:80%;' value='<?=$board[bo_include_tail]?>'></td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_content_head value=1></td>
    <td>顶部内容</td>
    <!-- <td><textarea class=ed name=bo_content_head rows=5 style='width:80%;'><?=$board[bo_content_head] ?></textarea></td> -->
    <td style='padding-top:7px; padding-bottom:7px;'><?=cheditor2('bo_content_head', $board[bo_content_head]);?></td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_content_tail value=1></td>
    <td>底部内容</td>
    <!-- <td><textarea class=ed name=bo_content_tail rows=5 style='width:80%;'><?=$board[bo_content_tail] ?></textarea></td> -->
    <td style='padding-top:7px; padding-bottom:7px;'><?=cheditor2('bo_content_tail', $board[bo_content_tail]);?></td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_insert_content value=1></td>
    <td>发帖默认内容</td>
    <td><textarea class=ed name=bo_insert_content rows=5 style='width:80%;'><?=$board[bo_insert_content] ?></textarea></td>
</tr>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_use_search value=1></td>
    <td>全局搜索</td>
    <td><input type=checkbox name=bo_use_search value='1' <?=$board[bo_use_search]?'checked':'';?>>开启</td>
</tr>
<tr class='ht'>
    <td><input type=checkbox name=chk_order_search value=1></td>
    <td>搜索顺序</td>
    <td><input type=text class=ed name=bo_order_search size=5 value='<?=$board[bo_order_search]?>'> 整站搜索时搜索顺序数字小的论坛开始搜索</td>
</tr>
<tr><td colspan=3 class='line2'></td></tr>

<? for ($i=1; $i<=10; $i++) { ?>
<tr class='ht'>
    <td><input type=checkbox name=chk_<?=$i?> value=1></td>
    <td><input type=text class=ed name='bo_<?=$i?>_subj' value='<?=get_text($board["bo_{$i}_subj"])?>' title='扩展字段 <?=$i?> 标题' style='text-align:right;font-weight:bold;'></td>
    <td><input type=text class=ed style='width:80%;' name='bo_<?=$i?>' value='<?=get_text($board["bo_$i"])?>' title='扩展字段 <?=$i?> 设定值'></td>
</tr>
<? } ?>

<tr><td colspan=3 class='line2'></td></tr>
<tr class='ht'>
    <td colspan=3 align=left>
        <?=subtitle("XSS / CSRF 安全认证")?>
    </td>
</tr>
<tr><td colspan=3 class='line1'></td></tr>
<tr class='ht'>
    <td colspan='2'>
        管理员密码
    </td>
    <td>
        <input class='ed' type='password' name='admin_password' itemname="管理员密码" required>
        <?=help("请输入管理员密码，点击确定更新当前配置");?>
    </td>
</tr>
<tr><td colspan=3 class='line1'></td></tr>
</table>

<p align=center>
    <input type=submit class=btn1 accesskey='s' value='  确  定  '>&nbsp;
    <input type=button class=btn1 value='  返  回  ' onclick="document.location.href='./board_list.php?<?=$qstr?>';">&nbsp;
    <? if ($w == 'u') { ?><input type=button class=btn1 value='  复制配置  ' onclick="board_copy('<?=$bo_table?>');"><?}?>
</form>

<script type="text/javascript">
function board_copy(bo_table) {
    window.open("./board_copy.php?bo_table="+bo_table, "BoardCopy", "left=10,top=10,width=500,height=200");
}

function set_point(f) {
    if (f.chk_point.checked) {
        f.bo_read_point.value     = "<?=$config[cf_read_point]?>";
        f.bo_write_point.value    = "<?=$config[cf_write_point]?>";
        f.bo_comment_point.value  = "<?=$config[cf_comment_point]?>";
        f.bo_download_point.value = "<?=$config[cf_download_point]?>";
    } else {
        f.bo_read_point.value     = f.bo_read_point.defaultValue;
        f.bo_write_point.value    = f.bo_write_point.defaultValue;
        f.bo_comment_point.value  = f.bo_comment_point.defaultValue;
        f.bo_download_point.value = f.bo_download_point.defaultValue;
    }
}

function fboardform_submit(f) {
    var tmp_title;
    var tmp_image;

    tmp_title = "顶部";
    tmp_image = f.bo_image_head;
    if (tmp_image.value) {
        if (!tmp_image.value.toLowerCase().match(/.(gif|jpg|png)$/i)) {
            alert(tmp_title + "图片格式错误。仅支持gif, jpg, png格式");
            return false;
        }
    }

    tmp_title = "底部";
    tmp_image = f.bo_image_tail;
    if (tmp_image.value) {
        if (!tmp_image.value.toLowerCase().match(/.(gif|jpg|png)$/i)) {
            alert(tmp_title + "图片格式错误。仅支持gif, jpg, png格式");
            return false;
        }
    }

    if (parseInt(f.bo_count_modify.value) < 1) {
        alert("修改主题内容限制最少值不能小于1");
        f.bo_count_modify.focus();
        return false;
    }

    if (parseInt(f.bo_count_delete.value) < 1) {
        alert("删除主题内容限制最少值不能小于1");
        f.bo_count_delete.focus();
        return false;
    }

    <?=cheditor3('bo_content_head')."\n";?>
    <?=cheditor3('bo_content_tail')."\n";?>

    f.action = "./board_form_update.php";
    return true;
}
</script>

<?
include_once ("./admin.tail.php");
?>
