<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}

global $fsetting, $groupsetting, $board_settings,$dispbody,$dispbutton;
$Forum_sn = GetFormID();
$star = ( !is_numeric($GLOBALS['star']) ? 1 : intval($GLOBALS['star']) );
$page = ( !is_numeric($GLOBALS['page']) ? 1 : intval($GLOBALS['page']) );
$actionname = $ActionName;
$width = $lang['Dvbbs.mainsetting0'];
$alertcolor = $lang['Dvbbs.mainsetting1'];
$Dvbbs_Mode = intval($groupsetting[67]);
if( $board_settings[66] == 0 ){
	$Dvbbs_Mode = 2;
}
if( $Action !== 4 && isset($userinfo['postdata']) === true ){
	$content = $userinfo['postdata'];
}
$tmpArr = explode(',',$lang['template.strings8']);
if( $groupsetting[59] != 1){
	$MoneyPostInfo = '';
}
$user_wealth=user_wealth();
if($Action==11 or $Action==13 or $Action==14){
	$dispbody='style="display:none"';
	$dispbutton=$lang['tpl.str243'];
}
else{
	$dispbody='style="display:block"';	
	$dispbutton=$lang['tpl.str206'];
}
$MyTopicMode = 0;
switch($Action){
	case 5:
	case 7:
	case 8:
	case 1:
		if( $userid <= 0 ){
			$post_membername = $lang['tpl.str1'].'" readonly="readonly';
			$memberword = '**********" readonly="readonly';
		} else{
			$post_membername = $GLOBALS['membername'];
			$memberword = '**********';
		}
		$content = htmlspecialchars($content);
		$TopModeSelect = $MyTopicMode;
		$totalusetable = $fsetting['nowtablename'];
		$MoneyPostInfo = '';
		if( $query = $db->query("SELECT magicface_s,tmoney,tticket FROM {$dv}plus_tools_magicface ORDER BY id",array('pageSize'=>1)) ){
			$tmpResult = $db->fetch_row($query);
			$db->free_result($query);
		}
		if( empty($tmpResult) === false ){
			$firstmagicface = $tmpResult[0];
			$magicmoney = $tmpResult[1];
			$magicticket = $tmpResult[2];
		} else{
			$firstmagicface = 0;
			$magicmoney = 0;
			$magicticket = 0;
		}
		break;
	case 2:
		if( $userid <= 0 ){
			$post_membername = $lang['tpl.str1'].'" readonly="readonly';
			$memberword = '**********" readonly="readonly';
		} else{
			$post_membername = $GLOBALS['membername'];
			$memberword = '**********';
		}
		$TopModeSelect = $MyTopicMode;
		if( !empty($_topicInfo) ){
			if( $lockuser == 1 || $lockuser == 2 ){
				$content = '';
			} elseif( $_topicInfo['locktopic'] == 2 || $_topicInfo['locktopic'] == 3 ){
				$content = '';
			} elseif( $_topicInfo['isbest'] == 1 && $groupsetting[41] == 0 ){
				$content = '';
			} else{
				$content =& $_topicInfo['body'];
			}
			$PostBuyUser = $_topicInfo['postbuyuser'];
			if( $_topicInfo['getmoneytype'] == 3 && strpos($PostBuyUser,'|||$PayMoney|||') !== false ){
				if( strpos($PostBuyUser,"|||{$post_membername}") === false ){
					$content = '';
				}
			}
			//$topic =& $_topicInfo['topic'];
			$topic = '';
			$username = $_topicInfo['username'];
			$postdate = gmdate("Y-m-d H:i:s",$_topicInfo['dateandtime']+getUserTimeZoneOffset());
			$ubblists =& $_topicInfo['ubblist'];
			if( $username == $post_membername ){
				if( $groupsetting[4] == 0 ){
					showmsg($lang['Error.strings73']);
					exit;
				}
			} else{
				if( $groupsetting[2] == 0 ){
					showmsg($lang['Error.strings31']);
					exit;
				}
			}
			if( $_topicInfo['signflag'] == 2 && $board_settings[58] == 1 ){
				$username = $lang['tpl.str2'];
				$fullip = explode('.',$_topicInfo['ip']);
				$postip = '('.$fullip[0].$fullip[1].')';
			}
			$username .= $postip;
		}
		if( $topic != '' ){
			$retitle = str_replace('{$UserName}',$username,$lang['template.strings31']).$topic;
		} else{
			$retitle = str_replace('{$UserName}',$username,$lang['template.strings31']).$content;
		}
		$topic = cutStr($topic,50);
		$topic = str_replace("\r","",str_replace("\n","",addslashes($topic)));
		if( $GLOBALS['reply'] == 'true' && $content != '' ){
			$content = reUBBCode(Ubb2Html($content));
			if( $GLOBALS['Dvbbs_Mode'] == 2 ){
				$content = "[quote][b]{$lang['tpl.str3']}[i]{$username}[/i]{$lang['tpl.str4']}{$postdate}{$lang['tpl.str5']}[/b][b]{$content}[/quote]";
			} else{
				$content = "<DIV class=quote><B>{$lang['tpl.str3']}<i>{$username}</i>{$lang['tpl.str4']}{$postdate}{$lang['tpl.str5']}</B><br>{$content}</DIV><p>";
			}
			$content = htmlspecialchars($content);
		} else{
			$content = '';
		}
		break;
	case 3:
		if( $userid <= 0 ){
			$post_membername = $lang['tpl.str1'].'" readonly="readonly';
			$memberword = '**********" readonly="readonly';
		} else{
			$post_membername = $GLOBALS['membername'];
			$memberword = '**********';
		}
		$TopModeSelect = $MyTopicMode;
		$totalusetable = $fsetting['nowtablename'];
		$content = htmlspecialchars($content);
		break;
	case 4:
		$post_membername = $GLOBALS['membername'];
		if( $content != '' ){
			$content = preg_replace(
					    array(
						 '/<div align=right><font color=#000066>(.|\n)*<\/font><\/div>/i'
						,'/\[align=right\]\[color=#000066\](.|\n)*\[\/color\]\[\/align\]/i'
						,'/<div align=right><font color=#000066>(.|\n)*<\/font><\/div>/i'
						,'/\[align=right\]\[color=#000066\](.|\n)*\[\/color\]\[\/align\]/i'
						)
					   ,''
					   ,$content);
			$content = htmlspecialchars(Ubb2Html($content));
		}
		break;
}
$displaysignopts = true;
if (!isset($signflag)) {
	if ('1' == $groupsetting[55] OR '1' == $fsetting['usersign']) {
		$signflag = 1;
	} elseif ('1' != $groupsetting[55] AND '1' != $fsetting['usersign']) {
		$signflag = 0;
		$displaysignopts = false;
	} else {
		$signflag = 0;
	}
}
if (!isset($mailflag)) {
	$mailflag = 0;
}
if( $userid <= 0 ){
	$checksign0 = ' checked="checked" ';
	$checksign1 = ' disabled="disabled" ';
	$checksign2 = ' disabled="disabled" ';
	$checkbox2 = ' checked="checked" ';
	$checkbox3 = ' disabled="disabled" ';
	$checkbox4 = ' disabled="disabled" ';
	$checkbox5 = ' disabled="disabled" ';
} else{
	$checksign0 = '';
	$checksign1 = '';
	$checksign2 = '';
	if ($board_settings[58] == 0 OR $Notanony) {
		$checksign2 = ' disabled="disabled" ';
		if( $signflag == 2 ) $signflag = 1;
	}
	${'checksign'.$signflag} = ' checked="checked" ';
	$checkbox2 = '';
	$checkbox3 = '';
	$checkbox4 = '';
	$checkbox5 = '';
	${'checkbox'.($mailflag+2)} = ' checked="checked" ';
}
$SelectFace = $Expression;
global $_GET;
$toaction .= "&star={$_GET['star']}&page={$_GET['page']}&edittopicid={$_GET['id']}&editreplyid={$_GET['replyid']}";
print <<<EOT
	<!--post.php##发帖、回帖、投票、编辑整体页面 更新时间2005-10月20日，注意要和post.php一起更新-->
