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

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

	if ($mode == "set_public") {
		list($num, $is_public, $is_sync) = split("_", $exenum);
		if ($is_public) $mode = 0; else $mode = 1;
		set_article_public($num, $mode, $is_sync);
		if ($am) header("Location: ../index.php?pl=$num");
		else header("Location: article.php?page=$page&ct1=$ct1&ct2=$ct2&search=".urlencode($search));
		exit;
	}

	if ($mode == "set_sync") {
		list($num, $is_sync, $is_public) = split("_", $exenum);
		if ($is_sync) $mode = 0; else $mode = 1;
		set_article_sync($num, $mode, $is_public);
		header("Location: article.php?page=$page&ct1=$ct1&ct2=$ct2&search=".urlencode($search));
		exit;
	}

	if ($mode == "c_ct") {
		$c_set = "";

		reset($HTTP_GET_VARS);
		while (list($key, $val) = each($HTTP_GET_VARS)) {
			if ($val == "on") $c_set .= ",".substr($key,3);
		}

		if (trim($c_set) && $c_ct1) {
			$c_set = substr($c_set,1);
			$c_ct2 = "c_ct2_".$c_ct1;
			put_query("update t3_".$dbid." set category1 = '$c_ct1', category2 = '".$$c_ct2."' where no in ($c_set)");
			set_ct_cnt();
		}

		header("Location: article.php");
		exit;
	}

	if ($mode == "set_delete") {
		list($num, $is_sync) = split("_", $exenum);
		// 作  者:Sea Otter
		// 代码说明:固顶
		// 变动类型:添加
		// 修改时间:2005.05.10
		// 原 代 码:无
		// 变更开始-------------------
  	list ($keep_top) = mysql_fetch_array(mysql_query("select keep_top from t3_".$dbid."	where no = $num"));
    if ($keep_top == '1') {
  		put_query ("delete from t3_".$dbid."_keep_top where no = '$num'");
	  }
		// 变更结束-------------------
		$sql = "select image_file_path1, image_file_path2 from t3_".$dbid." where no = $num";
		list ($image_file_path1, $image_file_path2) = mysql_fetch_array(mysql_query($sql));
		if ($image_file_path1 && $image_file_path2) force_rmdirs($r_attach_path.$image_file_path1.$image_file_path2);
		if (is_empty_dir($r_attach_path.$image_file_path1)) force_rmdirs($r_attach_path.$image_file_path1);
		put_query ("delete from t3_".$dbid." where no = '$num'");
		put_query ("delete from t3_".$dbid."_files where pno = '$num'");
		put_query ("delete from t3_".$dbid."_reply where pno = '$num'");
		put_query ("delete from t3_".$dbid."_trackback where pno = '$num'");
		set_article_sync($num, 0, 0);
		set_ct_cnt();
		update_xml();
		if ($am) header("Location: ../index.php");
		else header("Location: article.php");
		exit;
	}

	admin_header("");
?>

<script type="text/javascript">

	function move(page_num) {
		document.article.page.value = page_num;
		document.article.submit();
	}

	function set_public(form, num, is_public, is_sync) {
		form.mode.value = 'set_public';
		form.exenum.value = num + '_' + is_public + '_' + is_sync;
		form.submit();
	}

	function set_sync(form, num, is_sync, is_public) {
		form.mode.value = 'set_sync';
		form.exenum.value = num + '_' + is_sync + '_' + is_public;
		form.submit();
	}

	function set_delete(form, num, is_sync) {
		if (!confirm('将删除此网志所有的内容及附件.您确定要继续吗?\t')) return false;
		form.mode.value = 'set_delete';
		form.exenum.value = num + '_' + is_sync;
		form.submit();
	}

	var a_ary = new Array();
	var ct_ary = new Array();
	var t_set = true;

	function clear_ct2() {
		for(i = 0; i < ct_ary.length; i++) {
			document.getElementById('ct2_'+ct_ary[i][0]).style.display = 'none';
		}
	}

	function set_ct2(val) {
		for(i = 0; i < ct_ary.length; i++) {
			if (ct_ary[i][0] == val) {
				document.getElementById('ct2_' + val).style.display = 'block';
			}
		}
	}

	function onclick_toggle(form) {
		for(i = 0; i < a_ary.length; i++) {
			eval('document.article.chk' + a_ary[i]).checked = t_set;
		}
		if (t_set) t_set = false;
		else t_set = true;
	}

