<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	printFooter();
	exit;
}
?>
<script language="JavaScript">
var n = 0;
function displayHTML(obj) {
	win = window.open(" ", 'popup', 'toolbar = no, status = no, scrollbars=yes');
	win.document.write("" + obj.value + "");
}
function HighlightAll(obj) {
	obj.focus();
	obj.select();
	if (document.all) {
		obj.createTextRange().execCommand("Copy");
		window.status = "<?=$lang['tpl.info1']?>";
		setTimeout("window.status=''", 1800);
	}
}
function findInPage(obj, str) {
	var txt, i, found;
	if (str == "") {
		return false;
	}
	if (document.layers) {
		if (!obj.find(str)) {
			while(obj.find(str, false, true)) {
				n++;
			}
		} else {
			n++;
		}
		if (n == 0) {
			alert("<?=$lang['tpl.info2']?>");
		}
	}
	if (document.all) {
		txt = obj.createTextRange();
		for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
			txt.moveStart('character', 1);
			txt.moveEnd('textedit');
		}
		if (found) {
			txt.moveStart('character', -1);
			txt.findText(str);
			txt.select();
			txt.scrollIntoView();
			n++;
		} else {
			if (n > 0) {
				n = 0;
				findInPage(str);
			} else {
				alert("<?=$lang['tpl.info2']?>");
			}
		}
	}
	return false;
}
</script>
<?
switch($action){
	case 'edit':
?>
	<table border="0" cellspacing="0" cellpadding="0" align="center" class="indextableborder1">
<form method="post" action="?action=save">
	<input type="hidden" value="<?=$tplid?>" name="tplid">
<?if(intval($tplinfo['stype']) == 1){?>
		<input type="hidden" value="1" name="stype">
		<input type="hidden" value="<?=$tpl[0]?>.lang.php" name="tplname">
		<tr>
			<td class="tdtit" colspan="2"><?=$lang['tpl.info89']?> <?=$lang['edit']?> <B><?=$tplinfo['name']?></B> <?=$lang['tpl.info3']?> <?=$lang['tpl.info90']?> <?=$_TPL['language'][$tplinfo['ename']][$tpl[0]]?>(<?=$tplinfo['directory'].$tpl[0]?>.lang.php)
			</td>
		</tr>
		<tr>
			<td width="100%" class="forumrow1" height=25 colspan=2 style="padding-left:10px;">
			<?=$lang['tpl.info4']?><BR><?=$lang['tpl.info5']?>
			</td>
		</tr>
<?}elseif(intval($tplinfo['stype']) == 2){?>
		<input type="hidden" value="4" name="stype">
		<tr>
			<td class="tdtit" colspan="2"><?=$lang['tpl.info89']?> <?=$lang['edit']?> <B><?=$tplinfo['name']?></B> <?=$lang['tpl.info6']?> <?=$lang['tpl.info90']?> <?=$_TPL['templates'][$tplinfo['ename']][$tpl[0]]?>(<?=$tplinfo['directory'].$tpl[0]?>.css)
			</td>
		</tr>
		<tr>
			<td width="100%" class="forumrow1" height=25 colspan=2 style="padding-left:10px;">
			<?=$lang['tpl.info7']?><BR>
			<?=$lang['tpl.info8']?> <?=$mytpl['name']?><span class=sfont>(<?=$mytpl['directory']?>)</span>
			</td>
		</tr>
<?php
} else {
		if (1 == intval($tplinfo['tpl_type']) AND 0 == intval($tplinfo['stype'])) {
			$_fn = $tplinfo['directory'].$tplinfo['ename'].'.'.$tpl[0].'.tpl.php';
		} else {
			$_fn = $tplinfo['directory'].$tplinfo['ename'].'/'.$tpl[0].'.tpl.php';
		}
?>
		<input type="hidden" value="2" name="stype">
		<input type="hidden" value="<?=$tpl[0]?>.tpl.php" name="tplname">
		<tr>
			<td class="tdtit" colspan="2"><?=$lang['tpl.info89']?> <?=$lang['edit']?><?=$tplinfo['name']?> <?=$lang['tpl.info90']?> <?=$_TPL['templates'][$tplinfo['ename']][$tpl[0]]?>(<?=$_fn?>)
			</td>
		</tr>
<?}?>
<?if(intval($tplinfo['stype']) != 2){?>
		<tr>
			<td width="100%" class="forumrow" height="25" colspan="2">
			<input type="text" size=35 name="tpl_description" style="margin-left:10px;" value="<?=$tplinfo['content'][$tpl[0]]?>">
			&nbsp;&nbsp;<?=$lang['tpl.info9']?>
			</td>
		</tr>
		<tr>
			<td width="100%" class="forumrow" height=25 colspan=2>
			<textarea name="content" style="width:90%;margin-top:5px;margin-bottom:5px;margin-left:10px;" rows="20" cols="20" id="content"><?=$content?></textarea>
			</td>
		</tr>
		<tr>
			<td width="100%" class="forumrow1" height=25 colspan=2 style="text-indent:5px;text-align:center;">
			<?=$lang['tpl.info10']?>
			<a href="javascript:admin_Size(-3,'content')"><img src="images/minus.gif" unselectable="on" border='0' alt="<?=$lang['tpl.info11']?>"></a> <a href="javascript:admin_Size(3,'content')"><img src="images/plus.gif" unselectable="on" border='0' alt="<?=$lang['tpl.info12']?>"></a>
			</td>
		</tr>
		<tr>
			<td width="100%" class="forumrow" height=25 colspan=2 style="text-indent:5px;text-align:center;">
			<input name="search" type="text" size="20" onChange="n=0;">
			<input type="button" class="button" value="<?=$lang['find']?>" onClick="findInPage(this.form.content, this.form.search.value)">
			<input type="button" class="button" value="<?=$lang['copy']?>" onClick="HighlightAll(this.form.content)">&nbsp;&nbsp;&nbsp;
			<input type="submit" name="submit" class="button" value="<?=$lang['save']?><?if($tplinfo['stype'] == 0){echo $lang['tpl.info13'];}else{echo $lang['tpl.info3'];}?>">
			<input type="button" class="button" value="<?=$lang['preview']?>" onClick="displayHTML(this.form.content)">
			<input type="button" class="button" value="<?=$lang['back']?>" onClick="history.go(-1)">
			</td>
		</tr>
<?} else {
	$cs =& $tplinfo['content']['.php'];
?>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>1. <?=$lang['tpl.info14']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[0]?>">
			<?=$lang['tpl.info15']?>
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>2. <?=$lang['tpl.info16']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[1]?>">
			<?=$lang['tpl.info17']?>
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>3. <?=$lang['tpl.info18']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[2]?>">
			<?=$lang['tpl.info17']?>
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>4. <?=$lang['tpl.info20']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[3]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>5. <?=$lang['tpl.info21']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[4]?>">
			<?=$lang['tpl.info22']?>
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>6. <?=$lang['tpl.info23']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[5]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>7. <?=$lang['tpl.info24']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[6]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>8. <?=$lang['tpl.info24']?></B><?=$lang['tpl.info26']?>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[7]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>9. <?=$lang['tpl.info27']?></B><?=$lang['tpl.info28']?>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[8]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>10. <?=$lang['tpl.info29']?></B><?=$lang['tpl.info30']?>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[9]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>11. <?=$lang['tpl.info31']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[10]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>12. <?=$lang['tpl.info32']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[11]?>">
			<?=$lang['tpl.info17']?>
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>13. <?=$lang['tpl.info34']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[12]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>14. <?=$lang['tpl.info35']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[13]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>15. <?=$lang['tpl.info35']?></B><?=$lang['tpl.info26']?>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[14]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>16. <?=$lang['tpl.info25']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[15]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>17. <?=$lang['tpl.info36']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[16]?>">
			<?=$lang['tpl.info37']?>
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>18. <?=$lang['tpl.info38']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[17]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>19. <?=$lang['tpl.info39']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[18]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>20. <?=$lang['tpl.info40']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[19]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>21. <?=$lang['tpl.info41']?></B><?=$lang['tpl.info42']?>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[20]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>22. <?=$lang['tpl.info43']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[21]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>23. <?=$lang['tpl.info44']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[22]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>24. <?=$lang['tpl.info45']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[23]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>25. <?=$lang['tpl.info46']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[24]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>26. <?=$lang['tpl.info47']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[25]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>27. <?=$lang['tpl.info48']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[26]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>28. <?=$lang['tpl.info49']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[27]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>29. <?=$lang['tpl.info50']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[28]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>30. <?=$lang['tpl.info51']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[29]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>31. <?=$lang['tpl.info52']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[30]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>32. <?=$lang['tpl.info53']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[31]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>33. <?=$lang['tpl.info54']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[32]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>34. <?=$lang['tpl.info55']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[33]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>35. <?=$lang['tpl.info56']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[34]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>36. <?=$lang['tpl.info57']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[35]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>37. <?=$lang['tpl.info58']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=25 name="csssetting[]" value="<?=$cs[36]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>38. <?=$lang['tpl.info59']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[37]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>39. <?=$lang['tpl.info60']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[38]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>40. <?=$lang['tpl.info61']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[39]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>41. <?=$lang['tpl.info62']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[40]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>42. <?=$lang['tpl.info63']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[41]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;">
			<B>43. <?=$lang['tpl.info64']?></B>
			</td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="text" size=10 name="csssetting[]" value="<?=$cs[42]?>">
			</td>
		</tr>
		<tr>
			<td width="35%" class="forumrow" height=25 style="text-indent:5px;"></td>
			<td width="65%" class="forumrow" height=25 style="text-indent:5px;">
			<input type="submit" class="button" name="submit" value="<?=$lang['tpl.info65']?>">
			<input type="button" class="button" value="<?=$lang['back']?>" onClick="history.go(-1)">
			</td>
		</tr>
<?}?>
</form>
	</table>
<?
		break;
	default:
?>
<table border="0" cellspacing="0" cellpadding="0" align=center class="indextableborder1">
	<tr>
		<td class="tdtit" colspan=2><?=$lang['tpl.info89']?> <?=$lang['tpl.info66']?></td>
	</tr>
	<form method="post" action="?">
	<tr>
		<td width="100%" class="forumrow" height=25 colspan=2 style="text-indent:5px;">&nbsp;
			<select size=1 name="forum_sid" onchange="if(this.options[this.selectedIndex].value!='')location='template.php?forum_sid='+this.options[this.selectedIndex].value;">
				<option value=0><?=$lang['tpl.info19']?></option>
			<?
				if (is_array($_TPL['templates'])) {
					foreach( $_TPL['templates'] AS $styleid => $rs ){
						echo "<option value=\"{$styleid}\" ".($forum_sid == $styleid ? ' selected' : '').">".htmlspecialchars($rs['name'])."</option>";
					}
				}
			?>
			</select>
	&nbsp;&nbsp;&nbsp;&nbsp;
			<select Size=1 Name="forum_cid" onchange="if(this.options[this.selectedIndex].value!='')location='template.php?forum_cid='+this.options[this.selectedIndex].value;">
				<option value=0><?=$lang['tpl.info67']?></option>
			<?
				if (is_array($_TPL['stylecss'])) {
					foreach( $_TPL['stylecss'] AS $styleid => $rs ){
						echo "<option value=\"{$styleid}\" ".($forum_cid == $styleid ? ' selected' : '').">".htmlspecialchars($rs['name'])."</option>";
					}
				}
			?>
			</select>
	&nbsp;&nbsp;&nbsp;&nbsp;
			<Select Size=1 Name="forum_lang" onchange="if(this.options[this.selectedIndex].value!='')location='template.php?forum_lang='+this.options[this.selectedIndex].value;">
			<option value=0><?=$lang['tpl.info68']?></option>
			<?
				if (is_array($_TPL['language'])) {
					foreach( $_TPL['language'] AS $styleid => $rs ){
						echo "<option value=\"{$styleid}\" ".($forum_lang == $styleid ? ' selected' : '').">".htmlspecialchars($rs['name'])."</option>";
					}
				}
			?>
			</Select>
		</td>
	</tr>
	</form>
	<tr>
		<td width="100%" class="forumrow1" height=25 colspan=2 style="text-indent:5px;">
		<?=$lang['tpl.info69']?>
		</td>
	</tr>
<?
if( !empty($_TPL) ){
?>
	<tr>
		<td width="100%" class="tit1" height=25 colspan=2 style="text-indent:5px;"><?=$lang['tpl.info89']?> <?=$tpllist['name']?>(<?=$tplname?>) <?if($forum_lang != ''){echo $lang['tpl.info3'];}?><?=$lang['tpl.info70']?>&nbsp;&nbsp;&nbsp;&nbsp;
		</td>
	</tr>
<?
	if( intval($tplinfo['stype']) == 2 ){
?>
	<form method="post" action="?action=save">
		<input type="hidden" value="<?=$tplinfo['styleid']?>" name="tplid">
		<input type="hidden" value="3" name="stype">
	<tr>
		<td width="100%" class="forumrow1" height=25 style="text-indent:5px;" colspan=2>
		<a href="?action=edit&tpl=<?=$tplname?>&tplid=<?=$tplinfo['styleid']?>"><?=$lang['tpl.info71']?></a>
		</td>
	</tr>
	<tr>
		<td width="100%" class="forumrow" height=25 style="text-indent:5px;" colspan=2>
			&nbsp;<?=$lang['tpl.info72']?><select size=1 name="parentid">
		<?
				if (is_array($_TPL['templates'])) {
					foreach( $_TPL['templates'] AS $styleid => $rs ){
						echo "<option value=\"{$styleid}\" ".($tplinfo['parentid'] == $styleid ? ' selected="selected"' : '').">".htmlspecialchars($rs['name'])."</option>";
					}
				}
		?>
			</select>
		</td>
	</tr>
	<tr>
		<td width="100%" class="forumrow" height=25 colspan=2>
		<textarea name="content" style="width:90%;margin-top:5px;margin-bottom:5px;margin-left:10px;" rows="20" cols="20" id="content"><?=$tplinfo['content']['.css']?></textarea>
		</td>
	</tr>
	<tr>
		<td width="100%" class="forumrow1" height=25 colspan=2 style="text-indent:5px;text-align:center;">
		<?=$lang['tpl.info10']?>
		<a href="javascript:admin_Size(-3,'content')"><img src="images/minus.gif" unselectable="on" border='0' alt="<?=$lang['tpl.info11']?>"></a> <a href="javascript:admin_Size(3,'content')"><img src="images/plus.gif" unselectable="on" border='0' alt="<?=$lang['tpl.info12']?>"></a>
		</td>
	</tr>
	<tr>
		<td width="100%" class="forumrow" height=25 colspan=2 style="text-indent:5px;text-align:center;">
			<input name="search" type="text" size="20" onChange="n=0;">
			<input type="button" class="button" value="<?=$lang['find']?>" onClick="findInPage(this.form.content, this.form.search.value)">
			<input type="button" class="button" value="<?=$lang['copy']?>" onClick="HighlightAll(this.form.content)">&nbsp;&nbsp;&nbsp;
			<input type="submit" class="button" name="submit" value="<?=$lang['tpl.info73']?>">
		</td>
	</tr>
	</form>
<?
	} else {
?>
	<tr>
		<td width="100%" class="forumrow1" height=25 style="text-indent:5px;" colspan=2>
		<?php
		if (1 == intval($tplinfo['tpl_type']) AND 0 == intval($tplinfo['stype'])) {
			print $lang['tpl.info74_1'];
		} else {
			print $lang['tpl.info74'];
		}?>
		</td>
	</tr>
	<form action="?action=edittplpage" method="post">
	<input type="hidden" name="styleid" value="<?=$tpllist['styleid']?>">
	<input type="hidden" name="sub_action" value="addnew">
	<tr>
		<td width="100%" class="forumrow" height=25 style="text-indent:5px;" colspan=2>
		<?=$lang['tpl.info79']?>&nbsp;&nbsp;<input type=text size=15 name="tplpage_name" value="">&nbsp;&nbsp;<?=$lang['tpl.info80']?><input type=text size=15 name="tplpage_ename" value="">
		<input type="button" class="button" value="<?=$lang['tpl.info75']?>" name="mostyle" onclick="this.form.sub_action.value='addnew';this.form.submit();">
		</td>
	</tr>
	</form>
<?
		$i = 0;
		if (!empty($tpllist['content'])) {
			foreach( $tpllist['content'] as $key=>$val ){
				$i++;
				if($forum_lang != ''){$tplstr = 'lang';}else{$tplstr = 'tpl';}
?>
	<tr onmouseover="this.style.backgroundColor='#B3CFEE';this.style.color='red'" onmouseout="this.style.backgroundColor='';this.style.color=''">
		<td width="50%" class="forumrow" height=25 style="text-indent:5px;"><?=$i?>. <?=$val?><span class=sfont>(<?=$key?>.<?=$tplstr?>.php)</span>
		</td>
		<td width="50%" class="forumrow" height=25 style="text-indent:5px;"><a href="?action=edit&tpl=<?=$key?>.<?=$tplstr?>.php&tplid=<?=$tplinfo['styleid']?>"><?=$lang['edit']?></a>&nbsp;&nbsp;
		<a href="?action=edittplpage&amp;sub_action=delete&amp;styleid=<?=$tplinfo['styleid']?>&amp;tplpage_ename=<?=$key?>">	<?=$lang['del']?></a>
		</td>
	</tr>
<?
			}
		}
	}
?>
	<form action="?action=save_base_info" method="post">
		<input type="hidden" name="styleid" value="<?=$tpllist['styleid']?>" />
		<input type="hidden" name="sub_action" value="" />
	<tr>
		<td width="100%" class="tit1" height=25 colspan=2 style="text-indent:5px;"><?=$lang['tpl.info89']?> <?=$tpllist['name']?>(<?=$tplname?>) <?=$lang['tpl.info76']?>
		</td>
	</tr>
	<tr>
		<td width="100%" class="forumrow1" height=25 style="text-indent:5px;" colspan=2>
		<?if(intval($tplinfo['stype']) == 2){echo $lang['tpl.info77'];}elseif(1 == intval($tplinfo['tpl_type'])){echo $lang['tpl.info78_1'];}else{echo $lang['tpl.info78'];}?>
		<a name="new"></a>
		</td>
	</tr>
	<?php
	if (1 == intval($tplinfo['tpl_type']) AND 0 == intval($tplinfo['stype'])) {
	?>
	<tr>
		<td width="50%" class="forumrow" height=25 style="padding-left:10px;">
		<input type="hidden" name="tpl_type" value="<?=$tplinfo['tpl_type']?>" />
		<?=$lang['tpl.info79']?>
		<input type=text size="30" name="edit_name" value="<?=$tpllist['name']?>"><BR>
		<?=$lang['tpl.info80']?>
		<input type=text size="30" name="edit_ename" value="<?=$tplinfo['ename']?>"><BR>
		<?=$lang['tpl.info81']?>
		<?=$tplinfo['charset']?><BR>
		<?=$lang['tpl.info82']?>
		<?=$tplinfo['copyright']?><BR>
		<?=$lang['tpl.info83'].$tplinfo['directory']?>
		</td>
		<td width="50%" class="forumrow" height=25 style="padding-left:10px;">
		<input type="hidden" name="tpl_type" value="<?=$tplinfo['tpl_type']?>" />
		<?=$lang['tpl.info79']?>
		<input type=text size="30" name="add_name" value=""><BR>
		<?=$lang['tpl.info80']?>
		<input type=text size="30" name="add_ename" value=""><BR>
		<?=$lang['tpl.info81']?>
		<input type=text size="30" name="add_charset" value="<?=$tplinfo['charset']?>"><BR>
		<?=$lang['tpl.info82']?>
		<input type=text size="30" name="add_copyright" value=""><BR>
		<?=$lang['tpl.info83']?>
		<input type=text size="30" name="add_directory" value="<?=$tplinfo['directory']?>">
		</td>
	</tr>
	<?php
	} else {
	?>
	<tr>
		<td width="50%" class="forumrow" height=25 style="padding-left:10px;">
		<input type="hidden" name="tpl_type" value="<?=$tplinfo['tpl_type']?>" />
		<?=$lang['tpl.info79']?>
		<input type=text size="30" name="edit_name" value="<?=$tpllist['name']?>"><BR>
		<?=$lang['tpl.info80']?>
		<input type=text size="30" name="edit_ename" value="<?=$tplinfo['ename']?>"><BR>
		<?=$lang['tpl.info81']?>
		<?=$tplinfo['charset']?><BR>
		<?=$lang['tpl.info82']?>
		<?=$tplinfo['copyright']?><BR>
		<?=$lang['tpl.info83']?>
		<?=$tplinfo['directory'].(2 != intval($tplinfo['stype']) ? $tplinfo['ename'].'/' : '')?>
		</td>
		<td width="50%" class="forumrow" height=25 style="padding-left:10px;">
		<?=$lang['tpl.info79']?>
		<input type=text size="30" name="add_name" value=""><BR>
		<?=$lang['tpl.info80']?>
		<input type=text size="30" name="add_ename" value=""><BR>
		<?=$lang['tpl.info81']?>
		<input type=text size="30" name="add_charset" value="<?=$tplinfo['charset']?>"><BR>
		<?=$lang['tpl.info82']?>
		<input type=text size="30" name="add_copyright" value=""><BR>
		<?=$lang['tpl.info83']?>
		<input type=text size="30" name="add_directory" value="<?=$tplinfo['directory']?>">
		</td>
	</tr>
	<?php
	}
	?>
	<tr>
		<td width="50%" class="forumrow" height=25 style="padding-left:10px;">
		<input type="button" class="button" value="<?=$lang['tpl.info84']?>" name="mostyle" onclick="this.form.sub_action.value='modify';this.form.submit();">&nbsp;&nbsp;<input type="button" class="button" value="<?=$lang['tpl.info85']?>" name="mostyle" onclick="this.form.sub_action.value='delete';this.form.submit();">
		</td>
		<td width="50%" class="forumrow" height=25 style="padding-left:10px;">
		<input type="button"  class="button" value="<?=$lang['tpl.info86']?><?if(intval($tplinfo['stype']) == 0){echo $lang['tpl.info87'];}elseif($tplinfo['stype'] == 1){echo $lang['tpl.info3'];}elseif($tplinfo['stype'] == 2){echo $lang['tpl.info88'];}?>" name="mostyle" class="button" onclick="this.form.sub_action.value='addnew';this.form.submit();">
		</td>
	</tr>
	</form>
<?
}
?>
</table>
<?
	break;
}
?>