<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
if($action=="view"){
?>
<br>
<table border="0" cellspacing="1" cellpadding="1"  align="center" class="tableborder">
  <?
		if(!empty($info_list)){
			if(is_array($info_list)){
				foreach($info_list as $info_val){
  ?>
  <tr>
    <td class="tit1"><? echo $lang['list.info4']?></td>
  </tr>
  <tr>
    <td style="text-align:center;" class="forumrow" height="50"><b><? echo $info_val['h_title']?></b></td>
  </tr>
  <tr>
    <td class="forumrow"><blockquote><? echo $info_val['h_content']?></blockquote></td>
  </tr>
  <tr>
    <td class="forumrow" style="text-align:right;padding-right:8PX;"><? echo "<a href=forum_help.php?action=edit&id=".$info_val['h_id'].">".$lang['list.info2']."</a>&nbsp;&nbsp;<a href=forum_help.php?action=del&id=".$info_val['h_id'].">".$lang['list.info3']."</a>"?></td>
  </tr>
  <?
				}
			}
		}
  ?>
</table>
<?
}
  elseif($action=="edit"){
 ?>
 <br>
<table border="0" cellspacing="1" cellpadding="1"  align="center" class="tableborder">
 <form name="editform" method="post" action="?action=editok&id=<? echo $id;?>">
  <?
		if(!empty($info_list)){
			if(is_array($info_list)){
				foreach($info_list as $info_val){
  ?>
  <tr>
    <td class="tit1"  height="35"><? echo $lang['edit.info1']?></td>
  </tr>
  <tr>
    <td class="forumrow" height="35"><? echo $lang['template.add5']?>
      <input name="title" type="text" value="<?=$info_val['h_title']?>" id="title" size="40">&nbsp;&nbsp;
      <select name="title_type" id="title_type">
		  <option value="0" <? if ($info_val['h_type']=='0') echo "selected"?>><?=$lang['edit.info4']?></option>
		  <option value="1" <? if ($info_val['h_type']=="1") echo "selected"?>><?=$lang['edit.info5']?></option>
	  </select>
</td>
  </tr>
  <tr>
    <td class="forumrow" height="35"><? echo $lang['template.add6']?>
	<select name="sort" id="sort">
    <? 
		$result=$db->query("select h_id,h_parentid,h_title,h_content,h_type,h_stype,h_bgimg,h_addtime from {$dv}help where h_parentid=0");
		while ($op_arr=$db->fetch_array($result)){
			
			echo "<option value=".$op_arr['h_id'];
				if($info_val['h_parentid']==$op_arr['h_id'])
					echo " selected";
			echo ">".$op_arr['h_title'];
				if (intval($op_arr['h_type'])==1)					
					echo "[".$lang['edit.info5']."]";//echo " [后台]";
				else 					
					echo "[".$lang['edit.info4']."]";//echo " [前台]" ;
			echo "</option>";
		}
	?>
	<option value="0"><?=$lang['edit.info8']?></option>
	</select>
	</td>
  </tr>
  <tr>
    <td class="forumrow" height="35"><? echo $lang['template.add7']?><input name="type" type="checkbox" id="type" value="1" <? if($info_val['h_stype']=='0') echo "checked"?>><? echo $lang['edit.info2']?></td>
  </tr>
  <tr>
    <td class="forumrow" height="35"><? echo $lang['template.add10']?><input name="bgurl" value="<?=$info_val['h_bgimg']?>"type="text" id="bgurl" size="40"></td>
  </tr>
  <tr>
    <td class="forumrow"><? echo $lang['template.add9']?><textarea name="body" cols="100" rows="10" id="body"><? echo $info_val['h_content']?></textarea></td>
  </tr>
  <tr>
    <td class="forumrow1" height="35" style="text-align:center;" ><input type="submit" class="button" name="Submit" value="<?=$lang['edit.info9']?>"></td>
  </tr>
 </form>
   <?
				}
			}
		}
  ?>

</table>
<?  
  }
 else{
?>
<br>
<table border="0" cellspacing="1" cellpadding="1"  align="center" class="tableborder">
  <form name="search_form" method="post" action="?action=search">
  <tr>
    <td class="tit1"><? echo $lang['template.info1']?></td>
  </tr>
  <tr>
    <td align="left" height="30" class="forumrow"><? echo $lang['template.info3']?><input name="keyword" type="text" id="keyword"  size="50">
      &nbsp;<input type="submit" class="button" name="Submit" value=" <?=$lang['edit.info10']?> "></td>
  </tr>
  <tr>
    <td height="30" align="left" class="forumrow"><? echo $lang['template.info4']?>&nbsp;</td>
  </tr>
</form>
</table>
<table border="0" cellspacing="0" cellpadding="0"  align="center" class="tableborder">
<tr align="center">
<td height="25" align="center" width="15%" <?if($linkaction=='bodylist' or $linkaction==''){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?linkaction=bodylist"><font color="<?if($linkaction=='bodylist' or $linkaction==''){echo 'red';}else{echo '#000000';}?>"><?=$lang['edit.info14']?></font></a></td>
<td height="25" align="center" width="15%" <?if($linkaction=='add'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?> width="10%"><a href="?linkaction=add"><font color="<?if($linkaction=='add'){echo 'red';}else{echo '#000000';}?>"><?=$lang['edit.info15']?></font></a></td>
<td width="10%" align="center" width="15%" <?if($linkaction=='oper_2'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>></font><a href="../boardhelp.php?boardid=0" target="_blank"><font color="<?if($linkaction=='oper_2'){echo 'red';}else{echo '#000000';}?>"><?=$lang['template.info2']?></font></a></td>
<td width="15%" bgcolor="#F1F3F5"> </td>
<td width="15%" bgcolor="#F1F3F5"> </td>
<td width="15%" bgcolor="#F1F3F5"> </td>
</tr>
</table>
<?if($linkaction=='bodylist' or $linkaction==''){//帮助内容显示部分;?>
<table border="0" cellspacing="0" cellpadding="0"  align="center" class="tableborder">
  <tr>
    <td colspan="2" class="tdtit"><? echo $lang['template.info6']?></td>
  </tr>
  <?
		if(!empty($info_list)){
			if(is_array($info_list)){
				foreach($info_list as $info_val){
  ?>
  <tr>
  <td width="80%" align="left" class="forumrow"><? if($info_val['h_fileurl']!=''){ echo "&nbsp;<b><a href=".$info_val['h_fileurl'].">".$info_val['h_title']."</a></b>";}else{ echo "&nbsp;<b>".$info_val['h_title']."</b>";}?></td>
    <td height="20" width="20%" style="text-align:right;padding-right:8PX;" class="forumrow"><? echo "<a href=forum_help.php?action=view&id=".$info_val['h_id'].">".$lang['list.info1']."</a>&nbsp;&nbsp;<a href=forum_help.php?action=edit&id=".$info_val['h_id'].">".$lang['list.info2']."</a>&nbsp;&nbsp;<a href=forum_help.php?action=del&id=".$info_val['h_id'].">".$lang['list.info3']."</a>"?></td>
  </tr>
  <tr><td colspan="2" align="left" class="forumrow"><? echo $info_val['h_content']?></td></tr>

  <?
	$offset++;
				}
			}
		}
  ?>
  <tr>
    <td colspan="2" class="forumrow1">
	<? if($total>0)	
	  page_search($lang['edit.info11'],$lang['edit.info12'],'','','','','keyword',$keyword,'','','action',$_GET['action']);
	?></td>
  </tr>
</table>
<?}elseif($linkaction=='add'){?>
<table border="0" cellspacing="0" cellpadding="0"  align="center" class="tableborder">
 <form name="addform" method="post" action="?action=add">
  <tr>
    <td class="tdtit" colspan="2"><? echo $lang['template.add1']?></td>
  </tr>
  <tr>
    <td class="forumrow" colspan="2" align="left"><? echo $lang['template.add2'].$lang['template.add3'].$lang['template.add4']?></td>
  </tr>
  <tr class="forumrow">
    <td align="left" height="30" colspan="2"><? echo $lang['template.add5']?><input type="text" size="40" name="title"></td>
  </tr>
  <tr class="forumrow">
    <td align="left" height="30" colspan="2"><? echo $lang['template.add6']?>
	<select name="sort">
	<? 
		$result=$db->query("select h_id,h_parentid,h_title,h_content,h_type,h_stype,h_bgimg,h_addtime from {$dv}help where h_type=0 and h_parentid=0");
		while ($op_arr=$db->fetch_array($result)){
			
			echo "<option value='".$op_arr['h_id']."'>".$op_arr['h_title']."</option>";
		}
	?>
	<option value="0"><?=$lang['edit.info8']?></option>
    </select>
  </td>
  </tr>
  <tr class="forumrow">
    <td align="left" height="30" colspan="2"><? echo $lang['template.add7']?><input type="checkbox" name="type" value="1" checked><?echo $lang['template.add8']?></td>
  </tr>
  <tr class="forumrow">
	<td width="5%" height="30"  valign="right"><? echo $lang['template.add9']?></td>
    <td align="left" width="94%"><textarea name="body" cols="100" rows="10" class="tdtext" id="TDcontent"></textarea><a href="javascript:admin_Size(-8,'TDcontent')"><img src="images/minus.gif" unselectable="on" border='0'></a> <a href="javascript:admin_Size(8,'TDcontent')"><img src="images/plus.gif" unselectable="on" border='0'></a></td>
  </tr>
  <tr class="forumrow1">
	<td width="5%" height="30"></td>
    <td height="30" align="center"><input type="submit" class="button" name="Submit" value="  <?=$lang['edit.info13']?>  "></td>
  </tr>
  </form>
</table>
<?
		}
 }
 ?>