<?php
//if(!defined('ISDVBBS')) exit('Access denied.Sorry, you can not access this file directly.');
if( !defined('ISDVBBS') ){
	//header('HTTP/1.0 401 Unauthorized');
	header('HTTP/1.0 400 Bad Request');
	exit;
}
?><!--<?php print <<<EOT
-->
<!--
EOT;
if ($action == 'showone'){
print <<<EOT
-->
<BR>
<p align=center><a href="?boardid={$boardid}" target="_bank">{$lang['tpl.str1']}</a></p>
<!--
EOT;
}
switch($action){
case 'addann':
$jumplist = boardjumplist($boardid,$lang['tpl.str4']);
if ($boardmaster == true){
	$readme = $lang['tpl.str5'];
}
print <<<EOT
-->
<form action="?action=saveann" method="post">
  <table class="mainbox tableborder" cellSpacing="0" cellPadding="0" align="center">
      <tr>
        <th vAlign="center" colSpan="2">{$lang['tpl.str6']}</th>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="center"><b>{$lang['tpl.str7']} *</b></td>
        <td class="tablebody1" vAlign="center"><input disabled value="{$GLOBALS['membername']}" name="username" size="20"> 
          <input type="hidden" value="{$GLOBALS['membername']}" name="username"></td>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="center"><b>{$lang['tpl.str8']} *</b></td>
        <td class="tablebody1" vAlign="center">
		<SELECT id="boardid" NAME="boardid">
		{$jumplist}
		</SELECT>
{$readme}</td>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="center"><b>{$lang['tpl.str9']}</b></td>
        <td class="tablebody1" vAlign="center"><input size="60" name="bgs">{$lang['tpl.str10']}</td>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="center"><b>{$lang['tpl.str11']} *</b></td>
        <td class="tablebody1" vAlign="center"><input size="60" name="title"></td>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="top" width="30%"><b>{$lang['tpl.str12']} *</b></td>
        <td class="tablebody1" vAlign="center"><textarea class="smallarea" name="content" rows="8" wrap="VIRTUAL" cols="60"></textarea></td>
      </tr>
      <tr>
        <td class="tablebody2" vAlign="center" align="middle" colSpan="2"><input type="submit" class="button" value="{$lang['tpl.str13']}" name="submit"></td>
      </tr>
  </table>
</form>
<!--
EOT;
break;
case 'editann':
$i = 0;
print <<<EOT
-->
<script 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;  
    }  
  }  
</script>
<form action="?action=delann&boardid={$boardid}" method="post">
  <table class="mainbox tableborder" cellSpacing="0" cellPadding="0" align="center">
      <tr>
        <th width="5%">ID</th>
        <th width="55%">{$lang['tpl.str14']}</th>
        <th width="15%">{$lang['tpl.str15']}</th>
        <th width="20%">{$lang['tpl.str16']}</th>
        <th width="5%" height="21">{$lang['tpl.str17']}</th>
      </tr>
<!--
EOT;
while($anns = $db->fetch_array($query)){
$i++;
is_numeric($anns['addtime']) AND ($anns['addtime'] = gmdate('Y-m-d H:i:s', $anns['addtime']+getUserTimeZoneOffset()));
print <<<EOT
-->
      <tr>
        <td class="tablebody2" align="middle" height="25">{$anns['id']}</td>
        <td class="tablebody1" align=left><a href="?action=editanninfo&amp;boardid={$anns['boardid']}&amp;id={$anns['id']}">{$anns['title']}</a></td>
        <td class="tablebody2" align="middle"><a href="dispuser.php?name={$anns['username']}">{$anns['username']}</a></td>
        <td class="tablebody1" align="middle">{$anns['addtime']}</td>
        <td class="tablebody2" align="middle"><input type="checkbox" class="chkbox" value="{$anns['id']}" name="id"></td>
      </tr>
<!--
EOT;
}
if ($i == 0){
print <<<EOT
-->
<tr><td colspan="5" class="tablebody1" align="middle">{$lang['tpl.str18']}</td></tr>
<!--
EOT;
}
print <<<EOT
-->
      <tr>
        <td class="tablebody2" align="right" colSpan="5">{$lang['tpl.str19']}<input onclick="CheckAll(this.form)" type="checkbox" class="chkbox" value="on" name="chkall">{$lang['tpl.str20']}
          <input onclick="{if(confirm('{$lang['tpl.str21']}')){return true;}return false;}" type="submit" class="button" value="{$lang['tpl.str22']}" name="Submit"></td>
      </tr>
  </table>