</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<form method="get" name="article" action="<?=$PHP_SELF?>">
<input type="hidden" name="mode">
<input type="hidden" name="exenum">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="ct1" value="<?=$ct1?>">
<input type="hidden" name="ct2" value="<?=$ct2?>">
<input type="hidden" name="search" value="<?=$search?>">

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

		<table width="100%" style="margin:0 0 3 0"><tr>
		<td width="24" align="right"><img src="../images/num_01.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_01.gif" width="92" height="17" alt=""></td>
					<td width="89" align="right">固顶选项 :: </td>
		<td width="120"><img class="ib" src="../images/b_advanced.gif" onClick="ShowModeWin('setting_keep_top.php','s_kt','Center','center','400','290','0','0','1','0','0','0');"></td>
		<td align="right"><img class="ib" src="../images/b_add.gif" width="53" height="17" onclick="if (confirm('建立新的网志.确定要继续吗?\t')) window.location.href='article_edit.php?mode=issue'" alt="点击这里建立新的网志"></td>
		</tr></table>

	<? print_content_line(); ?>

		<table cellpadding="0" cellspacing="0" width="100%">
		<?
			unset($add_query);
			if ($ct1) $add_query .= " and category1 = '$ct1' ";
			if ($ct2 == -1) $add_query .= " and category2 = '' ";
			else if ($ct2) $add_query .= " and category2 = '$ct2' ";

			if ($search) $add_query .= " and (title like ('%$search%') or body like ('%$search%')) ";

			$sql = "select count(*) from t3_".$dbid." where 1 $add_query";
			list ($totalcount) = mysql_fetch_array(mysql_query($sql));

			if (!$page) $page = 1;
			if (!$pagelog) $pagelog = 1;
			$pagelog = $p_article_cnt;
			if ($page==1) $prev_page = 1; else $prev_page = $page - 1;
			$article_start = (($page-1)*$pagelog);
			$article_end = $page * $pagelog;

			if ($article_end >= $totalcount) $article_end = $totalcount;
			$final_page = intval(($totalcount+$pagelog-1) / $pagelog);
			if ($page>=$final_page) { $next_page = $final_page; } else { $next_page = $page+1; }
			if ($article_start==$article_end && $page > 1) { $page--; $article_start -= $pagelog; }
			if (!$final_page) $final_page = 1;

			$sql = "
				select
					no, category1, category2, title, body,
					user_id, image_file_path1, image_file_path2, regdate, is_public, is_sync
				from
					t3_".$dbid."
				where 1
					$add_query
				order by
					regdate desc
				limit $article_start,
			".intval($article_end-$article_start);
 			$result = @mysql_query($sql);
			$flag = false;

			while(list(
				$no, $category1, $category2, $title, $body,
				$user_id, $image_file_path1, $image_file_path2, $regdate, $is_public, $is_sync
			) = @mysql_fetch_array($result)) {

				if ($flag) { ?><tr><td colspan="10" height="1" style="background-image:url('../images/dot_width2.gif')"></tr><? }
				$flag = true;

				if (!$category2) $categoryl = get_category1_label($category1);
				else $categoryl = get_category2_label($category2);

				?>
				<tr>
				<td width="30" align="center">
				<script type="text/javascript"> a_ary = a_ary.concat(<?=$no?>); </script>
				<input type="checkbox" name="chk<?=$no?>"></td>
				<td width="56" style="padding-left:5;"><img class="ib" src="../images/public<? if (!$is_public) { ?>_g<? } ?>.gif" width="51" height="14" onclick="set_public(article, '<?=$no?>', '<?=$is_public?>', '<?=$is_sync?>')" alt=""></td>
				<td width="51"><img class="ib" src="../images/sync<? if (!$is_sync) { ?>_g<? } ?>.gif" width="41" height="14" onclick="set_sync(article, '<?=$no?>', '<?=$is_sync?>', '<?=$is_public?>')" alt=""></td>
				<td width="61" class="h1"><?=get_timevalue0($regdate,1)?></td>
				<td width="95" style="padding:3 0 0 5; color:#097C9D"><?=str_cut($categoryl, 13, 0)?></td>
				<td width="18" style="padding:3 0 0 0">::</td>
				<td width="*" style="padding-top:3"><a href="article_edit.php?num=<?=$no?>&amp;page=<?=$page?>&amp;ct1=<?=$ct1?>&amp;ct2=<?=$ct2?>&amp;search=<?=urlencode($search)?>"><?=$title?></a></td>
				<td width="86"><img class="ib" src="../images/b_send_trackback.gif" width="83" height="17" onclick="window.open('article_trackback_pop.php?no=<?=$no?>','ctedit','width=550,height=200,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0')" alt=""></td>
				<td width="56"><img class="ib" src="../images/b_edit.gif" width="53" height="17" onclick="window.location.href='article_edit.php?num=<?=$no?>&amp;page=<?=$page?>&amp;ct1=<?=$category1?>&amp;ct2=<?=$category2?>&amp;search=<?=urlencode($search)?>'" alt=""></td>
				<td width="56"><img class="ib" src="../images/b_delete.gif" width="53" height="17" onclick="set_delete(article, '<?=$no?>', '<?=$is_sync?>')" alt=""></td>
				</tr>
				<?
			}
		?>
		</table>

		<table cellpadding="0" cellspacing="0" width="100%" style="margin-top:2"><tr>
		<td style="padding:10 0 0 0; background-image:url('../images/list_bottom1.jpg')">

			<table><tr>
			<td style="padding:0 0 3 3"><input type="checkbox" onclick="onclick_toggle('document.article');"></td>
			<td> 选择全部 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 将所有网志文章转移到到</td>
			<td>

				<table cellpadding="0" cellspacing="0"><tr>
				<td>
				<select name="c_ct1" onchange="clear_ct2(); set_ct2(this.value);" style="font-family:Tahoma; font-size:9pt">
				<option value="">选择大分类</option>
				<?
					$set_num = "";
					$sql = "select no, label from t3_".$dbid."_ct1 order by sortno asc";
					// print $sql;
					$result = mysql_query($sql);
					while(list($no, $label) = @mysql_fetch_array($result)) {
						?><option value="<?=$no?>"><?=$label?></option><?
					}
				?>
				</select>
				</td>
				</tr></table>
			</td>
			<td>
			<?
				unset($sc_buf);
				$sql = "select no, pno, label from t3_".$dbid."_ct2 order by pno asc, sortno asc";
				// print $sql;
				$result = mysql_query($sql);
				$pre_pno = 0;
				while(list($no, $pno, $label) = @mysql_fetch_array($result)) {
					$sc_buf .= " ct_ary = ct_ary.concat([['$pno','$no']]); ";
					if ($pre_pno != $pno) {
						if ($pre_pno != 0) print "</select></div>";
						?>
						<div id="ct2_<?=$pno?>" style="display:<? if ($category1 != $pno) print "none";?>">
						<select name="c_ct2_<?=$pno?>" style="font-size:9pt; font-family:Tahoma">
						<option value="">忽略小分类</option>
						<?
					}
					?><option value="<?=$no?>"><?=$label?></option><?
					$pre_pno = $pno;
				}
			?>
			</select>
			</div>
			<script type="text/javascript"><?=$sc_buf?></script>
			</td>
			<td>网志分类里</td>
			<td style="padding:0 0 0 6"><img class="ib" src="../images/b_submit.gif" width="53" height="17" onclick="document.article.mode.value='c_ct'; document.article.submit();" alt=""></td>
			</tr></table>

			<table cellpadding="0" cellspacing="0" width="100%" style="margin:10 0 0 0"><tr>
			<td height="1" style="background-image:url('../images/dot_width2.gif')"></td>
			</tr></table>

			<table width="100%" style="margin:15 0 0 0"><tr>
			<td width="70" style="padding:0 0 0 10">共 <?=$totalcount?> 篇</td>
			<td class="h2" align="center">
			<a href="#" onclick="move('1')">[1]</a> .. |
			<a href="#" onclick="move('<?=$prev_page?>')">PREV</a> |
			<?
				for ($i=($page-5);$i<$page;$i++) if ($i>0) print "<a href=\"#\" onclick=\"move('$i')\">[$i]</a> ";
				print " <font color=\"#E04040\">[".$page."]</font> ";
				for ($i=($page+1);$i<($page+5);$i++) if ($i <= $final_page) print " <a href=\"#\" onclick=\"move('$i')\">[$i]</a>";
			?>
			| <a href="#" onclick="move('<?=$next_page?>')">NEXT</a>
			| .. <a href="#" onclick="move('<?=$final_page?>')">[<?=$final_page?>]</a>
			</td>
			</tr></table>

		</td>
		</tr><tr>
		<td align=center>

			<table style="margin-top:12"><tr>
			<td>
			<select style="width:120; font-family:Tahoma; font-size:9pt" onchange="article.page.value='1'; article.ct2.value='';article.ct1.value=this.value;article.submit();">
			<option value="">选择大分类</option>
			<?
				$sql = "select no, sortno, label from t3_".$dbid."_ct1 order by sortno asc";
 				$result = @mysql_query($sql);
				while(list($no, $sortno, $label) = @mysql_fetch_array($result)) {
					?><option value="<?=$no?>" <? if ($ct1 == $no) print "selected"; ?>><?=str_cut($label,14,0)?></option><?
				}
			?>
			</select>
			</td><td>
			<select style="width:120; font-family:Tahoma; font-size:9pt" onchange="article.page.value='1'; article.ct2.value=this.value; article.submit();">
			<option value="">选择小分类</option>
			<option value="-1" <? if ($ct2 == -1) print "selected"; ?>>忽略小分类</option>
			<?
				if ($ct1) {
					$sql = "select no, sortno, label from t3_".$dbid."_ct2 where pno = $ct1 order by sortno asc";
 					$result = @mysql_query($sql);
					while(list($no, $sortno, $label) = @mysql_fetch_array($result)) {
						?><option value="<?=$no?>" <? if ($ct2 == $no) print "selected"; ?>><?=str_cut($label,14,0)?></option><?
					}
				}
			?>
			</select>
			</td>
			<td width="80" align="right" style="padding-top:3">主题 | 内容</td>
			<td><input class="text" type="text" name="stext" value="<?=$search?>" onkeydown="if (event.keyCode == 13) { article.page.value='1'; trim_all(article); article.search.value = article.stext.value; article.submit(); return false;}"></td>
			<td><img class="ib" src="../images/b_submit.gif" width="53" height="17" onclick="article.page.value='1'; trim_all(article); article.search.value = article.stext.value; article.submit();" alt=""></td>
			<td><img class="ib" src="../images/b_reset.gif" width="53" height="17" onclick="window.location.href='<?=$PHP_SELF?>'" alt=""></td>
			</tr></table>

			<table style="margin:20 0 0 0"><tr>
			<td><img src="../images/sc.gif" width="16" height="16" alt=""></td>
			<td style="padding:2 0 0 2"><a href="#" onclick="document.getElementById('sc2').style.display = 'none'; layer_toggle(document.getElementById('sc1')); return false;">本页快捷键列表</a> &nbsp;&nbsp;&nbsp;</td>
			<td><img src="../images/sc.gif" width="16" height="16" alt=""></td>
			<td style="padding:2 0 0 2"><a href="#" onclick="document.getElementById('sc1').style.display = 'none'; layer_toggle(document.getElementById('sc2')); return false;">所有快捷键列表</a></td>
			</tr></table>

			<div id="sc1" style="display:none;padding:10 5 5 15">
			<table><tr><td>
			<span class="sc" style="padding:1 4 2 4;">A</span> - 网志列表
			&nbsp; <span class="sc" style="padding:1 4 2 4;">S</span> - 下一页
			&nbsp; <span class="sc" style="padding:1 4 2 4;">Q</span> - 不退出返回首页
			<div style="margin:10 0 0 0"></div>
			<span class="sc" style="padding:1 4 2 5;">R</span> - 传送引用的第一页
			&nbsp; <span class="sc" style="padding:1 5 2 5;">T</span> - 收藏文章
			&nbsp; <span class="sc" style="padding:1 5 2 5;">F</span> - 未读的文章
			&nbsp; <span class="sc" style="padding:1 4 2 4;">G</span> - 脚本的文章
			</td></tr></table>
			</div>

			<div id="sc2" style="display:none;padding:10 5 5 15">
			<table><tr><td>
			<span class="sc" style="padding:1 4 2 4;">A</span> - 网志列表
			&nbsp; <span class="sc" style="padding:1 4 2 4;">S</span> - 下一页
			&nbsp; <span class="sc" style="padding:1 4 2 4;">Q</span> - 不退出返回首页
			<div style="margin:10 0 0 0"></div>
			<span class="sc" style="padding:1 4 2 5;">R</span> - 传送引用的第一页
			&nbsp; <span class="sc" style="padding:1 5 2 5;">T</span> - 收藏文章
			&nbsp; <span class="sc" style="padding:1 5 2 5;">F</span> - 未读的文章
			&nbsp; <span class="sc" style="padding:1 4 2 4;">G</span> - 脚本的文章
			<div style="margin:10 0 0 0"></div>
			<span class="sc" style="padding:1 5 2 4;">Z</span> - 最新文章列表
			&nbsp; <span class="sc" style="padding:1 5 2 5;">X</span> - Recently about five writing lists
			&nbsp; <span class="sc" style="padding:1 5 2 5;">C</span> - 最新回复列表
			</td></tr></table>
			</div>
		</td>
		</tr></table>

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

</form>

<script type="text/javascript">

	function shortcut_onkeydown(evt) {
		evt = get_event(evt);
		if ((set_key = evt.keyCode) && chk_event_tag_name(evt) && !(evt.altKey || evt.ctrlKey)) {
			if (set_key == '83') move('<?=$next_page?>');
			else if (set_key == '65') move('<?=$prev_page?>');
			else if (set_key == '70') window.location.href='reader.php?nr=1';
			else if (set_key == '71') window.location.href='reader.php?sc=1';
			else if (set_key == '82') window.location.href='reader.php';
			else if (set_key == '84') window.location.href='reader.php?rc=1';
			else if (set_key == '81') window.location.href='../index.php';
		}
	}

	document.onkeydown = shortcut_onkeydown;

</script>

<? admin_footer("") ?>