<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("inc/pageclass.php");
include_once("conn.php");
include_once("touxianfun.php");
include_once("ftbbs_nav.php");
include_once("checkuser.php");
include_once("bbsuser.php");

$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);

$getcodeoff=$ftbbsmb[30];
$onlineoff=$ftbbsmb[33];
$linkoff=$ftbbsmb[34];
$defaulthome=$ftbbsmb[31];
include_once("homeurl.php");
$url=$ftbbsmb[10];
$upfiletype=$ftbbsmb[12];
$upfilesize=$ftbbsmb[13];
$htm_ext=$ftbbsmb[32];
$postvalue=$ftbbsmb[54];
$pollvalue=$ftbbsmb[55];
$clubuser_id=get_cookie('clubuser_id');

$BoardID_1 = $_GET["layer_1"];
$BoardID_2 = $_GET["layer_2"];
$fd=$_GET["fd"];
$page = $_GET["page"];
$filename=time()."a".rand(100,999).$htm_ext;

if ($fd=="1" || $fd=="2"){
   if ($pollvalue==0){
      $topqs=1;
   }
   else{
      $topqs=jingyuantoqs($clubuser_id,$pollvalue);
   }
}
else{
   if ($postvalue==0){
      $topqs=1;
   }else{
      $topqs=jingyuantoqs($clubuser_id,$postvalue);
   }
}

