#####################################################
#  LEO SuperCool BBS / LeoBBS X / 雷傲極酷超級論壇  #
#####################################################
# 基於山鷹(糊)、花無缺製作的 LB5000 XP 2.30 免費版  #
#   新版程式製作 & 版權所有: 雷傲科技 (C)(R)2004    #
#####################################################
#      主頁地址： http://www.LeoBBS.com/            #
#      論壇地址： http://bbs.LeoBBS.com/            #
#####################################################

$maxpoststr = "" if ($maxpoststr eq 0);
$maxpoststr = 100 if (($maxpoststr < 100)&&($maxpoststr ne ""));
if ($emoticons eq "on") { $emoticonslink = qq~<input CHECKED name=inshowemoticons type=checkbox value=yes>使用表情字符轉換？~; }
if ($emailfunctions eq "on") {
    if ($innotify eq "yes") { $requestnotify = qq~<input name=notify type=checkbox value=yes checked>有回覆時使用郵件通知您？<br>~; }
	               else { $requestnotify = qq~<input name=notify type=checkbox value=yes>有回覆時使用郵件通知您？<br>~;}
}
if ($canchgfont ne "no") {
    $fontpost = qq~<input type=checkbox name="inshowchgfont" value="yes">使用字體轉換？<br>~;
} else {
    undef $fontpost;
}
if ($idmbcodestate eq "on") {
    $idmbcodestates = qq~<input type=checkbox name="uselbcode" value="yes" checked>使用 LeoBBS 標籤？<BR>~;
} else {
    $idmbcodestates = "";
}

$maxpoststr = "(文章中最多包含 <B>$maxpoststr</B> 個字符)" if ($maxpoststr ne "");

