<?php
	require("__include-common.php");
	require("__include-common-rss.php");
	require("../account/__logincheck.php");

	$con = my_mysqli_connect(_DB_SCHEMA);
	$sql = "select * from m_rss where c_delete = 0 and id_account = '" . $_SESSION['current_id'] . "'";
	$sql .= " and id_rss = " . intval($_GET['id']);
	if ($_SESSION['current_id'] != $_SESSION['login_id']) {
		$sql .= " and c_privacy = 0";
	}
	$rs = my_mysqli_query($sql);
	if (!($rec = mysqli_fetch_array($rs))) {
		exit;
	}
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>RSS/ATOM Feed</title>
<style>
body{
	background-color:#F4F4EE;
	font:13px tahoma,Geneva,sans-serif;
	text-align:left;
}
#divRss {
	width:500px;
	padding: 0px 3px 3px 5px;
	background-color:#FFF;
	border:1px solid #D3CAD7;
	margin-top:3px;
}
.ItemTitle{
	font-weight:bold;
	margin:5px 0px 0px 0px;
	padding-top:3px;
}
.ItemTitle a{ color:#4EBAFF; text-decoration:none }
.ItemTitle a:hover{ text-decoration:underline }
.ItemContent{
	padding:1px 3px 3px 3px;
	border-bottom:1px solid #D3CAD7;
	color:#3E3E3E;
	display: <?= $_COOKIE['rss_feed_showdesc'] ?>;
}
.ItemDate{
	font-size:11px;
	color:#AAA;
}
table {
	border-collapse: collapse;	/* separate collapse */
	border: none;
	border-spacing: 0;
}
th,td {
	vertical-align: top;
	text-align: left;
}
#title {
	margin-left: 2px;
	font-weight: bold;
	font-size: 16px;
	color: #303030;
}
#chk-desc {
	margin-left: 10px;
	color: #888888;
	font-size: 12px;
}
#index a {
	color: #2128e0;
}
</style>
<script src="../scripts/jquery.js"></script>
<script src="../scripts/jquery.cookie.js"></script>
<script src="../scripts/ok2nd.js"></script>
<script src="feed/FeedEk-ok2nd.js"></script>
<script>
$(document).ready(function () {
<?php
	if ($_COOKIE['rss_feed_showdesc'].'' != 'none') {
?>
	$('#chkDesc').attr('checked', 'checked');
<?php
	}
?>
	$('#divRss').FeedEk({
		FeedUrl: '<?= $rec['c_rss_url'] ?>',
		MaxCount: <?= RSS_FEEDEK_FEED_MAXCOUNT ?>,
		ShowDesc: true,
		ShowPubDate: true
	});
});
function bodyView(me) {
	if (me.checked) {
		display = 'block';
	} else {
		display = 'none';
	}
	$('.ItemContent').css('display',display);
	$.cookie('rss_feed_showdesc', display, { path:'<?= MY_SESSION_PATH ?>', expires:365 });
}
</script>
</head>
<body>
<div id="divSrc">
	<span id="title"><?= $rec['c_title'] ?></span>
	<span id="chk-desc"><label>本文表示:<input id="chkDesc" type="checkbox" onclick="javascript:bodyView(this);"></label></span>
</div>
<table><tr>
<td>
<div id="divRss"></div>
</td>
<td>
	<ul id="index">
<?php
	$sql = "select * from m_rss where c_delete = 0 and c_rss_url <> '' and id_account = '" . $_SESSION['current_id'] . "'";
	$sql .= " and id_category = " . $rec['id_category'];
	if ($_SESSION['current_id'] != $_SESSION['login_id']) {
		$sql .= " and c_privacy = 0";
	}
	$sql .= " order by c_displayOrder, c_title";
	$rs_rss = my_mysqli_query($sql);
	while ($rec_rss = mysqli_fetch_array($rs_rss)) {
?>
		<li><a href="?id=<?= $rec_rss['id_rss'] ?>"><?= $rec_rss['c_title'] ?></a></li>
<?php
	}
?>
	</ul>
</td>
</tr></table>
</body>
</html>
