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

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

	if ($mode == "insert") {

		if ($r1 == 1) {
			if ($ra_add) {
				$sql = "select count(*) from t3_".$dbid."_rss where xml_url = '$xml_url'";
				list ($cnt) = mysql_fetch_array(mysql_query($sql));
				if (!$cnt) put_query("insert into t3_".$dbid."_rss (xml_url, title, link, description, regdate, is_sync, is_public) values ('$xml_url', '$title', '$link', '$description', '0', '0', '$is_public')");
			}
		} else {
			unset($xml_url);
			$title = $dtitle;
			$link = $dlink;
		}

		if ($num) {
			put_query("update t3_".$dbid."_link set type = '$r1', xml_url = '$xml_url', title = '$title', link = '$link' where no = $num");
		} else {
			$sql = "select count(*) from t3_".$dbid."_link where link = '$link'";
			list ($cnt) = mysql_fetch_array(mysql_query($sql));
			if ($cnt) error_process("02B7");
			put_query("insert into t3_".$dbid."_link (type, xml_url, title, link, regdate) values ('$r1', '$xml_url', '$title', '$link', '".time()."')");
		}
		header("location: link.php");
		exit;
	}

	if ($mode_rss_check) {
		list($st, $header, $body, $lmdate, $rval) = xml_parser($xml_url, "");
		if ($rval) {
			list($title, $link, $description) = str_dbi_check(get_siteinfo($rval));
		} else {
			unset($title, $link, $description);
		}
	} else if ($num) {
		$sql = "select type, xml_url, title, link from t3_".$dbid."_link where no = $num";
		list ($r1, $xml_url, $title, $link, $description) = mysql_fetch_array(mysql_query($sql));
		if ($r1 == 2) { $dtitle = $title; $dlink = $link; unset ($title, $link); }
	}

	$title = trim($title);
	$link = trim($link);
	$description = trim($description);

	admin_header("");
?>

<script type="text/javascript">

	function onclick_rss_check(form) {
		trim_all(form);
		form.mode_rss_check.value = 1;
		form.submit();
	}

	function onclick_link_edit(form) {
		trim_all(form);

		if (form.r1[0].checked) {
			if (isNull(form.xml_url, '按 RSS 地址读取网站详细资料')) return false;
			if (isNull(form.title, '请输入网站名称')) return false;
			if (isNull(form.link, '请输入网站地址')) return false;
			if (!(form.num.value)) {
				if (confirm('是否要顺便加入到订阅文章的网站列表里?\t')) form.ra_add.value = '1';
				if (confirm('是否要顺便让该网志加入文章订阅RSS清单里?\t')) form.is_public.value = '1';
				else form.is_public.value = '0';
			}
		} else {
			if (isNull(form.dtitle, '请输入网站名称')) return false;
			if (isNull(form.dlink, '请输入网站网址')) return false;
		}

		form.mode.value = 'insert';
		form.submit();
	}

</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" name="link_edit" action="<?=$PHP_SELF?>">
<input type="hidden" name="mode" value="<?=$mode?>">
<input type="hidden" name="mode_rss_check">
<input type="hidden" name="ra_add">
<input type="hidden" name="is_public">
<input type="hidden" name="num" value="<?=$num?>">

	<table cellpadding="0" cellspacing="0"><tr>
	<td width="740" 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_11.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_11.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 style="margin-top:5"><tr>
			<td width="100" align="right">输入方式 :: </td>
			<td>
			<input type="radio" name="r1" value="1" checked onclick="document.getElementById('d2').style.display='none'; document.getElementById('d1').style.display='block';">输入RSS地址
			<input type="radio" name="r1" value="2" <? if ($r1 == 2) print "checked"; ?> onclick="document.getElementById('d1').style.display='none'; document.getElementById('d2').style.display='block';">输入网址
			</td>
			</tr></table>

		<div id=d1 <?=($r1==2)?("style=\"display:none\""):(null)?> >

		<? input_block() ?>

			<table style="margin-top:5"><tr>
			<td width="100" align="right">RSS 地址 :: </td>
			<td><input type="text" class="text" name="xml_url" style="width:393" value="<?=$xml_url?>"></td>
			<td><img class="ib" src="../images/b_send.gif" onclick="onclick_rss_check(link_edit);" alt=""></td>
			</tr></table>

			<table><tr>
			<td align="right" width="100">网站名称 :: </td>
			<td><input type="text" class="text" name="title" style="width:450" value="<?=$title?>"></td>
			</tr></table>

			<table><tr>
			<td align="right" width="100">网站地址 :: </td>
			<td><input type="text" class="text" name="link" style="width:450" value="<?=$link?>"></td>
			</tr></table>

		<input type="hidden" name="description" value="<?=$description?>">

		</div>

		<div id="d2" style="display:<?=($r1==2)?("block"):("none")?>">

		<? input_block() ?>

			<table style="margin-top:5"><tr>
			<td align="right" width="100">网站名称 :: </td>
			<td><input type="text" class="text" name="dtitle" style="width:450" value="<?=$dtitle?>"></td>
			</tr></table>

			<table><tr>
			<td align="right" width="100">网站地址 :: </td>
			<td><input type="text" class="text" name="dlink" style="width:450" value="<?=$dlink?>"></td>
			</tr></table>

		</div>

		<div align="center" style="margin:10"><img class="ib" src="../images/b_save.gif" width="53" height="17" onclick="onclick_link_edit(link_edit);"><img class="ib" src="../images/b_cancel.gif" width="53" height="17" onclick="window.location.href='link.php'" style="margin-left:5" alt=""></div>

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

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

</form>

<? admin_footer("") ?>