### add by studenttwok savepost hack ###
if ($div_save_post eq 1) {
$output .= qq~
<script>
function getCookieVal (offset) {
	var endstr=document.cookie.indexOf (";",offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}  

function savePost(){
	if (checklength(document.FORM) < $maxpoststr) {
	var name = 'R2postSave';
	var value = document.FORM.inpost.value;
	var expsec = 300000;
	var exp = new Date();
	exp.setTime(exp.getTime() + (expsec));
	var expires='; expires=' + exp.toGMTString();
	document.cookie = name + "=" + escape (value) + expires;
	}
	clckcntr();
}

function resetPost(){
	var name = 'R2postSave';
	var value = '';
	var expsec = -1;
	var exp = new Date();
	exp.setTime(exp.getTime() + (expsec));
	var expires='; expires=' + exp.toGMTString();
	document.cookie = name + "=" + escape (value) + expires;
	return 1;
}

function postLoad(){
	var arg="R2postSave=";
	var save_Post=null;
	var alen=arg.length;
	var clen=document.cookie.length;
	var i = 0;
	while (i<clen){
		var j=i+alen;
		if (document.cookie.substring(i,j)==arg){
			save_Post = getCookieVal (j);
			i=0;
		}else{
			i = document.cookie.indexOf(" ",i)+1;
		}
		if (i==0)break;
	}
	if(save_Post != null){
		document.FORM.inpost.value=save_Post;
	}
}

function checklength(theform){
var odds=0;
for(var i=0;i<theform.inpost.value.length;i++){if (theform.inpost.value.charCodeAt(i)>255) odds++;}
odds=theform.inpost.value.length+odds;
return odds;
}

</script>

~;

}
### add by studenttwok savepost hack end ###


$output .= qq~<form action=post.cgi method=post name="FORM" enctype="multipart/form-data">
<input type=hidden name=action value=addreply>
<input type=hidden name=forum value=$inforum>
<input type=hidden name=topic value=$intopic>
<SCRIPT>valigntop()</SCRIPT>
<table cellPadding=5 cellSpacing=1 width=$tablewidth bgcolor=$tablebordercolor align=center>
<tr><td bgcolor=$titlecolor width=220 $catbackpic><font color=$fontcolormisc><b>快速回覆主題:</b></font></td><td bgcolor=$titlecolor width=500 $catbackpic> <font color=$fontcolormisc>$topictitletemp</font></td></tr>
<tr><td bgcolor=$miscbacktwo colspan=3><font color=$titlefontcolor>您目前的身份是： <font color=$fonthighlight><B><u>$inmembername</u></B></font> ，要使用其他會員身份，請輸入會員名稱和密碼。未註冊訪客請輸入網名，密碼留空。</td></tr>
<tr><td bgcolor=$miscbackone><font color=$fontcolormisc><b>輸入會員名稱和密碼:</b></font></td><td bgcolor=$miscbackone> <font color=$fontcolormisc><b>會員名稱</b>: <input type=text name=membername> <span onclick="javascript:location.href='register.cgi?forum=$inforum'" style=cursor:hand>沒有註冊？</span>　<b>密碼:</b> <input type=password name=password> <a href=profile.cgi?action=lostpass style=cursor:help>忘記密碼？</a></font></td></tr>
~;

if (($allowattachment ne "no")||($mymembercode eq "ad")||($mymembercode eq 'smo')||($myinmembmod eq "yes")) {
    $uploadreqire = "" if ($uploadreqire <= 0);
    $uploadreqire = "<BR>發表文章數要大於 <B>$uploadreqire</B> 篇(認證會員不限)" if ($uploadreqire ne "");
	$output .= qq~<script language="javascript">function jsupfile(upname) {upname='[UploadFile='+upname+']';if (document.FORM.inpost.createTextRange && document.FORM.inpost.caretPos) {var caretPos = document.FORM.inpost.caretPos;caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? upname + ' ' : upname;document.FORM.inpost.focus();} else {document.FORM.inpost.value+=upname;document.FORM.inpost.focus();}}</script>~;
        $output .= qq~<tr><td bgcolor=$miscbackone><b>上載附件或圖片</b> (最大容量 <B>$maxupload</B>KB)$uploadreqire</td><td bgcolor=$miscbackone colspan=2> <iframe id="upframe" name="upframe" src="upfile.cgi?action=uppic&forum=$inforum&topic=$intopic" width=100% height=40 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=NO></iframe><br><font color=$fonthighlight>目前附件:(如不需要某個附件，只需刪除內容中的相應 [UploadFile ...] 標籤即可)  [<a href=upfile.cgi?action=delup&forum=$inforum target=upframe title=刪除所有未被發佈的附件臨時檔案 OnClick="return confirm('確定刪除所有未被發佈的附件臨時檔案麼？');">刪除</a>] </font></font><SPAN id=showupfile name=showupfile></SPAN></td></tr>~;
}
$output .= qq~
<tr><td bgcolor=$miscbacktwo valign=top><font color=$fontcolormisc><b>選項</b> $maxpoststr<br><BR>
$idmbcodestates
<input CHECKED name=inshowsignature type=checkbox value=yes>顯示您的簽名？<br>
$requestnotify$emoticonslink<BR>$fontpost</font></td>
<td bgcolor=$miscbacktwo width=*> <A name=sub></A><textarea cols=75 name=inpost onKeyDown=ctlent() rows=8 title='使用 Ctrl+Enter 直接送出文章' id=PostRE></textarea><br>
~;
### edit by studenttwok savepost hack ###
if ($div_save_post eq 1) { $output.=qq~ <INPUT name=Submit onclick="return savePost();" type=submit value="發 表 回 覆">~; } else { $output.=qq~ <INPUT name=Submit onclick="return clckcntr();" type=submit value="發 表 回 覆">~; }
### edit by studenttwok savepost hack end ###

$output.=qq~
　<input type=button value="預 覽 內 容" name=Button onclick=gopreview()>　<INPUT name=Clear type=reset value="清 除">
~;
### add by studenttwok savepost hack ###
if ($div_save_post eq 1) { $output.=qq~　<INPUT name=Clear_cookies onclick="resetPost();" type=reset value="清 除 暫 存"> <img src='' width=1 hight=1 onError="postLoad();">~; }
### add by studenttwok savepost hack end ###
$output.=qq~
　　快速引用第 <input name=floor value="" size="4" maxlength="4"> 樓層的回覆
</td></tr></table><SCRIPT>valignend()</SCRIPT></form>
<form name=preview action=preview.cgi method=post target=preview_page><input type=hidden name=body value=""><input type=hidden name=forum value="$inforum"></form>
<script>
function gopreview(){
document.preview.body.value=document.FORM.inpost.value;
var popupWin = window.open('', 'preview_page', 'scrollbars=yes,width=600,height=400');
document.preview.submit()
}
</script>
~;
1;