<div  onkeydown="if(window.ctlent){ctlent()}">
EOT;

if ($Action != 5) {print <<<EOT
<script src="templates/lang/{$GLOBALS['fsetting']['lang']}/js/dv_ajaxclass.js" type="text/javascript"></script>	
<script src="templates/lang/{$GLOBALS['fsetting']['lang']}/js/post/dhtmlEdit.js" type="text/javascript"></script>
<form name="Dvform" method="post" action="{$toaction}" onsubmit="try{Dvbbs_CopyData('body');return Checkpostdata();}catch(e){alert(e.description);return false;}">
EOT;
}
	for($i=0;$i<count($_DCACHE['forum_postface'])-1;$i++){
		$Forum_PostFace .= $_DCACHE['forum_postface'][$i]. '|||';
	}
	for($i=0;$i<count($_DCACHE['forum_emot'])-1;$i++){
		$Forum_emot .= $_DCACHE['forum_emot'][$i]. '|||';
	}
	$Forum_emot = str_replace('|||','<><><>',$Forum_emot);
	$jsForum_PostFace = format_jscode($Forum_PostFace);
	$jsForum_PostFacearr = explode('|||',$jsForum_PostFace);

print <<<EOT
	<input type="hidden" name="upfilerename" />
	<input type="hidden" name="__upload_subdir" />
	<input type="hidden" name="__upfileinfo" />
	<input type="hidden" name="body" id="Body" value="{$content}" />
	<input type="hidden" name="dvbbs" value="{$Forum_sn}" />
	<input type="hidden" name="star" value="{$star}" />
	<input type="hidden" name="page" value="{$page}" />
	<input type="hidden" name="totalusetable" value="{$totalusetable}" />
	<INPUT TYPE="hidden" NAME="expression" value="{$jsForum_PostFacearr[1]}">