</form>
<!--
EOT;
break;
case 'editanninfo':
$jumplist = boardjumplist($boardid,$lang['tpl.str23']);
if ($boardmaster == true){
	$readme = $lang['tpl.str24'];
}
$anns['title'] = htmlspecialchars($anns['title']);
$anns['bgs'] = htmlspecialchars($anns['bgs']);
$anns['content'] = htmlspecialchars($anns['content']);
print <<<EOT
-->
<form action="?action=saveedit&id={$showid}" method="post">
  <table class="mainbox tableborder" cellSpacing="0" cellPadding="0" align="center">
      <tr>
        <th vAlign="center" colSpan="2">{$lang['tpl.str25']}</th>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="center"><b>{$lang['tpl.str26']}</b></td>
        <td class="tablebody1" vAlign="center"><input disabled value="{$anns['username']}" name="username" size="20"> 
          <input type="hidden" value="{$anns['username']}" name="username"></td>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="center"><b>{$lang['tpl.str27']}</b></td>
        <td class="tablebody1" vAlign="center"><SELECT id="boardid" NAME="boardid">{$jumplist}</SELECT>
{$readme}</td>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="center"><b>{$lang['tpl.str28']}</b></td>
        <td class="tablebody1" vAlign="center"><input size="60" name="bgs" value="{$anns['bgs']}">{$lang['tpl.str29']}</td>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="center"><b>{$lang['tpl.str30']}</b></td>
        <td class="tablebody1" vAlign="center"><input size="60" name="title" value="{$anns['title']}"></td>
      </tr>
      <tr align=left>
        <td class="tablebody1" vAlign="top" width="30%"><b>{$lang['tpl.str31']}</b></td>
        <td class="tablebody1" vAlign="center"><textarea class="smallarea" name="content" rows="8" wrap="VIRTUAL" cols="60">{$anns['content']}</textarea></td>
      </tr>
      <tr>
        <td class="tablebody2" vAlign="center" align="middle" colSpan="2"><input type="submit" class="button" value="{$lang['tpl.str32']}" name="submit"></td>
      </tr>
  </table>
</form>
<!--
EOT;
break;
default:
$i = 0;
while($anns = $db->fetch_array($query)){
$i++;
if ($anns['bgs'] == '' || is_null($anns['bgs'])){
	$strbgs = 'No';
}else{
	if ($action == 'showone'){
		$strbgs = '<img src=images/filetype/mid.gif border=0><bgsound src=$anns[bgs] border=0>';
	}else{
		$strbgs = 'Yes';
	}
}
$anns['content'] = Dv_CodeProcess($anns['content'],$userinfo,'',2,1);
is_numeric($anns['addtime']) AND ($anns['addtime'] = gmdate('Y-m-d H:i:s', $anns['addtime']+getUserTimeZoneOffset()));
print <<<EOT
-->
<table class="mainbox tableborder" cellSpacing="0" cellPadding="0" align="center">
    <tr>
      <th vAlign="top" align="middle">&gt;&gt; {$anns['title']} &lt;&lt;
    </tr>
    <tr>
      <td class="tablebody1" style="LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word" vAlign="top" align=left><br>
        <blockquote>
{$anns['content']}
        </blockquote>
      </td>
    </tr>
    <tr>
      <td class="tablebody2" vAlign="center">
        <table cellSpacing="0" cellPadding="0" width="100%" border="0">
            <tr>
              <td class="tablebody2" align="left">&nbsp;&nbsp;&nbsp;<b>{$lang['tpl.str33']}</b> 
                {$anns['username']}&nbsp;|&nbsp;<b>{$lang['tpl.str34']}</b>{$strbgs}</td>
              <td class="tablebody2" align="right"><b>{$lang['tpl.str35']}</b> 
                {$anns['addtime']}&nbsp;&nbsp;&nbsp;</td>
            </tr>
        </table>
      </td>
    </tr>
</table>
<!--
EOT;
}
if ($i == 0){
$nowdate = gmdate('Y-m-d H:i:s', time()+getUserTimeZoneOffset());
print <<<EOT
-->
<table class="mainbox tableborder" cellSpacing="0" cellPadding="0" align="center">
    <tr>
      <th vAlign="top" align="middle">&gt;&gt; {$lang['tpl.str36']} &lt;&lt;
    </tr>
    <tr>
      <td class="tablebody1" style="LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word" vAlign="top" align=left><br>
        <blockquote>
{$lang['tpl.str37']}
        </blockquote>
      </td>
    </tr>
    <tr>
      <td class="tablebody2" vAlign="center">
        <table cellSpacing="0" cellPadding="0" width="100%" border="0">
            <tr>
              <td class="tablebody2" align="left">&nbsp;&nbsp;&nbsp;<b>{$lang['tpl.str33']}</b> 
                {$lang['tpl.str38']}&nbsp;|&nbsp;<b>{$lang['tpl.str34']}</b>No</td>
              <td class="tablebody2" align="right"><b>{$lang['tpl.str35']}</b> 
                {$nowdate}&nbsp;&nbsp;&nbsp;</td>
            </tr>
        </table>
      </td>
    </tr>
</table>
<!--
EOT;
}
break;
}
print <<<EOT
-->
<!--
EOT;
?>-->