if ($BoardID_1!=""){
   $query="select BBS_Cate_ID,BBS_Cate_Name,BBS_Cate_Manager_Name,BBS_Cate_QS from {$tablepre}bbs_cate where BBS_Cate_PID='0' and BBS_Cate_ID='".$BoardID_1."' order by BBS_ID asc";
   $ftbbsbz1=makecache('ftbbsbz1.html',$query,$expire);
   $BBS_Cate_QS1=$ftbbsbz1[3];
}
if ($BoardID_2!=""){
   $query="select BBS_Cate_ID,BBS_Cate_Name,BBS_Cate_Manager_Name,BBS_Cate_QS from {$tablepre}bbs_cate where BBS_Cate_PID='".$BoardID_1."' and BBS_Cate_ID='".$BoardID_2."' order by BBS_ID asc";
   $ftbbsbz2=makecache('ftbbsbz2.html',$query,$expire);
   $BBS_Cate_QS2=$ftbbsbz2[3];
}
if ((get_cookie('bz')!=1 && get_cookie('bbsadmin')!=1) && ($BBS_Cate_QS1==4 || $BBS_Cate_QS1==5 || $BBS_Cate_QS2==4 || $BBS_Cate_QS2==5 || $topqs==0)){
   $postqs="disabled";
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<script language=javascript src="js/resetcode.js"></script>
<script language=javascript src="inc/cookies.js"></script>
<script>
var stylecook = getCookie("STYLESHOW");
var style;
var strstyle;
if(stylecook=="")
{
 stylecook=1;
}
else
{
 stylecook++;
}
style="main0"+stylecook+".css";
strstyle="<link href=\"css/"+style+"\"  rel=\"stylesheet\" type=\"text/css\"> ";
document.write(strstyle);
</script>
<script language="javascript">
<!--
    function changetitle(txt){
	   var currentTitle = document.myform.title.value;
       if (txt.charAt(1)==" "){
           txt1=txt.substr(2);
           document.myform.title.value=txt1+currentTitle;}
      else{
	       document.myform.title.value=txt+currentTitle;}
    }
//-->
</script>
<body leftmargin="0" topmargin="2">
<?
if (get_cookie('ftbbstype')==1){
include_once("pbhead.php");
}
?>
  <table border="0" width="99%" align="center" cellpadding="2" cellspacing="1" class="maintbbg">
    <tr> 
      <td width="100%" height="25" class="f12bg">&nbsp;<?=$userinfo?>
      </td>
    </tr>
    <tr> 
      <td width="100%" height="25" class="maintbtr3">&nbsp;<a href="<?=$homepage?>">论坛首页</a> >> 发布话题
      </td>
   </tr>
</table>
<table cellspacing=0 cellpadding=0 width="99%" align=center border=0>
<tbody>
    <tr>
      <td height=6></td>
    </tr>
</tbody>
</table>
<table width="99%" border="0" cellspacing="1" cellpadding="1" align="center" class="listborder">
  <TR class="f12bg"> 
    <TD height="26" colspan="2"> <div align="center"><b>论 坛 话 题 发 布</b></div></TD>
  </TR>
<form name="myform" method="POST" action="check.php" <? if ($fd==1){?>onsubmit="return CheckPollForm(this)" <? }else{?>onsubmit="return CheckForm(this)" <? }?>>
<?if ($BoardID_1=="" || $BoardID_2==""){?>
<script LANGUAGE="javascript">
<!--
var onecount;
onecount=0;
var j;
  
subcat = new Array();
<?
$strsql="select BBS_Cate_ID,BBS_Cate_PID,BBS_Cate_Name,Initial from {$tablepre}bbs_cate where BBS_Cate_PID<>'0' and deleted=0  order by totop asc";
$rs=mysql_query($strsql);
$row = mysql_fetch_array($rs);
$rsnum= mysql_num_rows($rs);
$j=0;
do {
?>
subcat[<?=$j?>] = new Array("<?=$row[2]?>","<?=$row[1]?>","<?=$row[0]?>");
<?
$j++;
}
while ($row = mysql_fetch_array($rs))
?>

onecount=<?=$j?>;

function changelocation(locationid)
    {
    document.myform.BoardID_2.length = 0; 

    var locationid=locationid;
    var i;
    document.myform.BoardID_2.options[0] = new Option('==请选择==','');
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
            document.myform.BoardID_2.options[document.myform.BoardID_2.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    

//-->
</script>
    <TR> 
      <TD width="16%" height="25" class="loopborder1" align="right"> 主论坛：</TD>
      <TD width="84%" class="loopborder1" align="left"> 
        <SELECT NAME="BoardID_1" onChange="changelocation(document.myform.BoardID_1.options[document.myform.BoardID_1.selectedIndex].value)">
          <option value="">==请选择==</option>
<?
$str="select BBS_Cate_ID,BBS_Cate_Name from {$tablepre}bbs_cate Where BBS_Cate_PID='0' and deleted=0 order by BBS_ID asc";
$rs1=mysql_query($str);
$row1 = mysql_fetch_array($rs1);
$rsnum1= mysql_num_rows($rs1);
do {
?>
<option value="<?=$row1["BBS_Cate_ID"]?>"><?=$row1["BBS_Cate_Name"]?></option>
<?
}
while ($row1 = mysql_fetch_array($rs1));
?>
        </SELECT>
      </TD>
    </TR>
    <TR> 
      <TD width="16%" height="25" class="loopborder1"> 
        <div align="right">分论坛：</div>
      </TD>
      <TD width="84%" height="25" class="loopborder1"> 
        <SELECT NAME="BoardID_2">
          <option value="">==请选择==</option>
        </SELECT>
      </TD>
    </TR>
<?
}
else{
?>
    <TR> 
      <TD width="16%" class="loopborder1"></TD>
      <TD width="84%" class="loopborder1"> 
        <INPUT TYPE="hidden" name="BoardID_1" value="<?=$BoardID_1?>">
        <INPUT TYPE="hidden" name="BoardID_2" value="<?=$BoardID_2?>">
      </TD>
    </TR>
<?
}
?>
    <TR> 
      <TD width="16%" height="25" class="loopborder1" align="right"> 主　题：</TD>
      <TD width="84%" height="25" class="loopborder1">
	    <select name="zhiye" id="zhiye" style="width:60px" onChange="changetitle(document.myform.zhiye.options[document.myform.zhiye.selectedIndex].text)">
          <option value="1" selected>[原创]</option>
          <option value="2">[转载]</option>
		  <option value="3">[灌水]</option>
		  <option value="4">[讨论]</option>
		  <option value="5">[求助]</option>
		  <option value="6">[推荐]</option>
		  <option value="7">[公告]</option>
		  <option value="8">[贴图]</option>
		  <option value="9">[建议]</option>
		  <option value="10">[下载]</option>
        </select>
        <input type="text" name="title" size="50" id="title">
        <?if (get_cookie('bz')==1 || get_cookie('bbsadmin')==1){?>
        <SELECT name=titlecolor>
          <option style="background-color:#ffffff;color: #000000" value="" selected>标题颜色</option>
          <option style="background-color:#FF0000;color: #FF0000" value="#FF0000">#FF0000</option>
          <option style="background-color:#BC8F8F;color: #BC8F8F" value="#BC8F8F">#BC8F8F</option>
          <option style="background-color:#4169E1;color: #4169E1" value="#4169E1">#4169E1</option>
          <option style="background-color:#8B4513;color: #8B4513" value="#8B4513">#8B4513</option>
          <option style="background-color:#FA8072;color: #FA8072" value="#FA8072">#FA8072</option>
          <option style="background-color:#F4A460;color: #F4A460" value="#F4A460">#F4A460</option>
          <option style="background-color:#2E8B57;color: #2E8B57" value="#2E8B57">#2E8B57</option>
          <option style="background-color:#A0522D;color: #A0522D" value="#A0522D">#A0522D</option>
          <option style="background-color:#C0C0C0;color: #C0C0C0" value="#C0C0C0">#C0C0C0</option>
          <option style="background-color:#87CEEB;color: #87CEEB" value="#87CEEB">#87CEEB</option>
          <option style="background-color:#6A5ACD;color: #6A5ACD" value="#6A5ACD">#6A5ACD</option>
          <option style="background-color:#708090;color: #708090" value="#708090">#708090</option>
          <option style="background-color:#4682B4;color: #4682B4" value="#4682B4">#4682B4</option>
          <option style="background-color:#D2B48C;color: #D2B48C" value="#D2B48C">#D2B48C</option>
          <option style="background-color:#008080;color: #008080" value="#008080">#008080</option>
          <option style="background-color:#D8BFD8;color: #D8BFD8" value="#D8BFD8">#D8BFD8</option>
          <option style="background-color:#FF6347;color: #FF6347" value="#FF6347">#FF6347</option>
          <option style="background-color:#40E0D0;color: #40E0D0" value="#40E0D0">#40E0D0</option>
          <option style="background-color:#EE82EE;color: #EE82EE" value="#EE82EE">#EE82EE</option>
          <option style="background-color:#F5DEB3;color: #F5DEB3" value="#F5DEB3">#F5DEB3</option>
          <option style="background-color:#435454;color: #435454" value="#435454">#435454</option>
          <option style="background-color:#9ACD32;color: #9ACD32" value="#9ACD32">#9ACD32</option>
        </SELECT> 
        <?}?>
      </TD>
    </TR>
<?
if ($fd==1){
?>	
    <TR>
      <TD width="16%" align="right" height="25" class="loopborder1">投　票：</TD>
      <TD height="25" class="loopborder1">
	    <input name=tptype type=radio value=1 checked>
        单选&nbsp;&nbsp;
        <input name=tptype type=radio value=2>
        多选 &nbsp;(每行一个投票项目,项目太少请点击<a href="javascript:AddLabel('VoteList')">添加项目</a>)<br>
        <script language="javascript" type="text/javascript" src="js/votelabel.js"></script>
        <div id="VoteList"></div>
		<script language="javascript" type="text/javascript">
			var MinCount=parseInt('2');//投票最小项目数
			var MaxCount=parseInt('20');//投票最大项目数
			var CurrentCount=0;
			var RealCount=0;
			init();
		</script>
        <font color="#FF0000">有效期</font> 
        <input name="daynum" type="text" id="daynum" size="8" onkeyup="if(isNaN(this.value))this.value='7'">
        天(注:从发布之日起过了输入的天数后就失效)
		</TD>
    </TR>
<?
}
?>	
    <TR class="maintbtr3"> 
      <TD class="loopborder1"> 
        <div align="right">内　容：</div>
      </TD>
      <TD height=300>
<TEXTAREA type="hidden" rows=1 cols=1 name="menu" style="position:absolute;left:0;visibility:hidden;"></textarea>
<script type="text/javascript" src="fteditor/editor.js"></script> 
<script type="text/javascript">
var editor = new FtEditor("editor");
editor.hiddenName = "menu";
editor.editorWidth = "100%";
editor.editorHeight = "300px";
editor.show();
</script>
     </TD>
   </TR>
    <TR> 
      <TD width="16%" height="25" class="loopborder1"> 
        <div align="right">上传附件：</div>
      </TD>
      <TD width="84%" height="28" class="loopborder1">
<IFRAME name=mqs marginWidth=0 marginHeight=0 src="FtbbsUpFile.php?filename=<?=$filename?>" frameBorder=0 width=100% scrolling=no height=25></IFRAME>
      </TD>
    </TR>
    <TR> 
      <TD width="16%" class="loopborder1"> <div align="right">发布状态：</div></TD>
      <TD width="84%" class="loopborder1" height="30">
	    <input type=radio name=ticon value=0.gif> <img src=images/0.gif width=19 height=19 > 
        <input type=radio name=ticon value=29.gif> <img src=images/29.gif width=19 height=19> 
        <input type=radio name=ticon value=30.gif> <img src=images/30.gif width=19 height=19> 
        <input type=radio name=ticon value=31.gif> <img src=images/31.gif width=19 height=19>
        <input type=radio name=ticon value=34.gif> <img src=images/34.gif width=19 height=19> 
        <input type=radio name=ticon value=36.gif> <img src=images/36.gif width=19 height=19> 
        <input type=radio name=ticon value=37.gif> <img src=images/37.gif width=19 height=19> 
        <input type=radio name=ticon value=38.gif> <img src=images/38.gif width=19 height=19> 
        <input type=radio name=ticon value=39.gif> <img src=images/39.gif width=19 height=19> 
        <input type=radio name=ticon value=40.gif> <img src=images/40.gif width=19 height=19> 
        <input type=radio name=ticon value=41.gif> <img src=images/41.gif width=19 height=19> 
        <input type=radio name=ticon value=42.gif> <img src=images/42.gif width=19 height=19> 
        <input type=radio name=ticon value=43.gif> <img src=images/43.gif width=19 height=19> 
       </TD>
    </TR>
	<? if ($fd==0){?>
    <TR> 
      <TD width="16%" height="25" class="loopborder1"> 
        <div align="right">其他选项：</div>
      </TD>
      <TD width="84%" height="25" class="loopborder1">
	   <select name="fd" id="fd">
	      <option value="0" selected>普通贴</option>
          <option value="3">注册用户可查看</option>
          <option value="4">回贴后可以查看</option>
        </select>
	  </TD>
    </TR>
	<? }?>
    <TR> 
      <TD width="16%" height="25" class="loopborder1"> 
        <div align="right"><font color="#FF0000">是否加入博客：</font></div>
      </TD>
      <TD width="84%" height="25" class="loopborder1"><input type="radio" name="addblog" value="Y">
        是 (内容加入到个人博客) 
        <input name="addblog" type="radio" value="N" checked>
        否 (内容不加入个人博客)</TD>
    </TR>
	<?if ($getcodeoff==1){?>
    <TR> 
      <TD width="16%" height="25" class="loopborder1"> 
        <div align="right">验 证 码：</div>
      </TD>
      <TD width="84%" height="25" class="loopborder1"><input name=codestr id=codestr type=text size=10 maxlength=4>
	  <img src="getyzm.php" alt="看不清楚请点击刷新验证码" class="simg" style="cursor : pointer;" onclick="this.src='getyzm.php';" align="absmiddle"></TD>
    </TR>
	<?}?>
    <TR class="maintbtr3"> 
      <TD height="35" colspan=2 align=center>
	    <input name="bbs_img_display" type="hidden" id="bbs_img_display">
		<input name="bbs_img" type="hidden" id="bbs_img">
		<input name="CurrentMode" type="hidden" id="CurrentMode">
        <INPUT type="hidden" name="FileName" value="<?=$filename?>">
		<? if ($fd==1 || $fd==2){?>
		<INPUT type="hidden" name="fd" value="<?=$fd?>">
		<? }?>
		<INPUT type="hidden" name="layer_1" value="<?=$BoardID_1?>">
		<INPUT type="hidden" name="layer_2" value="<?=$BoardID_2?>">
        <input style="height:25px;" type="submit" value="发布话题" name="submit1" <?=$postqs?>>
		<input type="button" name="Submit" value="恢复数据" onClick="FtSimpleExecute('paste');" style="height:25px;">
      </TD>
    </TR>
	</form>
  </TABLE>
<?
$db->close(); 
include_once("inc/bbstail.php");
?>