EOT;
if( $Action == 2 ){
	$replyid = $ReplyID;
	$announceid = $AnnounceID;
	print <<<EOT
			<!--{$rehiddeninput}--><!--post.php##回复帖隐含表单-->
	<input type="hidden" name="followup" value="{$replyid}" />
	<input type="hidden" name="rootid" value="{$announceid}" />
EOT;
}
if( $Action == 4 ){
	$announceid = $AnnounceID;
	$replyid = $ReplyID;
	print <<<EOT
			<!--{$edithiddeninput}--><!--post.php##编辑帖隐含表单-->
	<input type="hidden" name="replyid" value="{$replyid}" />
	<input type="hidden" name="id" value="{$announceid}" />
	<input type="hidden" name="announceid" value="{$announceid}" />
EOT;
}
print <<<EOT
<table class="mainbox tableborder" cellspacing="0" cellpadding="0">
	<tr >
		<th colspan="2">&nbsp;&nbsp;{$ActionName}

EOT;

if( $IsAudit == 1 ){
	print <<<EOT
	<!--{$auditinfo}-->
	{$lang['tpl.str6']}
EOT;
}
print <<<EOT
		</td>
	</tr>
	<tr style="display:none;">
		<td class="list_post1 list_post3"><b>{$lang['tpl.str7']}</b></td>
		<td class="list_post2"><input name="username" readonly alt="{$lang['tpl.str230']}" title="{$lang['tpl.str230']}" value="{$post_membername}" class="FormClass">&nbsp;&nbsp;<font color="{$alertcolor}"><b>*</b></font><a href="reg.php">{$lang['tpl.str8']}</a></td>
	</tr>
	<tr style="display:none;">
		<td class="list_post1 list_post3"><b>{$lang['tpl.str9']}</b></td>
		<td class="list_post2"><input name="passwd" readonly alt="{$lang['tpl.str230']}" title="{$lang['tpl.str230']}" type="password" value="{$memberword}" class="FormClass" /><font color="{$alertcolor}">&nbsp;&nbsp;<b>*</b></font><a href="lostpass.php">{$lang['tpl.str10']}</a>
EOT;
if( $Action == 2 ){
	print <<<EOT
	<!--{$reinfo1}--><!--post.php##合集部分-->
	&nbsp;&nbsp;<input type="checkbox" name="reishow" id="reishow" value=""  onclick="showtitle();" class="chkbox"/>
	{$lang['tpl.str11']}
EOT;
}
print <<<EOT
		</td>
	</tr>
EOT;
if( $board_settings[46] != 0 ){
	$getcodehtml=get_cercode(100,24,0,3);
	print <<<EOT
	<!--{$getcode}-->
	<tr>
		<td class="list_post1 list_post3"><b>{$lang['tpl.str12']}</b></td>
		<td class="list_post2"><div style="float:left;">{$getcodehtml}</div><div style="float:left;margin-top:6px;">{$lang['tpl.str250']}</div><div id="getcodeinfo" style="float:left;margin-top:11px;"></div>
		</td>
	</tr>
EOT;
}

if( $userid <= 0 ){
	$UserToday = 0;
} else{
	if( $userinfo['usertoday'] == '' ){
		$arrUserToday = array(0,0,0,0,0);
	} else{
		$arrUserToday = explode('|',$userinfo['usertoday']);
	}
	$UserToday = intval($arrUserToday[0]);//Dvbbs.UserToday(0)
}
$isargumentationpost = ($Action >= 5 AND $Action <= 8);

if ($Action != 5) {
	
	print <<<EOT
	<tr {$dispbody}>
		<td class="list_post1 list_post3"><b>{$lang['tpl.str13']}</b>
			<select name="font" onchange="DoTitle(this.options[this.selectedIndex].value)">
			<option selected="selected" value="">{$lang['tpl.str14']}</option>
EOT;
	if( is_array($tmpArr) ){
		foreach ($tmpArr AS $val) {
			print <<<EOT
			<!--{$topictype}-->
			<option value="{$val}">{$val}</option>
EOT;
		}
	}
	print <<<EOT
		</select>
	</td>
	<td class="list_post2">
	<input name="topic" id="topic" size="60"  value="{$topic}" {$styletitle}>
EOT;
	if( $groupsetting[51] == 1 ){
		print <<<EOT
	<a class="pointer"  style="position:absolute;margin:0 0 0 -25px!important;margin:1px 0 0 -28px;right:!important;right:;z-index:3px;"><input type="button" title="在发帖子使用彩色标题。" id="dvEditor_color"  /></a>
		<input id="topicximoo" name="topicximoo" value="{$TopicMode}" type="hidden" />
		<input id="topicfont" name="topicfont" value="{$TopicFont}" type="hidden" />

EOT;
	}


	if( $Action == 1 || $Action == 3 OR $Action == 5){
		if( $groupsetting[65] != 0 ){
			if( $boardinfo['board_setting'] !== '' ){
				print <<<EOT
	<!--{$topicmode}-->
	<select name=topicmode size=1>
		<option value=0 >{$lang['tpl.str16']}</option>
EOT;
				$BoardTopic = explode('$$',$boardinfo['board_setting']);
				if( is_array($BoardTopic) ){
					$count = count($BoardTopic);
					for( $i = 1 ; $i < $count ; $i++ ){
		print <<<EOT
		<option value="{$i}">{$BoardTopic[$i]}</option>
EOT;
					}
				}
		print <<<EOT
		</select><input type="hidden" id="selecttmode" value="{$groupsetting[65]}" />
EOT;
			}
		}
	}
	for($i=0;$i<count($_DCACHE['forum_postface'])-1;$i++){
		$Forum_PostFace .= $_DCACHE['forum_postface'][$i]. '|||';
	}
	for($i=0;$i<count($_DCACHE['forum_emot'])-1;$i++){
		$Forum_emot .= $_DCACHE['forum_emot'][$i]. '|||';
	}
	$Forum_emot = str_replace('|||','<><><>',$Forum_emot);
	$PostType = 1;
	$topiclimited = $board_settings[47];
	if ($topiclimited > 127) {
		$topiclimited = 127;
	}
	$lang['tpl.str17']=str_replace('{$topiclimited}', $topiclimited, $lang['tpl.str17']);
	print <<<EOT
			&nbsp;<font color="{$alertcolor}"><b>*</b></font>{$lang['tpl.str17']}<span id="titlestr"></span>
		</td>
	</tr>
EOT;
}

