<?php
# ************** LICENCE ****************
/*
	Copyright (c) PORTANEO.

	This file is part of POSH (Portaneo Open Source Homepage) http://sourceforge.net/projects/posh/.

	POSH is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version

	POSH is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Posh.  If not, see <http://www.gnu.org/licenses/>.
*/
# ***************************************
# Open a RSS article
#
# !! be careful, this file must be saved under uft8 format, and display an e accentuated here : é
# ***************************************


$folder     = '';
$not_access = 0;
$pagename   = "portal/openrssarticle.php";

$artId = (isset($_REQUEST['id']) ? $_REQUEST['id'] : exit());
$feedId = (isset($_REQUEST['f']) ? $_REQUEST['f'] : exit());

//includes
require_once('includes.php');

launch_hook('openrssarticle_php');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo __APPNAME;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="language" content="<?php echo __LANG;?>" />
<link rel="stylesheet" type="text/css" href="../styles/main.css?v=<?php echo __POSHVERSION;?>" />
<link rel="stylesheet" type="text/css" href="../styles/main1.css?v=<?php echo __POSHVERSION;?>" />

<script type="text/javascript" src="../l10n/<?php echo __LANG;?>/lang.js?v=<?php echo __POSHVERSION;?>" ></script>
<script type="text/javascript" src="../includes/config.js?v=<?php echo __rand;?>" ></script>
<script type="text/javascript" src="../tools/mootools.js?v=1.2.1"></script>
<script type="text/javascript" src="../includes/ajax<?php if (!__debugmode) echo '_compressed';?>.js?v=<?php echo __POSHVERSION;?>" ></script>
<script type="text/javascript" src="../includes/php/ajax-urls.js?v=<?php echo __POSHVERSION;?>"></script>
<?php 
	launch_hook('userinterface_header',$pagename);
?>
</head>
<body>
<div id="cache" style="position:absolute;left:0;top:0;z-index:8;display:none;"></div>
<div id='headlink' name='headlink' style='position: relative;text-align: center;width: 100%;height: 30px;'></div>

<?php
	$DB->getResults($openRssArticle_getArticle,$DB->escape($artId),$DB->escape($feedId));
	$row = $DB->fetch(0);
	$link = $row['link'];
	$title = $row['title'];
	$DB->freeResults();
	
	if (isset($_SESSION['user_id']))
	{
		// set article as read
		$DB->execute($scrfeed_setAsRead,	$DB->escape($artId),
											$DB->escape($_SESSION['user_id']));
	}
										
?>
<iframe src="<?php echo $link;?>" id="articleselectedframe" frameborder="0" width="100%"></iframe>

<div id="debug"></div>
<script type="text/javascript"><!--
allowSave = true;

$p.setHeight('articleselectedframe',$p.navigator.getHeight()-35);

window.onload=function()
{
<?php
if (isset($_SESSION['user_id']))
	{
?>
	//load Posh objects
	$p.app.user.init(<?php echo $_SESSION['user_id'];?>,
                      "<?php echo $_SESSION['longname'];?>",
                      "<?php echo $_SESSION['type'];?>",
                      "<?php echo $_SESSION['availability'];?>",
                      "<?php echo $_SESSION['picture'];?>",
                      "<?php echo $_SESSION['username'];?>",
                      "<?php echo $_SESSION['lang'];?>"
                      );
	$p.app.tabs.sel = 0;
	tab[0] = new $p.app.tabs.object();
	tab[0].RssArticles[0] = new $p.app.widgets.rss.object(
												<?php echo $artId;?>,
												-1,
												0,
												"<?php echo $title;?>",
												'<?php echo $link;?>'
										   ); 
	if (__useSharing)
		$p.print('headlink','<a href="#" onclick="$p.friends.menu(2,0);return false;">' + $p.img('mynetwork.gif',16,16,"","imgmid") + ' ' + lg("articleMayInterest") + '</a>');
		
<?php
	}
?>
}
// -->
</script>
<?php launch_hook('userinterface_end',$pagename);?>
</body>
</html>