Location: PHPKode > projects > MonkeyChow > monkeychow/framesview.php
<?php
/*
 * This file is part of Monkeychow - http://monkeychow.org
 *
 * view.php - frames based viewer
 *
 *
 * Copyright (C) 2006 Ernie Oporto
 * hide@address.com - http://www.shokk.com/blog/
 *
 * Copyright (C) 2004 Stephen Minutillo
 * hide@address.com - http://minutillo.com/steve/
 *
 * Distributed under the GPL - see LICENSE
 *
 */

include_once("init.php");
include_once("fof-main.php");

$ipod_width=75;
$ipod_font=8;
$nonipod_font=2;
fof_prune_expir_feeds();
flush();

if($_REQUEST['how'] == 'paged' && !isset($_REQUEST['which']))
{
	$which = 0;
}
else
{
	$which = $_REQUEST['which'];
}

$order = isset($_REQUEST['order']) ? $_REQUEST['order'] : "desc";

$feed = $_REQUEST['feed'];
$framed = $_REQUEST['framed'];
$how = $_REQUEST['how'];
$what = $_REQUEST['what'];
$when = $_REQUEST['when'];
$howmany = $_REQUEST['howmany'];
$search = htmlspecialchars($_REQUEST['search']);
$tags = $_REQUEST['tags'];