if($Action != 5 AND ($groupsetting[7] == 1 || $groupsetting[7] == 2) && $fsetting['isvipgroups'] != 999 ){
	$TempArray = explode('|',$board_settings[51]);
	$divtype='<div class="submenu" id="div_type" onmouseout="hidemenu(1);hidemenu(0);"><ul>';
	foreach( $TempArray as $val ){
		$uploadlist .= '<li><a href=#>'.$val.'</a></li>';
	}
	$divtype=$divtype.$uploadlist.'</ul></div>';
	global $fsetting;
	$uploadsettings = explode('|', $fsetting['uploadsetting']);
	if ($uploadsettings[2] != '0') {
		print <<<EOT
	<!--{$uploadinfo}-->
	<tr {$dispbody}>
	  <td class="tablebody5">
		<div id="t_menu1">
		<ul>
		<li class="m_li">{$lang['tpl.str55']}</li>
		<li class="m_li" onmouseover="showmenu('div_type',0);">{$lang['tpl.str57']}
		{$divtype}
		</li>
		</ul>	
		</div>
		</td>
	  <td class="tablebody5">
		<div style="padding :0;margin :0;float:left;height:20px;">
		<div class="ajaxaddpic" onclick="DvAjaxSend('dv_ajax.php?action={$Action}&setSign=PicTab&boardid={$boardid}','',this.id,'showAjaxPic');">
		{$lang['tpl.str.jh1']}
		</div> 
		<div class="ajaxaddEmot" onclick="DvAjaxSend('dv_ajax.php?action={$Action}&setSign=Emot&boardid={$boardid}','',this.id,'showAjaxPic');">
		{$lang['tpl.str.jh2']}
		</div>
		</div>
		<div style="padding :2px 0 0 0;margin :0;float:left;width:60%;height:20px;">
		   <iframe name="Annex" id="Annex" frameborder="0" width="100%" height="22"  scrolling="no" src="post_upload.php?boardid={$boardid}&t=4"></iframe>
		</div>		
		  </td>
		</tr>

EOT;
	}
}
if ($Action != 5) {
	print <<<EOT
		<tr {$dispbody}>
		<td width="20%" valign=top class="tablebody6">
			<table width="100%" cellpadding="0" cellspacing="0" >
			<tr>
				<td width="100%" valign=top > <b>{$lang['tpl.str58']}</b><BR>
				<div id="ShowTagCorps"></div>
				</td>
				</tr>
			<tr>
				<td width="100%" valign=top ><div id="ShowAjaxEmot"></div></td> 
			</tr>
			</table>
		</td>
		<td width="80%" class="tablebody5" valign="top">
		<!--{$getubb}--><!--post.php##Dvbbs多功能编辑器-->
		<link rel="STYLESHEET" type="text/css" href="images/post/edit.css">	
		<table id="Dvbbs_Container" class="Dvbbs_Body" height="300" width="100%" cellpadding="3" cellspacing="0" border="0">
			<tr>
				<td  >
					<table align=left cellpadding="0" cellspacing="0" border="0">
						<tr class="yToolbar" id="ExtToolbar0" >
							<td>
							<input type="button" id="dvEditor_PhFormat" value={$lang['tpl.str97']}>
							</td>
							<td>&nbsp;</td>
							<td>
							<input type="button" id="dvEditor_font" value={$lang['tpl.str102']}>
							</td>
							<td>&nbsp;</td>
							<td>
							<input type="button" id="dvEditor_fontNum" value={$lang['tpl.str111']}>
							</td>
							<td>&nbsp;</td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str119']}" language="javascript" onclick="FormatText('selectAll');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover=this.className='Dvbbs_BtnMouseOverUp'; onmouseout=this.className='Dvbbs_Btn' ><img  class="Dvbbs_Ico" src="images/post/selectAll.gif" width="16" height="16" unselectable="on" />
							</td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str120']}" language="javascript" onclick="FormatText('cut');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/cut.gif" width="16" height="16" unselectable="on" />
							</td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str121']}" language="javascript" onclick="FormatText('copy');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/copy.gif" width="16" height="16" unselectable="on" />
							</td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str122']}" language="javascript" onclick="FormatText('paste');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/paste.gif" width="16" height="16" unselectable="on" />
							</td>

							<td id="forecolor" name="forecolor" class="Dvbbs_Btn" title="{$lang['tpl.str112']}" language="javascript" onclick="Dvbbs_foreColor();this.className='Dvbbs_TabOn';" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)"><img  class="Dvbbs_Ico" src="images/post/fgcolor.gif" width="16" height="16" unselectable="on"  /></td>
							<td id="backcolor" class="Dvbbs_Btn" title="{$lang['tpl.str113']}" language="javascript" onclick="Dvbbs_backColor();this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)"><img  class="Dvbbs_Ico" src="images/post/fbcolor.gif" width="16" height="16" unselectable="on" /></td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str137']}" language="javascript" onclick="FormatText('bold', '');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/bold.gif" width="16" height="16" unselectable="on" />
							</td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str138']}" language="javascript" onclick="FormatText('italic', '');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/italic.gif" width="16" height="16" unselectable="on" />
							</td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str139']}" language="javascript" onclick="FormatText('underline', '');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/underline.gif" width="16" height="16" unselectable="on" />
							</td>

							<td><img  src="images/post/separator.gif"></td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str144']}" NAME="Justify" language="javascript" onclick="FormatText('justifyleft', '');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/aleft.gif" width="16" height="16" unselectable="on" />
							</td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str145']}" NAME="Justify" language="javascript" onclick="FormatText('justifycenter', '');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/center.gif" width="16" height="16" unselectable="on" />
							</td>
							<td class="Dvbbs_Btn" title="{$lang['tpl.str146']}" NAME="Justify" language="javascript" onclick="FormatText('justifyright', '');this.className='Dvbbs_TabOn';ondrag='return false;'" onmouseover="dvEditorOver(this)" onmouseout="dvEditorOut(this)" >
							<img  class="Dvbbs_Ico" src="images/post/aright.gif" width="16" height="16" unselectable="on" />
							</td>
							<td></td>
						</tr>
					</table>
					<div id="ExtToolbar1"></div>
					<div id="ExtToolbar2"></div>

					<table cellpadding="0" cellspacing="0"  >
						<tr class="yToolbar" id="old_Toolbars" style="display:none;">
							<td>
