<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
$jumplist = boardjumplist($boardid,$lang['tpl.str1']);
?>
<style type="text/css">
#planbarmain{
margin : 0 auto;
border-bottom: #6595d6 1px solid;
border-left: #6595d6 1px solid;
border-right: #6595d6 1px solid;
width : 98%;
height:30px;
line-height:30px;
}
#planbartext1{
float:left;
width : 50px;
margin-top:1px;
margin-left:0px;
margin-right:0px;
border-bottom: #000000 1px solid;
border-left:1px solid #E1E7FF;
background-color : #6595d6;
color : #fff; 
font-size : 12px; 
font-weight : bold;
height:28px;
line-height:28px;
}
.planbar{
float:left;
width : 502px;
border-top: #5E7FC1 1px solid;
border-bottom: #5E7FC1 1px solid;
border-left: #5E7FC1 1px solid;
border-right: #5E7FC1 1px solid;
height:12px;
line-height:12px;
text-align : left;
font-size : 0px;
margin-top:8px;
margin-left:4px; 
}
#planbar1{
margin-top:1px;
margin-left:1px;
background:#ffffff url("images/bar/bar3.gif") repeat-X;
height:10px;
line-height:10px;
width:0px;
float:left;
}
#planbartext3{
float:left;
margin-left:5px;
}
.bar {
line-height:24px;
border-bottom: #5E7FC1 1px solid;
border-left: #5E7FC1 1px solid;
border-right: #5E7FC1 1px solid;
margin : 0 auto;
width : 98%; 
min-width :560px;
background-color : #fff; 
}
</style>
<script type="text/javascript" language="javascript">
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
function planwidth(iwidth){
	if (iwidth>100){
	iwidth=100;
	}
	var obj = document.getElementById("planbartext3");
	obj.innerHTML=iwidth+'%';
	iwidth=iwidth * 5
	var obj = document.getElementById("planbar1");
	obj.style.width=iwidth+'px';
};
function plantext(text){
var obj = document.getElementById("planbartext2");
obj.innerHTML=text;
}
</script>
<?
switch($action){
	case 'view':
?>
				<div class="th" style="width:100%;text-align : center;"><?=$lang['tpl.str2']?></div>
				<div class="mainbox tableborder" style="text-align : center;line-height:28px;height : 28px;">
<?
					if ($ps['parentid'] == 0){
						if ($master !== false){
							echo "<a href=\"?action=delpic&amp;id={$ps['rootid']}\">{$lang['tpl.str3']}</a> |";
						}
						echo " <a href=\"?action=manage&amp;id={$ps['rootid']}_\">{$lang['tpl.str4']}</a> ";
					}
					elseif ($boardid != 444){
						echo "<a href=\"dispbbs.php?boardid={$ps['locktopic']}&amp;id={$ps['rootid']}\" target=\"_blank\" >{$lang['tpl.str5']}</a> | ";
						if ($master !== false){
							echo "<a href=\"?action=delpic&amp;id={$ps['rootid']}&amp;replyid={$ps['announceid']}\">{$lang['tpl.str6']}</a> | ";
						}
						echo "<a href=\"?action=manage&amp;id={$ps['rootid']}_{$ps['announceid']}\">{$lang['tpl.str7']}</a> | <a href=\"?action=manage&amp;id={$ps['rootid']}_\">{$lang['tpl.str4']}</a>";
					}
					else{
						echo "<a href=\"?action=view&amp;id={$ps['rootid']}\" target=\"_blank\" >{$lang['tpl.str9']}</a> | ";
						if ($master !== false){
							echo "<a href=\"?action=delpic&amp;id={$ps['rootid']}\">{$lang['tpl.str3']}</a> | <a href=\"?action=delpic&amp;id={$ps['rootid']}&amp;replyid={$ps['announceid']}\">{$lang['tpl.str6']}</a> | ";
						}
						echo "<a href=\"?action=manage&amp;id={$ps['rootid']}_\">{$lang['tpl.str11']}</a> ";
					}
?>
					| <a href="javascript:window.close()"> <?=$lang['tpl.str12']?> </a> 
				</div>
				<div class="mainbox tableborder">
					<fieldset style="border : 1px dotted #ccc;text-align : left;line-height:22px;text-align : left;padding:10px;margin:10px;">
						<legend> <b><?=htmlspecialchars($ps['topic'])?></b></legend>
						<div style="text-align : center;">
							<?=$lang['tpl.str13']?><a href="dispuser.php?id=<?=$ps['postuserid']?>" target="_blank" ><?=htmlspecialchars($ps['username'])?></a> <?=$lang['tpl.str14']?><?=(is_numeric($ps['dateandtime']) ? gmdate('Y-m-d H:i:s', $ps['dateandtime']+getUserTimeZoneOffset()): $ps['dateandtime'])?>  <?=$lang['tpl.str15']?>
<?
							if ($ps['parentid'] == 0){
								echo $lang['tpl.str16'];
							}else{
								echo $lang['tpl.str17'];
							}
?>
						</div>
						<div><?=htmlspecialchars($ps['body'])?></div>
					</fieldset>
				</div>
<?
		break;
	case 'alldel':
?>
				<div class="mainbox">
				<fieldset style="border : 1px dotted #ccc;text-align : left;line-height:22px;">
				<legend> <b><?=$lang['tpl.str18']?></b> </legend>
				<?=$lang['tpl.str19']?>
				</fieldset>
				</div>
				<form action="recycle.php?action=alldel" method="post">
				<div class="mainbox"><?=$lang['tpl.str20']?></div>
				<div class="mainbar3" style="text-align : left;line-height:22px;height:22px;text-indent:10px;">
				<?=$lang['tpl.str21']?> <input type="text" name="maxcount" value="<?=$maxcount?>" size="5"/> <?=$lang['tpl.str22']?> <button name="dv_submit" id="dv_submit" type="submit" onMousemove="button_move(this)" onMouseout="button_out(this)"><?=$lang['tpl.str23']?></button>
				</div>
				</form>
				<div id="planbarmain">
				<div id="planbartext1" align=center><?=$lang['tpl.str24']?></div>
				<div class="planbar"><div id="planbar1"></div>
				</div><div id="planbartext3">0%</div>
				</div>
				<div class="bar" style="text-align : left;text-indent:24px; height:22px;line-height:22px;" id="planbartext2"></div>
<?
		break;
		if ($isdo == 1){
			flush();
?>
			<script language="javascript" type="text/javascript">document.getElementById('dv_submit').disabled=true;document.getElementById('dv_submit').value='<?=$lang['tpl.str25']?>';plantext('<?=$lang['tpl.str26']?>');</script>
<?
			flush();
		}
	default:
?>			
			<table cellspacing="0" cellpadding="0" border="0" class="mainbox tableborder">
				<form action="recycle.php" method="post">
				<tr>
					<th><?=$lang['tpl.str27']?></th>
				</tr>
				<tr>
					<td>
						<?=$lang['tpl.str28']?>
						<select name="bid" id="bid">
							<?=$jumplist?>
						</select>
						<?=$lang['tpl.str29']?>
						<select name="tableid" id="tableid">
							<option value="0" <?if($tableid == 0){echo 'selected';}?>><?=$lang['tpl.str30']?></option>
							<?
							while ($tb = $db->fetch_array($tbquery)){
								echo "<option value=\"{$tb['id']}\"";
								echo ">{$tb['tabletype']}</option>";
							}
							?>
						</select>
						<?=$lang['tpl.str31']?><input type="text" name="keyword" value="<?=$keyword?>" />&nbsp;&nbsp;
						<button onMousemove="button_move(this)" onMouseout="button_out(this)"  type="submit" name="Submit"><?=$lang['tpl.str50']?></button>
					</td>
				</tr>
				<tr>
					<td>
						<fieldset style="border : 1px dotted #ccc;text-align : left;line-height:15px;">
							<legend> <b><?=$lang['tpl.str32']?></b> </legend>
							<?=$lang['tpl.str33']?>
						</fieldset>
					</td>
				</tr>
				<tr>
					<td>
						<fieldset style="border : 1px dotted #ccc;text-align : left;line-height:22px;">
							<legend> <b><?=$lang['tpl.str34']?></b> </legend>
							<div style="text-indent:24px;">
								<?
								if ($topiccount == 0){
									echo $lang['tpl.str35'];
								}else{
									echo "{$lang['tpl.str36']} <b><font color=\"red\">{$topiccount}</font></b>  {$lang['tpl.str37']}";
								}
								?>
							</div>
						</fieldset>
					</td>
				</tr>
				</form>
			</table>
			<table cellspacing="0" cellpadding="0" border="0" class="mainbox tableborder">
				<form name="recycle" action="recycle.php?action=manage" method="post">
				<tr>
					<th><?=$lang['tpl.str38']?></th>
					<th><?=$lang['tpl.str39']?></th>
					<th><?=$lang['tpl.str40']?></th>
					<th><?=$lang['tpl.str41']?></th>
					<th><?=$lang['tpl.str42']?></th>
					<th><?=$lang['tpl.str43']?></th>
					<th><?=$lang['tpl.str44']?></th>
					<th><?=$lang['tpl.str45']?></th>
				</tr>
			<?
			while($ts = $db->fetch_array($tsquery)){
			?>
				<tr>
					<td align="center" height="25">
						<input type="checkbox" class="chkbox" name="id[]" value="<?=$ts['id']?>_<?=$ts['replyid']?>" />
					</td>
					<td>
						<?
							if ($tableid == 0){
								echo $lang['tpl.str16'];
							}elseif($ts['parentid'] == 0){
								echo $lang['tpl.str16'];
							}else{
								echo $lang['tpl.str17'];
							}
						?>
					</td>
					<td>
						<a href="?action=view&amp;id=<?=$ts['id']?>&amp;replyid=<?=$ts['replyid']?>" target="_blank">
							<?
								require_once INC_PATH.'DV_Encoding.class.php';
								$objEnc = DV_Encoding::GetEncoding($GLOBALS['charset']);
									if ($ts['topic'] != ''){
										echo htmlspecialchars($objEnc->SubString($ts['topic'],0,30));
									}else{
										echo htmlspecialchars($objEnc->SubString($ts['body'],0,30));
									}
								$ts['dateandtime'] = gmdate("Y-m-d H:i:s",$ts['dateandtime']+getUserTimeZoneOffset());
							?>
						</a>
					</td>
					<td><?=$ts['dateandtime']?></td>
					<td><a href="dispuser.php?id=<?=$ts['userid']?>" target="_blank" ><?=$ts['username']?></a></td>
					<td>
						<?
							if ($tableid == 0){
								echo $ts['posttable'];
							}else{
								echo $posttable;
							}
						?>
					</td>
					<td>
						<?
							if ($tableid == 0){
								echo $lang['tpl.str44'];
							}elseif($ts['parentid'] == 0){
								echo $lang['tpl.str44'];
							}else{
								echo $lang['tpl.str46'];
							}
						?>
					</td>
					<td><?=$_DCACHE['all_forums'][$ts['bid']]['boardtype']?></td>
				</tr>
			<?
			}
			?>
			  <tr>
				<td style="height:30px;padding-left:10px;" colspan="8">
					<input type="checkbox" class="chkbox" name="chkall" value="on" onclick="CheckAll(this.form);" style="margin:4px;"/>
					<?=$lang['tpl.str47']?>
					<input onMousemove="button_move(this)" onMouseout="button_out(this)" onclick="{if(confirm('<?=$lang['tpl.str49']?>')){return true;}return false;}" type="submit" name="doaction" value="<?=$lang['tpl.str48']?>">&nbsp;&nbsp;

					<input onMousemove="button_move(this)" onMouseout="button_out(this)" onclick="{if(confirm('<?=$lang['tpl.str53']?>')){return true;}return false;}" type="submit" name="doaction" value="<?=$lang['tpl.str54']?>">
				</td>
			  </tr>
			</form>
			</table>
			<table  border="0" cellspacing="0" cellpadding="0" class="mainbox">
			  <tr>
				<td style="height:30px;">
					<?		
						if($topiccount!=0){
							page_search($lang['tpl.str51'],$lang['tpl.str52'],'tableid',$tableid,'keyword',$keyword,'','','','','','');
						}
					?>
				</td>
			  </tr>
			</table>
<?
	break;
}
?>