www.gusucode.com > Tatter Tools 0.961 SE GB2312 简体中文版 > upload/admin/keyword_edit.php

    <?
	include("../inc_global.php");
	include("../inc_function.php");
	check_authority();

	if ($mode == "issue") {

		$image_file_path1 = date("md", time())."/";
		$image_file_path2 = get_timestamp2()."/";

		put_query("
			insert into t3_".$dbid."_keyword (
				sortno, keyword, body, image_file_path1, image_file_path2, regdate
			) values (
				'".(get_maxval("t3_".$dbid."_keyword", sortno, "")+1)."', '输入关键词', '输入解释', '$image_file_path1', '$image_file_path2', '".time()."'
			)
		");

		$sql = "select no from t3_".$dbid."_keyword where image_file_path2 = '$image_file_path2'";
		list ($no) = mysql_fetch_array(mysql_query($sql));

		header("Location: keyword_edit.php?num=$no&page=$page&idx=$idx");
		exit;
	}

	if ($mode == "update") {
		if ($finishflag == "2") $add_query = ",regdate = '".time()."'";
		put_query("update t3_".$dbid."_keyword set keyword = '$keyword', body = '".trim($body)."' $add_query where no = '$num'");

		if ($old_keyword != $keyword) {

			$tsortno = get_minval("t3_".$dbid."_keyword", "sortno", "where no != $num and keyword like '%$keyword%'");

			if ($tsortno) {
				put_query("update t3_".$dbid."_keyword set sortno = sortno + 1 where sortno >= $tsortno");
				put_query("update t3_".$dbid."_keyword set sortno = $tsortno where no = $num");
			} else {
				$tsortno2 = get_maxval("t3_".$dbid."_keyword", "sortno", "where no != $num");
				put_query("update t3_".$dbid."_keyword set sortno = $tsortno2 + 1 where no = $num");
			}

			write_local_keyword_cache();
		}

		if ($is_sync) set_keyword_sync($num, 1, 1);

		if ($finishflag) header("Location: keyword.php?page=$page&idx=$idx");
		else header("Location: keyword_edit.php?num=$num&page=$page&idx=$idx");
		exit;
	}

	$sql = "select sortno, keyword, body, image_file_path1, image_file_path2, regdate, is_public, is_sync from t3_".$dbid."_keyword where no = '$num'";
	list ($sortno, $keyword, $body, $image_file_path1, $image_file_path2, $regdate, $is_public, $is_sync) = mysql_fetch_array(mysql_query($sql));

	admin_header("");
?>

<script type="text/javascript">

	function onclick_update(form, flag) {
		trim_all(form);
		if (isNull(form.keyword, '请输入关键词')) return false;
		if (isNull(form.body, '请输入关键词解释')) return false;
		form.target='_self';
		form.action = '<?=$PHP_SELF?>';
		form.finishflag.value = flag;
		form.mode.value = 'update';
		form.uploadfile.disabled = true;
		form.submit();
	}

	function onclick_attach(form) {
		if (form.uploadfile.value == "") {
			alert("请选择要上传的文件\t");
			return false;
		} else {
			form.target='exe_iframe';
			form.action = 'com_mfile.php';
			form.mode.value = 'attach';
			form.submit();
		}
	}

	function onclick_delete(form) {
		var buffer = deleteList(form.filelist);
		if (trim(buffer) != '') {
			form.target='exe_iframe';
			form.action = 'com_mfile.php';
			form.mode.value = 'delete';
			form.deletefile.value = buffer;
			form.uploadfile.disabled = true;
			form.submit();
			form.uploadfile.disabled = false;
		}
	}

</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<meta name="keywords" content="TT,TatterTools,Skin,php">
<meta name="description" content="Meyu,梦游,华人中文网">
<meta name="generator" content="TatterTools中文BLOG">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta http-equiv="MSThemeCompatible" content="Yes">
</head>
<form method="post" enctype="multipart/form-data" name="keyword_edit" action="<?=$PHP_SELF?>">
<input type="hidden" name="temp">
<input type="hidden" name="is_sync" value="<?=$is_sync?>">
<input type="hidden" name="num" value="<?=$num?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="idx" value="<?=$idx?>">
<input type="hidden" name="mode">
<input type="hidden" name="deletefile">
<input type="hidden" name="filetable" value="<?="t3_".$dbid."_keyword_files"?>">
<input type="hidden" name="formname" value="keyword_edit">
<input type="hidden" name="image_file_path1" value="<?=$image_file_path1?>">
<input type="hidden" name="image_file_path2" value="<?=$image_file_path2?>">
<input type="hidden" name="finishflag">
<input type="hidden" name="old_keyword" value="<?=$keyword?>">
<input type="hidden" name="old_sortno" value="<?=$sortno?>">

	<table cellpadding="0" cellspacing="0" width="1003"><tr>
	<td width="430" valign="top" style="padding:10 5 5 5">

		<table width="100%" style="margin-bottom:3"><tr>
		<td width="24" align="right"><img src="../images/num_08.gif" height="17" alt=""></td>
		<td width="9"><img src="../images/ver_01.gif" width="9" height="17" alt=""></td>
		<td><img src="../images/cap_08.gif" height="17" alt=""></td>
		</tr></table>

	<? print_content_line(); ?>

		<table class="content_back1" cellpadding="0" cellspacing="0" width="100%"><tr>
		<td style="padding-top:10">

			<table><tr>
			<td width="60" align="right">关键词 ::&nbsp;</td>
			<td><input type="text" class="text" maxlength="80" name="keyword" value="<?=$keyword?>" style="width:343"><br></td>
			</tr></table>
  	<?
        // 作  者:Sea Otter
        // 代码说明:表情相关
        // 变动类型:添加
        // 修改时间:2005.05.07
        // 原 代 码:无
        // seaotter@163.com
        // 变更开始-------------------
    	?>
			<div id="emoticon_panel" style="display:block;">
        <? input_block(); ?>
        <div id="emoticon_panel" style="width:390px;margin:4px 0 4px 19px">
				<?
			    $temp_html = str_replace("[##_ins_emoticon_target_##]", "obj", $emoticon->e_str_html);
			    print $temp_html; 
				?>
        </div>
  			<? input_block(); ?>
			</div>
      <?
        // 变更结束------
        ?>
		<textarea name="body" onselect="save_pos(this)" onclick="save_pos(this)" onkeyup="save_pos(this)" rows="20" style="width:393; margin:5 0 0 18;"><?=trim($body)?></textarea><br>
        
		<script type="text/javascript"> var obj = document.keyword_edit.body; </script>

		<? set_palette(); ?>

		<input type="file" size="34" class="button" name="uploadfile" style="margin-left:18; margin-top:10; width:295px;">
		<input type="button" class="button" value="上传文件" onclick="onclick_attach(keyword_edit);" style="width:95"><br>

			<table cellpadding="0" cellspacing="0" style="margin-top:4"><tr>
			<td style="padding:0 5 0 18" valign="top"><img id="s_image" width="85" height="85" style="border-style:solid; border-width:1; border-color:#404040"></td>
			<td><select size="6" name="filelist" multiple style="width:203;" onchange="set_preview_image(this, document.getElementById('s_image'), '<?=$image_file_path1?>', '<?=$image_file_path2?>')"></select></td>
			<td style="padding-left:4">
			<input type="button" class="button" onclick="onclick_delete(document.keyword_edit)" value="删除此文件" style="width:95; margin-bottom:5"><br>

				<table cellspacing="0" cellpadding="1"><tr>
				<td><img class="ib" src="../images/attach_1l.gif" onclick="to_article_1l(keyword_edit.filelist, keyword_edit.body);" style="width:29; height:27" alt=""></td>
				<td><img class="ib" src="../images/attach_1c.gif" onclick="to_article_1c(keyword_edit.filelist, keyword_edit.body);" style="width:29; height:27" alt=""></td>
				<td><img class="ib" src="../images/attach_1r.gif" onclick="to_article_1r(keyword_edit.filelist, keyword_edit.body);" style="width:29; height:27" alt=""></td>
				</tr><tr>
				<td><img class="ib" src="../images/attach_2c.gif" onclick="to_article_2c(keyword_edit.filelist, keyword_edit.body);" style="width:29; height:27" alt=""></td>
				<td><img class="ib" src="../images/attach_3c.gif" onclick="to_article_3c(keyword_edit.filelist, keyword_edit.body);" style="width:29; height:27" alt=""></td>
				<td><img class="ib" src="../images/attach_f.gif" onclick="to_article_free(keyword_edit.filelist, keyword_edit.body, '<?=$s_root_path."attach/".$image_file_path1?>', '<?=$image_file_path2?>');" style="width:29; height:27" alt=""></td>
				</tr></table>

			</td>
			</tr></table>

		<div align="center" style="margin:10">
		<img class="ib" src="../images/b_list.gif" width="53" height="17" onclick="if (confirm('确定要放弃编辑回到关键词列表首页?\t')) window.location.href='keyword.php?page=<?=$page?>'" alt="">
		<img class="ib" src="../images/b_reflect.gif" width="68" height="17" onclick="onclick_update(keyword_edit, 0)" alt="">
		<img class="ib" src="../images/b_finish.gif" width="53" height="17" onclick="if (confirm('您确定要发表此关键字页吗?')) onclick_update(keyword_edit, 2); else onclick_update(keyword_edit, 1);" alt="">
		</div>

		</td>
		</tr></table>

	</td>
	<td width="23"></td>
	<td width="*" valign="top" style="padding-top:20">

		<table width="100%" style="margin-bottom:3"><tr>
		<td width="24" align="right"><img src="../images/num_09.gif" height="17" alt=""></td>
		<td width="9"><img src="../images/ver_01.gif" width="9" height="17" alt=""></td>
		<td><img src="../images/cap_09.gif" height="17" alt=""></td>
		</tr></table>

	<? print_content_line(); ?>

		<table class="content_back1" cellpadding="0" cellspacing="10" width="100%"><tr>
		<td bgcolor="#FFFFFF" align="right" style="padding:10">
		<?
			$sql = "select sortno, keyword, body, image_file_path1, image_file_path2, regdate, is_public from t3_".$dbid."_keyword where no = '$num'";
			list ($sortno, $keyword, $body, $image_file_path1, $image_file_path2, $regdate, $is_public) = mysql_fetch_array(mysql_query($sql));
		?>

			<table cellpadding="0" cellspacing="0" width="510" bgcolor="#FFFFFF"><tr>
			<td>
			<font size="3"><b><?=$keyword?></b></font>
				<table><tr><td></td></tr></table>
			<?=set_moreless(nl2brc(set_keyword(attach_image(1, $body, $s_root_path, $r_root_path, $attach_path.$image_file_path1.$image_file_path2),0)), $num)?>
			</td>
			</tr></table>

		</td>
		</tr></table>

	</td>
	</tr></table>

</form>

<script type="text/javascript">
<?
	$sql = " select no, filename, attachname, filesize, width, height from t3_".$dbid."_keyword_files where pno = $num order by no asc";
	$result = mysql_query($sql);
	while(list($no, $filename, $attachname, $filesize, $width, $height) = @mysql_fetch_array($result)) {
		$type = analyze_file($filename);

		switch ($type) {
			case "1":
				$tmp1_buf = "($width"."x"."$height / ".get_filesize($filesize).")";
				$tmp2_buf = "width=\"$width\" height=\"$height\"";
				break;

			case "2":
				$tmp1_buf = "(flash: ".get_filesize($filesize).")";
				$tmp2_buf = "width=\"320\" height=\"240\"";
				break;

			case "3":
			case "4":
				$tmp1_buf = "(multimedia: ".get_filesize($filesize).")";
				$tmp2_buf = "";
				break;

			case "0":
				$tmp1_buf = "(attached: ".get_filesize($filesize).")";
				$tmp2_buf = "";
				break;
		}

		?>
		var temp1 = '<?=$filename?> <?=$tmp1_buf?>';
		var temp2 = '<?=$filename?>|<?=$tmp2_buf?>|<?=$attachname?>|<?=$no?>';
		addList(document.keyword_edit.filelist,temp1,temp2);
		<?
	}
?>
	var obj2 = document.keyword_edit.filelist;
	if (obj2.length) {
		obj2.selectedIndex = 0;
		set_preview_image(obj2, document.getElementById('s_image'), '<?=$image_file_path1?>', '<?=$image_file_path2?>');
	} else set_preview_no_image(document.getElementById('s_image'));

</script>

<iframe name="exe_iframe" style="width:0; height:0;" frameborder="0" scrolling="no"></iframe>

<? admin_footer("") ?>