EOT;
	$PicUrl = 'images/';
	$TempArray = explode('|',"{$PicUrl}ubb/|bold.gif|italicize.gif|underline.gif|center.gif|url1.gif|email1.gif|image.gif|swf.gif|shockwave.gif|rm.gif|mp.gif|qt.gif|quote1.gif|fly.gif|move.gif|glow.gif|shadow.gif|ubb_smilie.gif|csound.gif");
	$count = count($TempArray);
	for( $i = 1 ; $i < $count ; $i++ ){
		${'ubb'.$i} = $TempArray[0].$TempArray[$i];
	}
	print <<<EOT
					<!--{$old_oldToolbars}-->
					<img onclick="Dv_ubb('B')" src="{$ubb1}" alt="{$lang['tpl.str155']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_ubb('I')" src="{$ubb2}" alt="{$lang['tpl.str156']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_ubb('U')" src="{$ubb3}" alt="{$lang['tpl.str157']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_ubb('center')" src="{$ubb4}" alt="{$lang['tpl.str158']}" border="0" style="cursor:pointer;"/>
					<img onclick="Curl()" src="{$ubb5}" alt="{$lang['tpl.str159']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_Signal('EMAIL')" src="{$ubb6}" alt="{$lang['tpl.str160']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_Signal('IMG')" src="{$ubb7}" alt="{$lang['tpl.str161']}" border="0" style="cursor:pointer;"/>
					<img onclick="Cswf()" src="{$ubb8}" alt="{$lang['tpl.str162']}" border="0" style="cursor:pointer;"/>
					<img onclick="Cdir()" src="{$ubb9}" alt="{$lang['tpl.str163']}" border="0" style="cursor:pointer;"/>
					<img onclick="Crm()" src="{$ubb10}" alt="{$lang['tpl.str164']}" border="0" style="cursor:pointer;"/>
					<img onclick="Cwmv()" src="{$ubb11}" alt="{$lang['tpl.str165']}" border="0" style="cursor:pointer;"/>
					<img onclick="Cmov()" src="{$ubb12}" alt="{$lang['tpl.str166']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_ubb('QUOTE')" src="{$ubb13}" alt="{$lang['tpl.str167']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_ubb('fly')" src="{$ubb14}" alt="{$lang['tpl.str168']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_ubb('move')" src="{$ubb15}" alt="{$lang['tpl.str169']}" border="0" style="cursor:pointer;"/>
					<img onclick="Cguang()" src="{$ubb16}" alt="{$lang['tpl.str170']}" border="0" style="cursor:pointer;"/>
					<img onclick="Cying()" src="{$ubb17}" alt="{$lang['tpl.str171']}" border="0" style="cursor:pointer;"/>
					<img onclick="Dv_Signal('SOUND')" src="{$ubb19}" alt="{$lang['tpl.str172']}" border="0" style="cursor:pointer;"/>
					<!--post.php##ubb部分End-->
				</td>
				</tr>
				</table>
				</td>
			   </tr>
				<tr>
					<td height="100%" id="PostiFrame" width="100%"><iframe class="Dvbbs_Composition" id="Dvbbs_Composition" marginheight="5" marginwidth="5" width="100%" height="100%"></iframe></td>
				</tr>
				<tr>
					<td>
						<table cellpadding="0" cellspscing="0" border="0" width="100%">
							<tr>
								<td width="10">&nbsp;</td>
								<td class="Dvbbs_TabOn" id="Dvbbs_TabDesign" onclick="if (Dvbbs_bTextMode!=1) {Dvbbs_setMode(1);}" unselectable="on" width="60" ><img alt="" unselectable="on" src="images/post/mode.design.gif" align="absmiddle" width="21" height="20">&nbsp;Design</td>
								<td style="width:10px"></td>
								<td class="Dvbbs_TabOff" id="Dvbbs_TabOldTools" onclick="if (Dvbbs_bTextMode!=3){Dvbbs_setMode(3);}" unselectable="on" width="80"><img alt="" unselectable="on" src="images/post/oldubb.gif" align="absmiddle"  height="20">&nbsp;{$lang['tpl.str173']}</td>
								<td style="width:10px"></td>
								<td class="Dvbbs_TabOff" id="Dvbbs_TabView" onclick="Dvbbs_View();" unselectable="on" width="60" ><img alt="" unselectable="on" src="images/post/mode.view.gif" align="absmiddle" width="20" height="20">&nbsp;VIEW</td>
								<td style="width:10px"></td>
								<!--{$htmltool}-->
								<!--post.php##Dvbbs多功能编辑器HTML工具按钮-->
								<td class="Dvbbs_TabOff" id="Dvbbs_TabHtml" onclick="if (Dvbbs_bTextMode!=2) {Dvbbs_setMode(2);}" unselectable="on" width="60" style="cursor: pointer;"><img unselectable="on" src="images/post/mode.html.gif" align="absmiddle" width="21" height="20">&nbsp;HTML</td>
								<td style="width:10px"></td>
								<td ><input type="checkbox" class="chkbox" name="autofix" id="autofix" value="1" checked="checked" />{$lang['tpl.str174']}</td>
								<td align='right'>
									<select id="Zoom" class="Dvbbs_TBGen" onchange="doZoom(this)" >
										<option value="100">100%</option>
										<option value="50">50%</option>
										<option value="75">75%</option>
										<option value="100">100%</option>
										<option value="125">125%</option>
										<option value="150">150%</option>
										<option value="175">175%</option>
										<option value="200">200%</option>
									</select>
									<a href="javascript:Dvbbs_Size(-300)"><img alt="" src="images/post/minus.gif" unselectable="on" border="0" /></a> <a href="javascript:Dvbbs_Size(300)"><img alt="" src="images/post/plus.gif" unselectable="on" border="0" /></a>
								</td>
								<td width='20'></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<script language = "javaScript" type="text/javascript">

			var Dvbbs_bIsIE5=document.all;
			var Dvbbs_bLoad=false;
			var Dvbbs_Mode = {$Dvbbs_Mode};

			if (Dvbbs_bIsIE5){
				var IframeID=frames["Dvbbs_Composition"];
			}
			else{
				var IframeID=document.getElementById("Dvbbs_Composition").contentWindow;
				var Dvbbs_bIsNC=true;
			}
			if (Dvbbs_bLoad==false)
			{
				Dvbbs_InitDocument("Body","GB2312");
			}
			</script>
			<div id="constr"></div>
		</td>
	</tr>