$title = fof_view_title($feed, $what, $when, $which, $howmany);
$noedit = $_GET['noedit'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<title><?php echo strip_tags($title) ?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?
	if (isset($fof_user_prefs['itemsrefresh']) && $fof_user_prefs['itemsrefresh'] != 0)
	{
		echo "        <meta http-equiv=\"refresh\" content=\"" . $fof_user_prefs['itemsrefresh']*60 . ";url=" . $_SERVER['REQUEST_URI'] . "\">\n";
	}
?>
	<script src="fof.js" type="text/javascript"></script>
	<script src="behindthescenes.js"></script>
	<link rel="stylesheet" href="fof-common.css" media="all" />
	<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />

</head>
<body onload="<? echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  "" : "parent.menu.location.reload();"; ?>">
<?php
	if(!$_REQUEST['framed'])
	{
		#include("framesmenu.php");
?>
<?php
		echo "<br />";
	}
?>

<p><?php echo $title?> -
<?php

if($order == "desc")
{
    echo "[" . _("time desc") . "] ";
	echo "<a href=\"framesview.php?feed=$feed&amp;what=$what&amp;when=$when&amp;how=$how&amp;howmany=$howmany&amp;order=asc";
	echo ($_REQUEST['framed'] == "yes") ? "&amp;framed=yes": "";
	if (($tags) && ($tags != _("All tags")) && ($tags != _("No tags")) )
	{
		echo	($_REQUEST['tags']) ? "&amp;tags=" . $tags: "";
	}
   	echo 	"\">[" . _("time asc") . "]</a>";
} else {
	echo "<a href=\"framesview.php?feed=$feed&amp;what=$what&amp;when=$when&amp;how=$how&amp;howmany=$howmany&amp;order=desc";
	echo	($_REQUEST['framed']) ? "&amp;framed=yes": "";
	if (($tags) && ($tags != _("All tags")) && ($tags != _("No tags")) )
	{
		echo	($_REQUEST['tags']) ? "&amp;tags=" . $tags: "";
	}
   	echo "\">[" . _("time desc") . "]</a>";
    echo " [" . _("time asc") . "]";
}
if($what == "all")
{
	echo " [" . _("all") . "] ";
	echo "<a href=\"framesview.php?feed=$feed&amp;what=&amp;when=$when&amp;how=$how&amp;howmany=$howmany&amp;order=asc";
    echo ($_REQUEST['framed'] == "yes") ? "&amp;framed=yes": "";
    if (($tags) && ($tags != _("All tags")) && ($tags != _("No tags")) )
    {
        echo    ($_REQUEST['tags']) ? "&amp;tags=" . $tags: "";
    }
    echo "\">[" . _("new") . "]</a>";
}
else
{
	echo " <a href=\"framesview.php?feed=$feed&amp;what=all&amp;when=$when&amp;how=$how&amp;howmany=$howmany&amp;order=asc";
	echo ($_REQUEST['framed'] == "yes") ? "&amp;framed=yes": "";
	if (($tags) && ($tags != _("All tags")) && ($tags != _("No tags")) )
	{
		echo	($_REQUEST['tags']) ? "&amp;tags=" . $tags: "";
	}
	echo "\">[" . _("all") . "]</a>";
    echo " [" . _("new") . "]";
}
echo "</p>";

?>
<div id="items">


		<form name="items" action="view-action.php" method="post">
<?php
		if (! $_REQUEST['framed'] )
		{
?>
<div class="menu">
<ul>
<li><font size="<?php 
		echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  "$ipod_font":  "$nonipod_font";
?>"><a href="javascript:<? echo ($_REQUEST['framed']) ? "parent.items." : ""; ?>mark_read()"><? echo _("mark as read") ?></a></font></li>
<li><font size="<?php 
		echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  "$ipod_font":  "$nonipod_font";
?>"><a target=_blank href="feeds.php?order=unread&newonly=yes&direction=desc"><?php echo _("feeds list"); ?></a></font></li>
<li><font size="<?php 
        echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  "$ipod_font":  "$nonipod_font";
?>"><a href="javascript:<? echo ($_REQUEST['framed']) ? "parent.items." : ""; ?>flag_all();<? echo ($_REQUEST['framed']) ? "parent.items." : ""; ?>mark_read()"><? echo _("mark all read") ?></a></font></li>
</ul></div>
<?php
		}
?>
		<input type="hidden" name="action" id="action" />
		<input type="hidden" name="return" id="return" />

<?php
	$links = fof_get_frame_nav_links($feed, $what, $when, $which, $howmany, $framed, $tags);

	if($links)
	{
?>
		<div class="nav"><?php echo $links ?></div>

<?php
	}


$result = fof_get_items($feed, $what, $when, $which, $howmany, $order, $tags, $search);

$count = 0;
foreach($result as $row)
{
	$items = true;

	$timestamp =  date("F j, Y, g:i a", $row['timestamp'] - (FOF_TIME_OFFSET * 60 * 60));
	$feed_link = $row['feed_link'];
	$feed_image = $row['feed_image'];
	$feed_title = strip_tags($row['feed_title']);
	$feed_description = htmlspecialchars($row['feed_description']);
	$item_id = $row['item_id'];
	$item_link = $row['item_link'];
	$item_title = $row['item_title'];
        $item_title = strip_tags(htmlspecialchars_decode($item_title));
	$item_content = urldecode($row['item_content']);
	$item_read = $row['item_read'];
	$item_publish = $row['item_publish'];
	$item_star = $row['item_star'];
        if ( $item_publish ) {
            $checked = "checked=\"checked\"";
        }
         else {
            $checked = "";
        }
        if ( $item_star ) {
            $starred = "star_on.gif";
        }
        else {
            $starred = "star_off.gif";
        }
		if($row['feed_image'] && $fof_user_prefs['favicons'])
		{
		    $favicon_link = "<a href=\"$feed_link\" title=\"feed\"><img ";
			$favicon_link .= (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  " width=\"$ipod_width\" height=\"$ipod_width\"":  "";
			$favicon_link .= " src='" . urldecode($row['feed_image']) . "' width='" . $fof_user_prefs['faviconsize'] . "' height='" . $fof_user_prefs['faviconsize'] . "' border='0' /></a>";
	    }
	    else
	    {
	        $favicon_link="";
	    }


	$dccreator = $row['dccreator'];
	$dcdate = $row['dcdate'];
	$dcsubject = $row['dcsubject'];
        $expand_link = "<img "; 
		$expand_link .= (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  " width=\"$ipod_width\" height=\"$ipod_width\"":  "";
		$expand_link .= "border=\"0\" src=\"ipodarrowright.jpg\" name=\"exp$item_id\" id=\"exp$item_id\" alt=\"" . _("Expand Body") . "\" onclick=\"toggle_expand_item('body$item_id');toggle_expand_item('controls1-$item_id');toggle_expand_item('controls2-$item_id');toggle_arrowimage('exp$item_id');\" title=\"" . _("Expand Body") . "\" />";
		
        $star_link = "<img ";
		$star_link .= (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  " width=\"$ipod_width\" height=\"$ipod_width\"":  "";
		$star_link .= "border=\"0\" src=\"$starred\" name=\"star$item_id\" id=\"star$item_id\" alt=\"" . _("Toggle Star") . "\" onclick=\"togStar('star$item_id')\" title=\"" . _("Toggle Star"). "\" />";

#echo "<div id=\"box\">";
        echo '<div id="shadow-container"><div class="shadow1"><div class="shadow2"><div class="shadow3">';
	echo "\n"."<div class=\"item itemout container\" onmouseover=\"this.className='item itemover container'\" onmouseout=\"this.className='item itemout container'\">";
	echo '<div class="header">';

        echo "<table style=\"table-layout:fixed;\" bgcolor=\"#ffffff\" width=\"100%\" border=\"0\">";
        echo "<tr bgcolor=\"#ffffff\" height=\"9\"><td class=\"headertitle\">";
        echo $expand_link;
        echo $star_link . " ";
		echo $favicon_link;
        echo "<font class=\"feed_title\" size=\"";
		echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  "$ipod_font":  "$nonipod_font";
		echo "\" >";
        echo "<a ";
		echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  "target=_blank ":  "";
		echo "class=\"item_title\" title=\"$item_title\" href=\"$item_link\">$item_title</a></font>";
        echo "<font class=\"feed_title\" size=\"";
		echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  "$ipod_font":  "$nonipod_font";
		echo "\" >";
		echo " $feed_title</font>";

        echo "</td><td width=\"45\" align=\"right\">";
	echo "<div valign=\"center\" class=\"controls\">";
	echo "<img ";
	echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  " width=\"$ipod_width\" height=\"$ipod_width\" " :  "";
	echo " src=\"flagup.jpg\" title=\"" . _("flag up to here") . "\" border=\"0\" onclick=\"flag_upto('c" . $item_id . "." . $count . "')\" />";
	echo "<input ";
	echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ?  " class=\"bigcheck\"" :  "";
	echo " onclick=\"clickage(event)\" type=\"checkbox\" name=\"c" . $item_id . "." . $count . "\" value=\"checked\" />";
	echo '</div>';

        echo "</tr></td>";
        echo "<tr bgcolor=\"#ffffff\">";
        echo "<td colspan=\"2\">";


    echo "<div class=\"control\" id=\"controls1-$item_id\"";
	echo ($fof_user_prefs['collapse'] == 1) ? " style=\"display:none\" " : "" ;
	echo ">";

	echo '<font class="meta">';
        if ( is_null($feed) || $feed == "" )
        {
            echo "from <a href=\"$feed_link\" title=\"$feed_title\">$feed_title</a> ";
        }
	if($dccreator)
	{
		echo _("by") . " $dccreator <br />";
	}
	if($dcsubject)
	{
		echo "<i>" . _("on") . " $dcsubject </i><br />";
	}
        echo "</div>";
        echo "</div>";	#control div

        echo "</td></tr>";
        echo "<tr>";	#iconsbar
        echo "<td colspan=\"2\">";
        echo "<div bgcolor=\"#dddddd\" class=\"control linksbar\" id=\"controls2-$item_id\"";
	echo ($fof_user_prefs['collapse'] == 1) ? " style=\"display:none\" " : "" ;
		echo ">";

// the following should be placed into individual plugins for the itembar
        $recycle_link= _("Recycle") . ": <input type=\"checkbox\" name=\"pub$item_id\" onclick=\"togglePublish(this)\" value=\"$item_id\" $checked>";
        $delicious_url = "http://del.icio.us/" . DELICIOUS_USERNAME . "?v=3&url=" . $item_link . "&title=" . $item_title . "&notes=&v=4&noui&jump=close&src=ffext1.0.2";
        $technorati_url = "http://www.technorati.com/cosmos/search.html?sub=postcosm&url=" . $item_link;
        $blogger_url = "http://www.blogger.com/blog_this.pyra?&u=" . $item_link . "&n=" . $item_title;
        $email_url="subject=" . rawurlencode($item_title) . "&body=" . _("Check this out at ") . rawurlencode($item_link) . " :" . rawurlencode("<br />".$item_content);
        $email_url = eregi_replace(",","%2C",$email_url);
        if (strlen($email_url) > 1800) 
        {
           // string exceeded length, truncate and add trailing dots
           $email_url=substr($email_url,0,1800);
        } 
        $email_tag = _("
---
This email brought to you by the Monkeychow web-based RSS reader.
http://www.monkeychow.org");
        #$email_tag = rawurlencode($email_tag);
        #$email_url .= $email_tag;
        $email_url .= rawurlencode($email_tag);
        //$digg_url = "http://digg.com/submit?phase=2&url=" . rawurlencode($item_link);
        $newsvine_url = "http://www.newsvine.com/_wine/save?u=" . rawurlencode($item_link) . "&h=" . rawurlencode($item_title);

        //$digg_link = "<a href=\"$digg_url\" target=\"_blank\" title=\"" . "Digg This" . "\"><img border=\"0\" src=\"digg.png\"></a>";
		$digg_link = "";
        $newsvine_link = "<a href=\"$newsvine_url\" target=\"_blank\" title=\"Seed Newsvine\"><img border=\"0\" src=\"newsvine.png\"></a>";
        $delicious_link = "<a href=\"$delicious_url\" target=\"_blank\" title=\"Add to My del.icio.us\"><img border=\"0\" src=\"delicious_favicon.ico\"></a>";
        $technorati_link = "<a href=\"$technorati_url\" target=\"_blank\" title=\"" . _("Search") . " Technorati Cosmos\"><img border=\"0\" src=\"bubble.gif\"></a>";
        $blogger_link = "<a href=\"$blogger_url\" target=\"_blank\" title=\"" . _("BlogThis") . "!\"><img border=\"0\" src=\"blogit.png\"></a>";
        $email_link = "<a href=\"mailto:?" . $email_url . "\" title=\"" . _("Email To") . "...\"><img border=\"0\" src=\"mailto.gif\"></a>";

// each of the above should be assembled into the tem toolbar with plugins
// itembar_plugins($item_link,$item_content);

        echo $recycle_link . "&nbsp;&nbsp;<font size=\"1\">" . $delicious_link . "&nbsp;&nbsp;&nbsp;" . $newsvine_link . "&nbsp;&nbsp;&nbsp;" . $digg_link . "&nbsp;&nbsp;&nbsp;" . $technorati_link . "&nbsp;&nbsp;&nbsp;" . $blogger_link . "&nbsp;&nbsp;&nbsp;" . $email_link . "</font>";

        echo "<br />";
	if($dcdate)
	{
            $dcdate = date("F j, Y, g:i a", $dcdate);

		echo _("at") . " " . $dcdate . " ";
	}
	echo "(cached at $timestamp)";
	echo "</tr>";	#iconsbar
    echo "</div>";	#linksbar
    echo "</div>";	#header div

    echo "</td></tr></table>";

    echo "</div>"; #item div


// alter item_content here with plugins
// content_plugins($item_link,$item_content);

// BEGIN DIGG PLUGIN
/*
if (preg_match("/digg.com/i", $item_link))
{
	$diggframe = '<iframe src="http://digg.com/api/diggthis.php?u=' . rawurlencode($item_link) . '" height="80" width="52" align="top" frameborder="0" scrolling="no"></iframe><BR>';
	$item_content = $diggframe . $item_content;
}
*/
// END DIGG PLUGIN

    if( function_exists( 'tidy_parse_string' ) ) 
    {
			tidy_parse_string($item_content);
			tidy_setopt('output-xhtml', TRUE);
			tidy_setopt('indent', TRUE);
			tidy_setopt('indent-spaces', 2);
			tidy_setopt('wrap', 200);
			tidy_setopt('show-body-only', TRUE);
			tidy_clean_repair();
			$item_content = tidy_get_output();
	}
	echo "<div class=\"body\" id=\"body$item_id\"";
	echo ($fof_user_prefs['collapse'] == 1) ? " style=\"display:none\" " : "" ;
	echo "><p>$item_content</p></div>";
        echo "</div>"; #items div
        echo "</div></div></div></div>"; #shadow, etc
        $count ++;
}

if(!$items)
{
	echo "<p>" . _("No items found") . ".</p>";
}

?>
		</form>
<?php
	if($links)
	{
?>
		<div class="nav"><?php echo $links ?></div>

<?php
	}
?>

</div>
<script type="text/javascript" src="http://del.icio.us/js/playtagger"></script>
</body>
</html>
Return current item: MonkeyChow