EOT;
}
if( $Action == 1 || $Action == 3){
	global $savvy_board;
	$lang['tpl.str233']=str_replace('10',$savvy_board['boardkey']['hiddenname'],$lang['tpl.str233']);
print <<<EOT
	<!--{$MoneyPostInfo}-->
	<tr>
		<td width="20%" class="tablebody6"><b>{$lang['tpl.str176']}</b></td>
		<td width="80%" class="tablebody5">
			{$lang['tpl.str181']}<input name="tomoney" type="text" size="10" value="10">&nbsp;{$lang['tpl.str237']}{$user_wealth} {$lang['tpl.str232']}<br><br>
			&nbsp;&nbsp;{$lang['tpl.str234']}<input type="checkbox" name="anonymity" value="1">&nbsp;{$lang['tpl.str233']}
		</td>
	</tr>
EOT;
} elseif ($Action == 2 AND $GetMoneyType == 2) {
	print <<<EOT
	<!--{$MoneyPostInfo}-->
	<tr>
		<td width="20%" class="tablebody6"><b>{$lang['tpl.str188']}</b></td>
		<td width="80%" class="tablebody5">
		<input type="radio" class="radio" name="getposttype" value="0" checked="checked" />{$lang['tpl.str189']}
		<input type="radio" class="radio" name="getposttype" value="1">{$lang['tpl.str190']}
		&nbsp;&nbsp;{$lang['tpl.str191']}<input name="tomoney" size="4" value="0" />
		</td>
	</tr>
EOT;
}
elseif ($Action == 11){
	global $savvy_board;
	$lang['tpl.str239']=str_replace('2',$savvy_board['boardkey']['prise_integral'],$lang['tpl.str239']);
	print <<<EOT
	<!--{$MoneyPostInfo}-->
	<tr>
		<td width="20%" style="height:40px;" class="tablebody6"><b>{$lang['tpl.str238']}</b></td>
		<td width="80%" class="tablebody5">
		&nbsp;&nbsp;{$lang['tpl.str238']}<input name="tomoney" size="4" value="5" />&nbsp;{$lang['tpl.str237']}{$user_wealth}&nbsp;&nbsp;{$lang['tpl.str239']}
		</td>
	</tr>
EOT;
}
elseif($Action==13){
	print <<<EOT
	<!--{$MoneyPostInfo}-->
	<tr>
		<td width="100%" colspan="2" class="tablebody5" style="text-align:center;height:90px;">
		&nbsp;&nbsp;{$lang['tpl.str241']}
		</td>
	</tr>
EOT;
}
elseif($Action == 14){
	print <<<EOT
	<!--{$MoneyPostInfo}-->
	<tr>
		<td width="20%" style="height:40px;" class="tablebody6"><b>{$lang['tpl.str244']}</b>						
		</td>
		<td width="80%" class="tablebody5"><textarea name="thanklang" rows="7" cols="79"></textarea>
		</td>
	</tr>
	<tr>
		<td width="20%" style="height:40px;" class="tablebody6"><b>{$lang['tpl.str246']}</b></td>
		<td width="80%" class="tablebody5">
		&nbsp;&nbsp;{$lang['tpl.str245']}<input name="supertomoney" size="4" value="5" />&nbsp;{$lang['tpl.str237']}{$user_wealth}
		</td>
	</tr>
EOT;
}
	print <<<EOT
		<tr>
			<td valign="middle" colspan="2" class="tablebody5" style="text-align : center; height:30px;">
		<button onMousemove="button_move(this)" onMouseout="button_out(this)" name="Submit1" type="submit"> {$dispbutton} </button>

EOT;
if (false === $isargumentationpost) {
	print <<<EOT
		&nbsp;
		<button onMousemove="button_move(this)" onMouseout="button_out(this)" name="button" type="button" onclick="gopreview()"> {$lang['tpl.str207']} </button>
EOT;
}
print <<<EOT
		&nbsp;
		<button onMousemove="button_move(this)" onMouseout="button_out(this)" name="Submit2" type="reset" onclick="ClearReset()"> {$lang['tpl.str208']} </button>
		</td>
		</tr>
</table>
</form>
EOT;


		if (false === $isargumentationpost) {
			print <<<EOT
		<form name="preview" action="preview.php?boardid={$boardid}" method="post" target="preview_page">
			<input type="hidden" name="upload_tmp_dir" value="">
			<input type="hidden" name="uploadrepl" value="">
			<input type="hidden" name="Dvtitle" value="" /><input type="hidden" name="theBody" value="" />
		</form>
EOT;
		}
print <<<EOT
	</div>
EOT;

if ($Action != 5) {
print <<<EOT
	<script language = "javascript" type="text/javascript" src="templates/lang/{$GLOBALS['fsetting']['lang']}/js/post/dhtmlEdit1.js"></script>
	<script language = "javascript" type="text/javascript" src="templates/lang/{$GLOBALS['fsetting']['lang']}/js/post/post.js"></script>
	<script src="templates/lang/{$GLOBALS['fsetting']['lang']}/js/post/dveditor.js" type="text/javascript" ></script>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
		var dvColorValue = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
		var dvColorName = ["HTML","{$lang['tpl.color1']}","{$lang['tpl.color2']}", "{$lang['tpl.color3']}", "{$lang['tpl.color4']}", "{$lang['tpl.color5']}", "{$lang['tpl.color6']}", "{$lang['tpl.color7']}", "{$lang['tpl.color8']}"];
		var dvFontValue = ["{$lang['tpl.str103']}", "{$lang['tpl.str104']}", "{$lang['tpl.str105']}_GB2312", "{$lang['tpl.str106']}_GB2312", "{$lang['tpl.str107']}","{$lang['tpl.str108']}","{$lang['tpl.str109']}","{$lang['tpl.str110']}","Arial","Arial Black", "Arial Narrow", "Bradley Hand ITC", "Brush Script	MT", "Century Gothic", "Comic Sans MS", "Courier", "Courier New", "MS Sans Serif", "Script", "System", "Times New Roman", "Viner Hand ITC", "Verdana", "Wide Latin", "Wingdings"];
		var dvFontName = ["{$lang['tpl.str103']}","{$lang['tpl.str104']}","{$lang['tpl.str105']}", "{$lang['tpl.str106']}", "{$lang['tpl.str107']}", "{$lang['tpl.str108']}", "{$lang['tpl.str109']}", "{$lang['tpl.str110']}","Arial","Arial Black","Arial Narrow","Bradley Hand ITC", "Brush Script	MT", "Century Gothic", "Comic Sans MS", "Courier", "Courier New", "MS Sans Serif", "Script", "System", "Times New Roman", "Viner Hand ITC", "Verdana", "Wide Latin", "Wingdings"];
		var dvFontNumValue = ["1", "2", "3", "4", "5", "6", "7"];
		var dvFontNumName = ["1", "2", "3", "4", "5", "6", "7"];
		var dvPhFormatValue = ["&lt;P&gt;", "&lt;H1&gt;", "&lt;H2&gt;", "&lt;H3&gt;", "&lt;H4&gt;", "&lt;H5&gt;", "&lt;H6&gt;", "&lt;H7&gt;", "&lt;PRE&gt;", "&lt;ADDRESS&gt;"];
		var dvPhFormatName = ["{$lang['tpl.str98']}", "{$lang['tpl.str99']} 1", "{$lang['tpl.str99']} 2", "{$lang['tpl.str99']} 3", "{$lang['tpl.str99']} 4", "{$lang['tpl.str99']} 5", "{$lang['tpl.str99']} 6", "{$lang['tpl.str99']} 7", "{$lang['tpl.str100']}", "{$lang['tpl.str101']}"];

		initMenuText();
	//-->
	</SCRIPT>

	{$debug}
EOT;
}
if( $Action == 2 ){
	if( !empty($_dbResults) && is_array($_dbResults) ){
		$width = $lang['Dvbbs.mainsetting0'];
		require_once INC_PATH.'dv_code.php';
		foreach( $_dbResults as $currResult ){
			if( $bgcolor === '' ){
				$bgcolor = 'tablebody2';
				$abgcolor = 'tablebody1';
			} else{
				$bgcolor = 'tablebody1';
				$abgcolor = 'tablebody2';
			}
			$tablebody = $bgcolor;
			$username = htmlspecialchars($currResult['username']);
			$dateandtime = gmdate("Y-m-d H:i:s",$currResult['dateandtime']+getUserTimeZoneOffset());
			if( $currResult['postuserid'] == 0 ){
				$lockuser = 0;
				$PostUserGroup = 7;
				$arrTmp = explode('.',$currResult['ip']);
				$postip = $arrTmp[0].'.'.$arrTmp[1].'.*.*';
			} else{
				$lockuser = $currResult['lockuser'];
				$PostUserGroup = $currResult['usergroupid'];
				$postip = '';
			}
			if( $lockuser == 2 || $currResult['locktopic'] == 2 ){
				$body = $lang['template.strings10'];
			} elseif( $lockuser == 1 ){
				$body = $lang['template.strings11'];
			} elseif( intval($currResult['isbest']) == 1 && $groupsetting[41] == 0 ){
				$body = $lang['template.strings12'];
			} else{
				if( strpos($currResult['ubbist'],',39,') !== false ){
					$body =& Dv_CodeProcess($currResult['body'],$currResult,$currResult['ubbist'],$PostUserGroup,1,0);
				} else{
					$body =& Dv_CodeProcess($currResult['body'],$currResult,$currResult['ubbist'],$PostUserGroup,1,1);
				}
			}
			$topic = htmlspecialchars($currResult['topic']);
			if(strpos($body,'img src="em')!==false){
				$body=str_replace('img src="em','img src="images/emot/em',$body);
			}
			print <<<EOT
	<!--{$retopicloop}--><!--post.php##回帖帖子循环部分-->
	<table border="0" cellpadding="3" cellspacing="1" class="tableborder1" align="center">
		<tr><th height="21" align="left">{$lang['tpl.str209']}{$dateandtime})</th></tr>
	</table>
	<table cellpadding="3" cellspacing="1" border="0" width="{$width}" class="tableborder2" align="center" style="table-layout:fixed;word-break:break-all;text-align:left;">
		<tr><td valign="middle" align="top" class="{$tablebody}">--&nbsp;&nbsp;{$lang['tpl.str210']}{$username}<br />--&nbsp;&nbsp;{$topic}<br />{$body}</td></tr>
	</table>
	<br />
EOT;
		}
	}
}
if( $Action == 1 || $Action == 3 OR $Action == 5){
	$scriptCode = 'ispostnew = 1;';
}
if ($Action != 5) {
	print <<<EOT
	<script type="text/javascript">
	Maxtitlelength = {$board_settings[47]};
	{$scriptCode}
	MaxConlength = {$board_settings[49]};
	</script>
EOT;
}
?>