Per-user feed rename support;

Support for hiding feed item content by default (also per-user);
Duplicate page navigation at the bottom of the page;
Correct item list title ("feed on feeds - vitaphoto checkins - items 0 to 50 - new items tagged Fun")
&how=paged in tag list links;
Fix a lot of ugly code.
master
vitalif 2010-01-25 17:30:38 +00:00
parent 1e0937a7b0
commit a1750d1989
12 changed files with 464 additions and 488 deletions

View File

@ -34,9 +34,9 @@ function fof_db_connect()
function fof_db_optimize() function fof_db_optimize()
{ {
global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_ITEM_TAG_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_TAG_TABLE, $FOF_USER_TABLE; /* Может быть, проблемы из-за этого? */
/*global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_ITEM_TAG_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_TAG_TABLE, $FOF_USER_TABLE;*/
fof_db_query("optimize table $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_ITEM_TAG_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_TAG_TABLE, $FOF_USER_TABLE"); /*fof_db_query("optimize table $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_ITEM_TAG_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_TAG_TABLE, $FOF_USER_TABLE");*/
} }
function fof_safe_query(/* $query, [$args...]*/) function fof_safe_query(/* $query, [$args...]*/)
@ -154,14 +154,14 @@ function fof_db_get_subscriptions($user_id)
{ {
global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_ITEM_TAG_TABLE; global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_ITEM_TAG_TABLE;
return(fof_safe_query("select * from $FOF_FEED_TABLE, $FOF_SUBSCRIPTION_TABLE where $FOF_SUBSCRIPTION_TABLE.user_id = %d and $FOF_FEED_TABLE.feed_id = $FOF_SUBSCRIPTION_TABLE.feed_id order by feed_title", $user_id)); return fof_safe_query("select * from $FOF_FEED_TABLE, $FOF_SUBSCRIPTION_TABLE where $FOF_SUBSCRIPTION_TABLE.user_id = %d and $FOF_FEED_TABLE.feed_id = $FOF_SUBSCRIPTION_TABLE.feed_id order by feed_title", $user_id);
} }
function fof_db_get_feeds() function fof_db_get_feeds()
{ {
global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_ITEM_TAG_TABLE; global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_ITEM_TAG_TABLE;
return(fof_db_query("select * from $FOF_FEED_TABLE order by feed_title")); return fof_db_query("select * from $FOF_FEED_TABLE order by feed_title");
} }
function fof_db_get_item_by_id($item_id) function fof_db_get_item_by_id($item_id)
@ -221,21 +221,25 @@ function fof_db_get_feed_by_url($feed_url)
$result = fof_safe_query("select * from $FOF_FEED_TABLE where feed_url='%s'", $feed_url); $result = fof_safe_query("select * from $FOF_FEED_TABLE where feed_url='%s'", $feed_url);
if(mysql_num_rows($result) == 0) if (mysql_num_rows($result) == 0)
{
return NULL; return NULL;
}
$row = mysql_fetch_array($result); $row = mysql_fetch_array($result);
return $row; return $row;
} }
function fof_db_get_feed_by_id($feed_id) function fof_db_get_feed_by_id($feed_id, $user_id = false)
{ {
global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_SUBSCRIPTION_TABLE, $FOF_ITEM_TAG_TABLE; global $FOF_FEED_TABLE, $FOF_SUBSCRIPTION_TABLE;
$result = fof_safe_query("select * from $FOF_FEED_TABLE where feed_id=%d", $feed_id); $j = "";
if ($user_id)
$j = "JOIN $FOF_SUBSCRIPTION_TABLE s ON s.user_id=".intval($user_id)." AND s.feed_id=s.feed_id";
$result = fof_safe_query("select * from $FOF_FEED_TABLE f $j where f.feed_id=%d", $feed_id);
if (mysql_num_rows($result) == 0)
return NULL;
$row = mysql_fetch_array($result); $row = mysql_fetch_array($result);
@ -349,7 +353,7 @@ function fof_db_get_items($user_id=1, $feed=NULL, $what="unread", $when=NULL, $s
} }
$args = array(); $args = array();
$select = "SELECT i.* , f.* "; $select = "SELECT i.* , f.*, s.subscription_prefs ";
$from = "FROM $FOF_FEED_TABLE f, $FOF_ITEM_TABLE i, $FOF_SUBSCRIPTION_TABLE s "; $from = "FROM $FOF_FEED_TABLE f, $FOF_ITEM_TABLE i, $FOF_SUBSCRIPTION_TABLE s ";
$where = sprintf("WHERE s.user_id = %d AND s.feed_id = f.feed_id AND f.feed_id = i.feed_id ", $user_id); $where = sprintf("WHERE s.user_id = %d AND s.feed_id = f.feed_id AND f.feed_id = i.feed_id ", $user_id);
@ -394,6 +398,7 @@ function fof_db_get_items($user_id=1, $feed=NULL, $what="unread", $when=NULL, $s
while($row = mysql_fetch_assoc($result)) while($row = mysql_fetch_assoc($result))
{ {
$row['prefs'] = unserialize($row['subscription_prefs']);
$array[] = $row; $array[] = $row;
} }
@ -498,13 +503,13 @@ function fof_db_tag_feed($user_id, $feed_id, $tag_id)
fof_db_set_subscription_prefs($user_id, $feed_id, $prefs); fof_db_set_subscription_prefs($user_id, $feed_id, $prefs);
} }
function fof_db_set_feed_filter($user_id, $feed_id, $filter) function fof_db_set_feedprop($user_id, $feed_id, $prop, $value)
{ {
$chg = false; $chg = false;
$prefs = fof_db_get_subscription_prefs($user_id, $feed_id); $prefs = fof_db_get_subscription_prefs($user_id, $feed_id);
if ($prefs['filter'] != $filter) if ($prefs[$prop] != $value)
{ {
$prefs['filter'] = $filter; $prefs[$prop] = $value;
$chg = true; $chg = true;
} }
fof_db_set_subscription_prefs($user_id, $feed_id, $prefs); fof_db_set_subscription_prefs($user_id, $feed_id, $prefs);
@ -841,4 +846,18 @@ function fof_db_get_is_duplicate_item($item_id, $item_guid, $content_md5)
return $users; return $users;
} }
function fof_db_set_feed_custom_title($user_id, $feed_id, $feed_title, $custom_title)
{
global $FOF_FEED_TABLE, $FOF_SUBSCRIPTION_TABLE;
$prefs = fof_db_get_subscription_prefs($user_id, $feed_id);
if (!$prefs)
return false;
if (!$custom_title || $feed_title == $custom_title)
$r = $prefs['feed_title'] = '';
else
$r = $prefs['feed_title'] = $custom_title;
fof_db_set_subscription_prefs($user_id, $feed_id, $prefs);
return $r;
}
?> ?>

View File

@ -329,13 +329,13 @@ function fof_get_feeds($user_id, $order = 'feed_title', $direction = 'asc')
$id = $row['feed_id']; $id = $row['feed_id'];
$age = $row['feed_cache_date']; $age = $row['feed_cache_date'];
$feeds[$i]['prefs'] = unserialize($row['subscription_prefs']);
$feeds[$i]['feed_id'] = $id; $feeds[$i]['feed_id'] = $id;
$feeds[$i]['feed_url'] = $row['feed_url']; $feeds[$i]['feed_url'] = $row['feed_url'];
$feeds[$i]['feed_title'] = $row['feed_title']; $feeds[$i]['feed_title'] = $row['feed_title'];
$feeds[$i]['feed_link'] = $row['feed_link']; $feeds[$i]['feed_link'] = $row['feed_link'];
$feeds[$i]['feed_description'] = $row['feed_description']; $feeds[$i]['feed_description'] = $row['feed_description'];
$feeds[$i]['feed_image'] = $row['feed_image']; $feeds[$i]['feed_image'] = $row['feed_image'];
$feeds[$i]['prefs'] = unserialize($row['subscription_prefs']);
$feeds[$i]['feed_age'] = $age; $feeds[$i]['feed_age'] = $age;
list($agestr, $agestrabbr) = fof_nice_time_stamp($age); list($agestr, $agestrabbr) = fof_nice_time_stamp($age);
@ -423,6 +423,18 @@ function fof_get_feeds($user_id, $order = 'feed_title', $direction = 'asc')
return $feeds; return $feeds;
} }
function fof_feed_title($feed, $prefs = NULL)
{
if (!$prefs)
$prefs = $feed['prefs'];
if (!$prefs)
$prefs = fof_db_get_subscription_prefs(fof_current_user(), $feed['feed_id']);
$t = $prefs['feed_title'];
if (!$t)
$t = $feed['feed_title'];
return $t;
}
function fof_view_title($feed=NULL, $what="new", $when=NULL, $start=NULL, $limit=NULL, $search=NULL) function fof_view_title($feed=NULL, $what="new", $when=NULL, $start=NULL, $limit=NULL, $search=NULL)
{ {
$prefs = fof_prefs(); $prefs = fof_prefs();
@ -430,26 +442,38 @@ function fof_view_title($feed=NULL, $what="new", $when=NULL, $start=NULL, $limit
if(!is_null($when) && $when != "") if(!is_null($when) && $when != "")
{ {
$title .= ' - ' . $when ; $title .= ' - ' . $when;
} }
if(!is_null($feed) && $feed != "")
if (!is_null($feed) && $feed != "" &&
($r = fof_db_get_feed_by_id($feed)))
{ {
$r = fof_db_get_feed_by_id($feed); $title .= ' - ' . htmlspecialchars(fof_feed_title($r), ENT_QUOTES);
$title .=' - ' . $r['feed_title'];
} }
if(is_numeric($start)) if(is_numeric($start))
{ {
if(!is_numeric($limit)) $limit = $prefs["howmany"]; if(!is_numeric($limit)) $limit = $prefs["howmany"];
$title .= " - items $start to " . ($start + $limit); $title .= " - items $start to " . ($start + $limit);
} }
if($what != "all") if($what != "all")
{ {
$title .=' - new items'; $wh = array();
$new = '';
foreach(explode(',', $what) as $t)
{
if ($t == 'unread')
$new = ' new';
else
$wh[] = $t;
}
$title .= ' -' . $new . ' items';
if (count($wh))
$title .= ' tagged '.implode(',', $wh);
} }
else else
{
$title .= ' - all items'; $title .= ' - all items';
}
if(isset($search)) if(isset($search))
{ {
@ -464,13 +488,11 @@ function fof_get_items($user_id, $feed=NULL, $what="unread", $when=NULL, $start=
global $fof_item_filters; global $fof_item_filters;
$items = fof_db_get_items($user_id, $feed, $what, $when, $start, $limit, $order, $search); $items = fof_db_get_items($user_id, $feed, $what, $when, $start, $limit, $order, $search);
for ($i = 0; $i < count($items); $i++)
for($i=0; $i<count($items); $i++)
{ {
foreach($fof_item_filters as $filter) foreach($fof_item_filters as $filter)
{
$items[$i]['item_content'] = $filter($items[$i]['item_content']); $items[$i]['item_content'] = $filter($items[$i]['item_content']);
} $items[$i]['feed_title'] = fof_feed_title($items[$i]);
} }
return $items; return $items;
@ -481,11 +503,9 @@ function fof_get_item($user_id, $item_id)
global $fof_item_filters; global $fof_item_filters;
$item = fof_db_get_item($user_id, $item_id); $item = fof_db_get_item($user_id, $item_id);
foreach($fof_item_filters as $filter) foreach($fof_item_filters as $filter)
{
$item['item_content'] = $filter($item['item_content']); $item['item_content'] = $filter($item['item_content']);
} $item['feed_title'] = fof_feed_title($item);
return $item; return $item;
} }
@ -518,13 +538,9 @@ function fof_get_nav_links($feed=NULL, $what="new", $when=NULL, $start=NULL, $li
if(!is_null($when) && $when != "") if(!is_null($when) && $when != "")
{ {
if($when == "today") if($when == "today")
{ $whendate = fof_todays_date();
$whendate = fof_todays_date();
}
else else
{ $whendate = $when;
$whendate = $when;
}
$begin = strtotime($whendate); $begin = strtotime($whendate);
@ -555,7 +571,7 @@ function fof_render_feed_link($row)
{ {
$link = $row['feed_link']; $link = $row['feed_link'];
$description = $row['feed_description']; $description = $row['feed_description'];
$title = $row['feed_title']; $title = htmlspecialchars(fof_feed_title($row), ENT_QUOTES);
$url = $row['feed_url']; $url = $row['feed_url'];
$s = "<b><a href=\"$link\" title=\"$description\">$title</a></b> "; $s = "<b><a href=\"$link\" title=\"$description\">$title</a></b> ";
@ -642,7 +658,7 @@ function fof_subscribe($user_id, $url, $unread="today")
return '<font color="green"><b>Subscribed.</b></font><!-- '.$feed['feed_id'].' --><br>'; return '<font color="green"><b>Subscribed.</b></font><!-- '.$feed['feed_id'].' --><br>';
} }
$id = fof_add_feed($url, $rss->get_title(), $rss->get_link(), $rss->get_description() ); $id = fof_add_feed($url, rss_feed_title($rss), $rss->get_link(), $rss->get_description() );
fof_update_feed($id); fof_update_feed($id);
fof_db_add_subscription($user_id, $id); fof_db_add_subscription($user_id, $id);
@ -737,6 +753,11 @@ function fof_apply_tags($item)
fof_mark_item_unread($item['feed_id'], $item['item_id'], $filtered); fof_mark_item_unread($item['feed_id'], $item['item_id'], $filtered);
} }
function rss_feed_title($rss)
{
return html_entity_decode(strip_tags($rss->get_title()), ENT_QUOTES);
}
function fof_update_feed($id) function fof_update_feed($id)
{ {
if(!$id) return 0; if(!$id) return 0;
@ -772,7 +793,7 @@ function fof_update_feed($id)
$image_cache_date = time(); $image_cache_date = time();
} }
$title = $rss->get_title(); $title = rss_feed_title($rss);
if($title == "") $title = "[no title]"; if($title == "") $title = "[no title]";
fof_db_feed_update_metadata($id, $sub, $title, $rss->get_link(), $rss->get_description(), $image, $image_cache_date ); fof_db_feed_update_metadata($id, $sub, $title, $rss->get_link(), $rss->get_description(), $image, $image_cache_date );

View File

@ -43,7 +43,6 @@ function do_highlight($full_body, $q, $class){
return $full_body_hl; return $full_body_hl;
} }
function fof_render_item($item) function fof_render_item($item)
{ {
$items = true; $items = true;
@ -93,7 +92,7 @@ function fof_render_item($item)
id="c<?php echo $item_id ?>" id="c<?php echo $item_id ?>"
value="checked" value="checked"
ondblclick='flag_upto("c<?php echo $item_id?>");' ondblclick='flag_upto("c<?php echo $item_id?>");'
onclick='return checkbox(event);' onclick='return checkbox(event);'
title='shift-click or double-click to flag all items up to this one' title='shift-click or double-click to flag all items up to this one'
/> />
</span> </span>
@ -163,21 +162,19 @@ function fof_render_item($item)
<h2> <h2>
<?php $prefs = fof_prefs(); if($feed_image && $prefs['favicons']) { ?> <?php $prefs = fof_prefs(); if($feed_image && $prefs['favicons']) { ?>
<a href="<?php echo $feed_link ?>" title='<?php echo $feed_description ?>'><img src="<?php echo $feed_image ?>" height="16" width="16" border="0" /></a> <a href="<?=htmlspecialchars($feed_link)?>" title="<?=htmlspecialchars($feed_description)?>"><img src="<?=$feed_image?>" height="16" width="16" border="0" /></a>
<?php } ?> <?php } ?>
<a href="<?php echo $feed_link ?>" title='<?php echo $feed_description ?>'><?php echo $feed_title ?></a> <a href="<?=htmlspecialchars($feed_link)?>" title="<?=htmlspecialchars($feed_description)?>"><?=htmlspecialchars($feed_title)?></a>
</h2> </h2>
<span class="meta">on <?php echo $item_published ?></span> <span class="meta">on <?php echo $item_published ?></span>
</div> </div>
<div class="body"><?php echo $item_content ?></div> <div class="body"><?php echo $item_content ?></div>
<?php <?php
$widgets = fof_get_widgets($item); $widgets = fof_get_widgets($item);
if($widgets) { if($widgets) {
?> ?>
@ -187,9 +184,7 @@ function fof_render_item($item)
<?php <?php
foreach($widgets as $widget) foreach($widgets as $widget)
{
echo "<span class='widget'>$widget</span> "; echo "<span class='widget'>$widget</span> ";
}
?> ?>
</div> </div>

View File

@ -100,25 +100,26 @@ p
padding: 2px; padding: 2px;
} }
.odd-row .odd-row
{ {
background: #dddddd; background: #dddddd;
} }
.feedprefs { margin-bottom: 8px; }
.feedprefs input.editbox { border-color: lightgray; border-width: 0 0 1px 0; border-style: solid; }
.odd-row input.editbox { border-width: 0; }
.unread .unread
{ {
font-weight: bold; font-weight: bold;
color: red; color: red;
} }
.unread-item .unread-item
{ {
font-weight: bold; font-weight: bold;
} }
#items #items
{ {
} }

10
fof.js
View File

@ -907,3 +907,13 @@ function ajaxadd()
continueadd(); continueadd();
} }
function show_filter(id)
{
var sp1 = document.getElementById('fspan'+id);
if (sp1)
sp1.style.display = '';
var sp2 = document.getElementById('ftspan'+id);
if (sp2)
sp2.style.display = 'none';
var a = document.getElementById('fa'+id);
}

View File

@ -23,19 +23,13 @@ fof_set_content_type();
function get_curl_version() function get_curl_version()
{ {
if (is_array($curl = curl_version())) if (is_array($curl = curl_version()))
{ $curl = $curl['version'];
$curl = $curl['version']; else if (preg_match('/curl\/(\S+)(\s|$)/', $curl, $match))
} $curl = $match[1];
else if (preg_match('/curl\/(\S+)(\s|$)/', $curl, $match)) else
{ $curl = 0;
$curl = $match[1]; return $curl;
}
else
{
$curl = 0;
}
return $curl;
} }
$php_ok = (function_exists('version_compare') && version_compare(phpversion(), '4.3.2', '>=')); $php_ok = (function_exists('version_compare') && version_compare(phpversion(), '4.3.2', '>='));
@ -52,54 +46,46 @@ $iconv_ok = extension_loaded('iconv');
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!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"> <html xmlns="http://www.w3.org/1999/xhtml">
<head><title>feed on feeds - installation</title> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>feed on feeds - installation</title>
<link rel="stylesheet" href="fof.css" media="screen" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="fof.js" type="text/javascript"></script> <link rel="stylesheet" href="fof.css" media="screen" />
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> <script src="fof.js" type="text/javascript"></script>
<style> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
body <style>
{ body
font-family: georgia; {
font-size: 16px; font-family: georgia;
} font-size: 16px;
}
div div
{ {
background: #eee; background: #eee;
border: 1px solid black; border: 1px solid black;
width: 75%; width: 75%;
margin: 5em auto; margin: 5em auto;
padding: 1.5em; padding: 1.5em;
} }
hr
hr {
{ height:0;
height:0; border:0;
border:0; border-top:1px solid #999;
border-top:1px solid #999; }
} .fail { color: red; }
.pass { color: green; }
.fail { color: red; } .warn { color: #a60; }
</style>
.pass { color: green; } </head>
.warn { color: #a60; }
</style>
</head>
<body><div> <center style="font-size: 20px;"><a href="http://feedonfeeds.com/">Feed on Feeds</a> - Installation</center><br>
<body><div><center style="font-size: 20px;"><a href="http://feedonfeeds.com/">Feed on Feeds</a> - Installation</center><br>
<?php <?php
if($_GET['password'] && $_GET['password'] == $_GET['password2'] ) if($_GET['password'] && $_GET['password'] == $_GET['password2'] )
{ {
$password_hash = md5($_GET['password'] . 'admin'); $password_hash = md5($_GET['password'] . 'admin');
fof_safe_query("insert into $FOF_USER_TABLE (user_id, user_name, user_password_hash, user_level) values (1, 'admin', '%s', 'admin')", $password_hash); fof_safe_query("insert into $FOF_USER_TABLE (user_id, user_name, user_password_hash, user_level) values (1, 'admin', '%s', 'admin')", $password_hash);
echo '<center><b>OK! Setup complete! <a href=".">Login as admin</a>, and start subscribing!</center></b></div></body></html>';
echo '<center><b>OK! Setup complete! <a href=".">Login as admin</a>, and start subscribing!</center></b></div></body></html>';
} }
else else
{ {
@ -107,7 +93,6 @@ else
{ {
echo '<center><font color="red">Passwords do not match!</font></center><br><br>'; echo '<center><font color="red">Passwords do not match!</font></center><br><br>';
} }
?> ?>
Checking compatibility... Checking compatibility...
@ -253,103 +238,67 @@ CREATE TABLE IF NOT EXISTS `$FOF_SUBSCRIPTION_TABLE` (
) ENGINE=InnoDB; ) ENGINE=InnoDB;
EOQ; EOQ;
foreach($tables as $table) foreach($tables as $table)
{ if(!fof_db_query($table, 1))
if(!fof_db_query($table, 1)) exit("Can't create table. MySQL says: <b>" . mysql_error() . "</b><br>");
{
exit ("Can't create table. MySQL says: <b>" . mysql_error() . "</b><br>" );
}
}
?> ?>
Tables exist.<hr> Tables exist.<hr>
Upgrading schema...
<?php <?php
$result = fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_image_cache_date'");
if(mysql_num_rows($result) == 0) if (!mysql_num_rows(fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_image_cache_date'")) &&
{ !fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_image_cache_date` INT( 11 ) DEFAULT '0' AFTER `feed_image`;"))
exit("Can't add column feed_image_cache_date to table $FOF_FEED_TABLE. MySQL says: <b>" . mysql_error() . "</b><br>");
print "Upgrading schema..."; if (!mysql_num_rows(fof_db_query("show columns from $FOF_USER_TABLE like 'user_password_hash'")) &&
(!fof_db_query("ALTER TABLE $FOF_USER_TABLE CHANGE `user_password` `user_password_hash` VARCHAR( 32 ) NOT NULL") ||
!fof_db_query("update $FOF_USER_TABLE set user_password_hash = md5(concat(user_password_hash, user_name))")))
exit("Can't change column user_password to user_password_hash. MySQL says: <b>" . mysql_error() . "</b><br>");
fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_image_cache_date` INT( 11 ) DEFAULT '0' AFTER `feed_image` ;"); if (!mysql_num_rows(fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_cache_attempt_date'")) &&
!fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_cache_attempt_date` INT( 11 ) DEFAULT '0' AFTER `feed_cache_date`;"))
exit("Can't add column feed_cache_attempt_date to table $FOF_FEED_TABLE. MySQL says: <b>" . mysql_error() . "</b><br>");
print "Done.<hr>";
}
?>
<?php
$result = fof_db_query("show columns from $FOF_USER_TABLE like 'user_password_hash'");
if(mysql_num_rows($result) == 0)
{
print "Upgrading schema...";
fof_db_query("ALTER TABLE $FOF_USER_TABLE CHANGE `user_password` `user_password_hash` VARCHAR( 32 ) NOT NULL");
fof_db_query("update $FOF_USER_TABLE set user_password_hash = md5(concat(user_password_hash, user_name))");
print "Done.<hr>";
}
?>
<?php
$result = fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_cache_attempt_date'");
if(mysql_num_rows($result) == 0)
{
print "Upgrading schema...";
fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_cache_attempt_date` INT( 11 ) DEFAULT '0' AFTER `feed_cache_date` ;");
print "Done.<hr>";
}
?> ?>
Schema up to date.<hr>
Inserting initial data... Inserting initial data...
<?php <?php
fof_db_query("insert into $FOF_TAG_TABLE (tag_id, tag_name) values (1, 'unread')", 1); fof_db_query("insert into $FOF_TAG_TABLE (tag_id, tag_name) values (1, 'unread')", 1);
fof_db_query("insert into $FOF_TAG_TABLE (tag_id, tag_name) values (2, 'star')", 1); fof_db_query("insert into $FOF_TAG_TABLE (tag_id, tag_name) values (2, 'star')", 1);
?> ?>
Done.<hr> Done.<hr>
Checking cache directory... Checking cache directory...
<?php <?php
if ( ! file_exists( "cache" ) ) if (!file_exists("cache"))
{ {
$status = @mkdir( "cache", 0755 ); $status = @mkdir("cache", 0755);
if (!$status)
if ( ! $status ) {
{ echo "<font color='red'>Can't create directory <code>" . getcwd() . "/cache/</code>.<br>You will need to create it yourself, and make it writeable by your PHP process.<br>Then, reload this page.</font>";
echo "<font color='red'>Can't create directory <code>" . getcwd() . "/cache/</code>.<br>You will need to create it yourself, and make it writeable by your PHP process.<br>Then, reload this page.</font>"; echo "</div></body></html>";
echo "</div></body></html>";
exit; exit;
} }
} }
if(!is_writable( "cache" )) if(!is_writable("cache"))
{ {
echo "<font color='red'>The directory <code>" . getcwd() . "/cache/</code> exists, but is not writable.<br>You will need to make it writeable by your PHP process.<br>Then, reload this page.</font>"; echo "<font color='red'>The directory <code>" . getcwd() . "/cache/</code> exists, but is not writable.<br>You will need to make it writeable by your PHP process.<br>Then, reload this page.</font>";
echo "</div></body></html>"; echo "</div></body></html>";
exit; exit;
} }
?> ?>
Cache directory exists and is writable.<hr> Cache directory exists and is writable.<hr>
<?php <?php
$result = fof_db_query("select * from $FOF_USER_TABLE where user_name = 'admin'"); $result = fof_db_query("select * from $FOF_USER_TABLE where user_name = 'admin'");
if(mysql_num_rows($result) == 0) { if(mysql_num_rows($result) == 0) {
?> ?>
You now need to choose an initial password for the 'admin' account:<br> You now need to choose an initial password for the 'admin' account:<br>
<form> <form>

View File

@ -16,29 +16,19 @@ include_once("fof-main.php");
include_once("fof-render.php"); include_once("fof-render.php");
if($_GET['how'] == 'paged' && !isset($_GET['which'])) if($_GET['how'] == 'paged' && !isset($_GET['which']))
{
$which = 0; $which = 0;
}
else else
{
$which = $_GET['which']; $which = $_GET['which'];
}
$order = $_GET['order']; $order = $_GET['order'];
if(!isset($_GET['what'])) if(!isset($_GET['what']))
{ $what = "unread";
$what = "unread";
}
else else
{ $what = $_GET['what'];
$what = $_GET['what'];
}
if(!isset($_GET['order'])) if(!isset($_GET['order']))
{
$order = $fof_prefs_obj->get("order"); $order = $fof_prefs_obj->get("order");
}
$how = $_GET['how']; $how = $_GET['how'];
$feed = $_GET['feed']; $feed = $_GET['feed'];
@ -89,8 +79,6 @@ $noedit = $_GET['noedit'];
<li><a href="javascript:hide_all()">Hide all</a></li> <li><a href="javascript:hide_all()">Hide all</a></li>
</ul> </ul>
<!-- close this form to fix first item! --> <!-- close this form to fix first item! -->
<form id="itemform" name="items" action="view-action.php" method="post" onSubmit="return false;"> <form id="itemform" name="items" action="view-action.php" method="post" onSubmit="return false;">
@ -98,16 +86,11 @@ $noedit = $_GET['noedit'];
<input type="hidden" name="return" /> <input type="hidden" name="return" />
<?php <?php
$links = fof_get_nav_links($_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany']); $links = fof_get_nav_links($_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany']);
if($links)
{
?>
<center><?php echo $links ?></center>
<?php
}
if($links) { ?>
<center><?php echo $links ?></center><?php
}
$result = fof_get_items(fof_current_user(), $_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany'], $order, $_GET['search']); $result = fof_get_items(fof_current_user(), $_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany'], $order, $_GET['search']);
@ -118,7 +101,7 @@ foreach($result as $row)
$item_id = $row['item_id']; $item_id = $row['item_id'];
if($first) print "<script>firstItem = 'i$item_id'; </script>"; if($first) print "<script>firstItem = 'i$item_id'; </script>";
$first = false; $first = false;
print '<div class="item shown" id="i' . $item_id . '" onclick="return itemClicked(event)">'; print '<div class="item '.($row['prefs']['hide_content'] ? 'hidden' : 'shown').'" id="i' . $item_id . '" onclick="return itemClicked(event)">';
fof_render_item($row); fof_render_item($row);
print '</div>'; print '</div>';
} }
@ -128,6 +111,9 @@ if(count($result) == 0)
echo "<p><i>No items found.</i></p>"; echo "<p><i>No items found.</i></p>";
} }
if($links) { ?>
<center><?php echo $links ?></center><?php
}
?> ?>
</form> </form>

View File

@ -28,21 +28,20 @@ $result = fof_db_get_subscriptions(fof_current_user());
while($row = fof_db_get_row($result)) while($row = fof_db_get_row($result))
{ {
$url = htmlspecialchars($row['feed_url']); $url = htmlspecialchars($row['feed_url']);
$title = htmlspecialchars($row['feed_title']); $row['prefs'] = unserialize($row['subscription_prefs']);
$link = htmlspecialchars($row['feed_link']); $title = htmlspecialchars(fof_feed_title($row));
$link = htmlspecialchars($row['feed_link']);
echo <<<HEYO
<outline type="rss"
text="$title"
title="$title"
htmlUrl="$link"
xmlUrl="$url"
/>
echo <<<HEYO
<outline type="rss"
text="$title"
title="$title"
htmlUrl="$link"
xmlUrl="$url"
/>
HEYO; HEYO;
} }
?> ?>
</body> </body>
</opml> </opml>

122
prefs.php
View File

@ -33,46 +33,67 @@ if(isset($_POST['adminprefs']))
} }
} }
if(isset($_REQUEST['tagfeeds'])) if (isset($_REQUEST['tagfeeds']))
{ {
$allow_prop = array('untag' => 1, 'tag' => 1, 'filter' => 1, 'title' => 1, 'hide' => 1, 'orighide' => 1);
foreach ($_REQUEST as $k => $v) foreach ($_REQUEST as $k => $v)
{ {
list($prop, $feed_id) = explode('_', $k);
if (!$allow_prop[$prop])
continue;
if (!($feed = fof_db_get_feed_by_id($feed_id)))
continue;
// remove tags // remove tags
if (substr($k, 0, 5) == 'untag') if ($prop == 'untag')
{ {
$feed_id = substr($k, 5); foreach ($v as $tag)
if ($feed = fof_db_get_feed_by_id($feed_id))
{ {
foreach ($v as $tag) fof_untag_feed(fof_current_user(), $feed_id, $tag);
{ $message[] = 'Dropped \''.$tag.'\' from \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\'';
fof_untag_feed(fof_current_user(), $feed_id, $tag);
$message[] = 'Dropped \''.$tag.'\' from \''.$feed['feed_title'].'\'';
}
} }
} }
// add tags // add tags
else if (substr($k, 0, 3) == 'tag') else if ($prop == 'tag')
{ {
$feed_id = substr($k, 3); foreach (preg_split("/[\s,]*,[\s,]*/", $v) as $tag)
if ($feed = fof_db_get_feed_by_id($feed_id))
{ {
foreach (preg_split("/[\s,]*,[\s,]*/", $v) as $tag) if ($tag)
{ {
if ($tag) fof_tag_feed(fof_current_user(), $feed_id, $tag);
{ $message[] = 'Tagged \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' as '.htmlspecialchars($tag);
fof_tag_feed(fof_current_user(), $feed_id, $tag);
$message[] = 'Tagged \''.$feed['feed_title'].'\' as '.$tag;
}
} }
} }
} }
// change filter // change filter
else if (substr($k, 0, 6) == 'filter') else if ($prop == 'filter')
{ {
$feed_id = substr($k, 6); if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'filter', $v))
if (($feed = fof_db_get_feed_by_id($feed_id)) && $message[] = 'Set filter \''.htmlspecialchars($v).'\' for feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\'';
fof_db_set_feed_filter(fof_current_user(), $feed_id, $v)) }
$message[] = 'Set filter \''.$v.'\' for feed \''.$feed['feed_title'].'\''; // rename feed
else if ($prop == 'title' && $v != $_POST['origtitle_'.$feed_id])
{
if ($feed['feed_title'] == $v)
$v = '';
if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'feed_title', $v))
{
if ($v)
$message[] = 'Renamed feed \''.htmlspecialchars($feed['feed_title']).'\' to \''.htmlspecialchars($v).'\'';
else
$message[] = 'Feed title resetted for \''.htmlspecialchars($feed['feed_title']).'\'';
}
}
// show item content by default
else if ($prop == 'hide' && $v && !$_POST['orighide_'.$feed_id])
{
if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'hide_content', true))
$message[] = 'Items of feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' will be shown collapsed by default';
}
// hide item content by default
else if ($prop == 'orighide' && $v && !$_POST['hide_'.$feed_id])
{
if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'hide_content', false))
$message[] = 'Items of feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' will be shown expanded by default';
} }
} }
} }
@ -96,7 +117,7 @@ if(isset($_POST['prefs']))
if($_POST['password'] && ($_POST['password'] == $_POST['password2'])) if($_POST['password'] && ($_POST['password'] == $_POST['password2']))
{ {
fof_db_change_password($fof_user_name, $_POST['password']); fof_db_change_password($fof_user_name, $_POST['password']);
setcookie ( "user_password_hash", md5($_POST['password'] . $fof_user_name), time()+60*60*24*365*10 ); setcookie ("user_password_hash", md5($_POST['password'] . $fof_user_name), time()+60*60*24*365*10);
$message = "Updated password."; $message = "Updated password.";
} }
else if($_POST['password'] || $_POST['password2']) else if($_POST['password'] || $_POST['password2'])
@ -118,19 +139,13 @@ if(isset($_POST['plugins']))
$plugins = array(); $plugins = array();
$dirlist = opendir(FOF_DIR . "/plugins"); $dirlist = opendir(FOF_DIR . "/plugins");
while($file=readdir($dirlist)) while($file=readdir($dirlist))
{
if(ereg('\.php$',$file)) if(ereg('\.php$',$file))
{ $plugins[] = substr($file, 0, -4);
$plugins[] = substr($file, 0, -4);
}
}
closedir(); closedir();
foreach($plugins as $plugin) foreach($plugins as $plugin)
{
$prefs->set("plugin_" . $plugin, $_POST[$plugin] != "on"); $prefs->set("plugin_" . $plugin, $_POST[$plugin] != "on");
}
$prefs->save(fof_current_user()); $prefs->save(fof_current_user());
@ -224,7 +239,7 @@ URL to be linked on shared page: <input type=string name=sharedurl value="<?php
?> ?>
<?php foreach($plugins as $plugin) { ?> <?php foreach($plugins as $plugin) { ?>
<input type=checkbox name="<?php echo $plugin ?>" <?php if(!$prefs->get("plugin_" . $plugin)) echo "checked"; ?>> Enable plugin <tt><?php echo $plugin?></tt>?<br> <input type="checkbox" name="<?php echo $plugin ?>" <?php if(!$prefs->get("plugin_" . $plugin)) echo "checked"; ?>> Enable plugin <tt><?php echo $plugin?></tt>?<br>
<?php } ?> <?php } ?>
<br> <br>
@ -241,16 +256,24 @@ URL to be linked on shared page: <input type=string name=sharedurl value="<?php
</form> </form>
<br><h1>Feed on Feeds - Feeds, Tags and Filters</h1> <br><h1>Feed on Feeds - Feeds, Tags and Filters</h1>
<p style="font-size: 90%"><font color=red>*</font> Check 'Hide' if you want to hide contents of items of the corresponding feed by default.<br />
Click 'Filter' and enter a regular expression to filter out items matching it directly into "already read" state.<br />
Don't forget to Save preferences after making changes :-)</p>
<div style="border: 1px solid black; margin: 10px; padding: 10px; font-size: 12px; font-family: verdana, arial;"> <div style="border: 1px solid black; margin: 10px; padding: 10px; font-size: 12px; font-family: verdana, arial;">
<form method="post" action="?tagfeeds=1"> <form method="post" action="?tagfeeds=1">
<table cellpadding=3 cellspacing=0> <table cellpadding="3" cellspacing="0" class="feedprefs">
<tr><th colspan="2" align="left">Feed</th><th>Remove tags</th><th>Add tags</th><th>Item filter regexp</th></tr> <tr valign="top">
<th colspan="2" align="left">Feed</th>
<th>Remove tags</th>
<th>Add tags<br><small style='font-weight: normal'>(separate with ,)</small></th>
<th>Preferences</th>
</tr>
<?php <?php
foreach($feeds as $row) foreach($feeds as $row)
{ {
$id = $row['feed_id']; $id = $row['feed_id'];
$url = $row['feed_url']; $url = $row['feed_url'];
$title = $row['feed_title']; $title = fof_feed_title($row);
$link = $row['feed_link']; $link = $row['feed_link'];
$description = $row['feed_description']; $description = $row['feed_description'];
$age = $row['feed_age']; $age = $row['feed_age'];
@ -264,21 +287,17 @@ foreach($feeds as $row)
$tags = $row['tags']; $tags = $row['tags'];
if(++$t % 2) if(++$t % 2)
{
print '<tr class="odd-row">'; print '<tr class="odd-row">';
}
else else
{
print '<tr>'; print '<tr>';
}
if($row['feed_image'] && $prefs->get('favicons')) { ?> if($row['feed_image'] && $prefs->get('favicons')) { ?>
<td><a href="<?=$url?>" title="feed"><img src='<?=$row['feed_image']?>' width='16' height='16' border='0' /></a></td> <td><a href="<?=$url?>" title="<?=htmlspecialchars($row['feed_title'])?>"><img src='<?=$row['feed_image']?>' width='16' height='16' border='0' /></a></td>
<? } else { ?> <? } else { ?>
<td><a href="<?=$url?>" title="feed"><img src='image/feed-icon.png' width='16' height='16' border='0' /></a></td> <td><a href="<?=$url?>" title="<?=htmlspecialchars($row['feed_title'])?>"><img src='image/feed-icon.png' width='16' height='16' border='0' /></a></td>
<? } ?> <? } ?>
<td><a href="<?=$link?>" title="home page"><?=$title?></a></td> <td><input type="hidden" name="origtitle_<?=$id?>" value="<?=htmlspecialchars($title)?>" /><input class="editbox" type="text" name="title_<?=$id?>" value="<?=htmlspecialchars($title)?>" size="50" /> <a href="<?=$link?>" title="home page"><img src="image/external.png" alt=" " width="10" height="10" /></a</td>
<td align=right> <td align=right>
<? <?
@ -288,17 +307,24 @@ foreach($feeds as $row)
foreach($tags as $tag) foreach($tags as $tag)
{ {
$utag = htmlspecialchars($tag); $utag = htmlspecialchars($tag);
print "<span id='t{$id}_{$i}'>$tag</span> <input onclick='document.getElementById(\"t{$id}_{$i}\").style.textDecoration=this.checked ? \"line-through\" : \"\"' type='checkbox' name='untag{$id}[]' value='$utag'>"; print "<span id='t{$id}_{$i}'>$tag</span> <input onclick='document.getElementById(\"t{$id}_{$i}\").style.textDecoration=this.checked ? \"line-through\" : \"\"' type='checkbox' name='untag_{$id}[]' value='$utag'>";
$i++; $i++;
} }
} }
$flt = htmlspecialchars($row['prefs']['filter']);
print "</td>"; ?>
$title = htmlspecialchars($title);?> </td>
<td><input type=hidden name=title value="<?=$title?>"><input type="text" name="tag<?=$id?>" /> <small><i>(separate tags with commas)</i></small></td><td><input type="text" name="filter<?=$id?>" value="<?=htmlspecialchars($row['prefs']['filter'])?>" /></td></tr> <td><input class="editbox" type="text" name="tag_<?=$id?>" /></td>
<td>
<input type="hidden" name="orighide_<?=$id?>" value="<?=$row['prefs']['hide_content'] ? 1 : 0?>" />
<input type="checkbox" value="1" name="hide_<?=$id?>" title="Hide item content by default" <?=$row['prefs']['hide_content'] ? "checked" : ""?> /><label for="hide_<?=$id?>" title="Hide item content by default">Hide</label> |
<span id="fspan<?=$id?>" style="display:none">Filter: <input class="editbox" type="text" name="filter_<?=$id?>" value="<?=$flt?>" /></span>
<span id="ftspan<?=$id?>"><a id="fa<?=$id?>" href="javascript:show_filter('<?=$id?>')">Filter</a><?=$flt ? ": $flt" : ""?></span>
</td>
</tr>
<? } ?> <? } ?>
</table> </table>
<input type="submit" value="Update tags and filters"> <input type="submit" value="Update tags and filters" />
</form> </form>
</div> </div>

View File

@ -40,13 +40,12 @@ $feed = NULL;
if(isset($_GET['feed'])) if(isset($_GET['feed']))
{ {
$feed = $_GET['feed']; $feed = $_GET['feed'];
$r = fof_db_get_feed_by_id($feed); $r = fof_db_get_feed_by_id($feed, fof_current_user());
$extratitle .= " from <a href='" . $r['feed_link'] . "'>" . $r['feed_title'] . "</a>"; $extratitle .= ' from <a href="' . htmlspecialchars($r['feed_link']) . '">' . htmlspecialchars(fof_feed_title($r)) . '</a>';
} }
$result = fof_get_items($user, $feed, $which, NULL, 0, 100); $result = fof_get_items($user, $feed, $which, NULL, 0, 100);
$shared_feed = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?user=$user&format=atom"; $shared_feed = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?user=$user&format=atom";
$shared_link = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?user=$user"; $shared_link = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?user=$user";
@ -62,7 +61,6 @@ if(isset($_GET['feed']))
$shared_link .= '&feed=' . $_GET['feed']; $shared_link .= '&feed=' . $_GET['feed'];
} }
if($format == "atom") if($format == "atom")
{ {
header("Content-Type: application/atom+xml; charset=utf-8"); header("Content-Type: application/atom+xml; charset=utf-8");
@ -84,7 +82,7 @@ foreach($result as $item)
{ {
$feed_link = htmlspecialchars($item['feed_link']); $feed_link = htmlspecialchars($item['feed_link']);
$feed_url = htmlspecialchars(preg_replace('!^([a-z0-9_]+)://[^/]*:[^/]*@!is', '\1://', $item['feed_url'])); $feed_url = htmlspecialchars(preg_replace('!^([a-z0-9_]+)://[^/]*:[^/]*@!is', '\1://', $item['feed_url']));
$feed_title = htmlspecialchars($item['feed_title']); $feed_title = htmlspecialchars(fof_feed_title($item));
$item_link = htmlspecialchars($item['item_link']); $item_link = htmlspecialchars($item['item_link']);
@ -170,7 +168,7 @@ foreach($result as $item)
print '<div class="item shown" id="i' . $item_id . '">'; print '<div class="item shown" id="i' . $item_id . '">';
$feed_link = $item['feed_link']; $feed_link = $item['feed_link'];
$feed_title = $item['feed_title']; $feed_title = fof_feed_title($item);
$feed_image = $item['feed_image']; $feed_image = $item['feed_image'];
$feed_description = $item['feed_description']; $feed_description = $item['feed_description'];
@ -189,28 +187,24 @@ foreach($result as $item)
?> ?>
<div class="header"> <div class="header">
<h1> <h1>
<a href="<?php echo $item_link ?>"> <a href="<?php echo $item_link ?>">
<?php echo $item_title ?> <?php echo $item_title ?>
</a> </a>
</h1> </h1>
<span class='dash'> - </span> <span class='dash'> - </span>
<h2> <h2>
<a href="<?php echo $feed_link ?>" title='<?php echo $feed_description ?>'><img src="<?php echo $feed_image ?>" height="16" width="16" border="0" /></a> <a href="<?=htmlspecialchars($feed_link)?>" title="<?=htmlspecialchars($feed_description)?>"><img src="<?=htmlspecialchars($feed_image)?>" height="16" width="16" border="0" /></a>
<a href="<?php echo $feed_link ?>" title='<?php echo $feed_description ?>'><?php echo $feed_title ?></a> <a href="<?=htmlspecialchars($feed_link)?>" title="<?=htmlspecialchars($feed_description)?>"><?=htmlspecialchars($feed_title)?></a>
</h2> </h2>
<span class="meta">on <?php echo $item_published ?> GMT</span> <span class="meta">on <?php echo $item_published ?> GMT</span>
</div> </div>
<div class="body"><?php echo $item_content ?></div> <div class="body"><?php echo $item_content ?></div>
<div class="clearer"></div> <div class="clearer"></div>

View File

@ -115,32 +115,26 @@ if($n)
<?php <?php
foreach($tags as $tag) foreach($tags as $tag)
{ {
$tag_name = $tag['tag_name']; $tag_name = $tag['tag_name'];
$tag_id = $tag['tag_id']; $tag_id = $tag['tag_id'];
$count = $tag['count']; $count = $tag['count'];
$unread = $tag['unread']; $unread = $tag['unread'];
if($tag_id == 1 || $tag_id == 2) continue; if($tag_id == 1 || $tag_id == 2) continue;
if(++$t % 2) if(++$t % 2)
{ print "<tr class=\"odd-row\">";
print "<tr class=\"odd-row\">"; else
} print "<tr>";
else
{
print "<tr>";
}
print "<td>"; print "<td>";
if($unread) print "<a class='unread' href='.?what=$tag_name,unread'>$unread</a>/"; if ($unread) print "<a class='unread' href='.?what=$tag_name,unread'>$unread</a>/";
print "<a href='.?what=$tag_name'>$count</a></td>"; print "<a href='.?what=$tag_name&how=paged'>$count</a></td>";
print "<td><b><a href='.?what=$tag_name'>$tag_name</a></b></td>"; print "<td><b><a href='.?what=$tag_name".($unread?",unread":"&how=paged")."'>$tag_name</a></b></td>";
print "<td><a href=\"#\" title=\"untag all items\" onclick=\"if(confirm('Untag all [$tag_name] items --are you SURE?')) { delete_tag('$tag_name'); return false; } else { return false; }\">[x]</a></td>"; print "<td><a href=\"#\" title=\"untag all items\" onclick=\"if(confirm('Untag all [$tag_name] items --are you SURE?')) { delete_tag('$tag_name'); return false; } else { return false; }\">[x]</a></td>";
print "</tr>"; print "</tr>";
} }
?> ?>
</table> </table>
@ -151,7 +145,6 @@ foreach($tags as $tag)
<?php } ?> <?php } ?>
<div id="feeds"> <div id="feeds">
<div id="feedlist"> <div id="feedlist">
@ -213,74 +206,63 @@ foreach (array("feed_age", "max_date", "feed_unread", "feed_url", "feed_title")
foreach($feeds as $row) foreach($feeds as $row)
{ {
$id = $row['feed_id']; $id = $row['feed_id'];
$url = $row['feed_url']; $url = $row['feed_url'];
$title = $row['feed_title']; $title = fof_feed_title($row);
$link = $row['feed_link']; $link = $row['feed_link'];
$description = $row['feed_description']; $description = $row['feed_description'];
$age = $row['feed_age']; $age = $row['feed_age'];
$unread = $row['feed_unread']; $unread = $row['feed_unread'];
$starred = $row['feed_starred']; $starred = $row['feed_starred'];
$items = $row['feed_items']; $items = $row['feed_items'];
$agestr = $row['agestr']; $agestr = $row['agestr'];
$agestrabbr = $row['agestrabbr']; $agestrabbr = $row['agestrabbr'];
$lateststr = $row['lateststr']; $lateststr = $row['lateststr'];
$lateststrabbr = $row['lateststrabbr']; $lateststrabbr = $row['lateststrabbr'];
if(++$t % 2)
print "<tr class=\"odd-row\">";
else
print "<tr>";
if(++$t % 2) $u = ".?feed=$id";
{ $u2 = ".?feed=$id&amp;what=all&amp;how=paged";
print "<tr class=\"odd-row\">";
}
else
{
print "<tr>";
}
$u = ".?feed=$id"; print "<td><span title=\"$agestr\" id=\"${id}-agestr\">$agestrabbr</span></td>";
$u2 = ".?feed=$id&amp;what=all&amp;how=paged";
print "<td><span title=\"$agestr\" id=\"${id}-agestr\">$agestrabbr</span></td>"; print "<td><span title=\"$lateststr\" id=\"${id}-lateststr\">$lateststrabbr</span></td>";
print "<td><span title=\"$lateststr\" id=\"${id}-lateststr\">$lateststrabbr</span></td>"; print "<td class=\"nowrap\" id=\"${id}-items\">";
print "<td class=\"nowrap\" id=\"${id}-items\">"; if($unread)
print "<a class=\"unread\" title=\"new items\" href=\"$u\">$unread</a>/";
if($unread) print "<a href=\"$u2\" title=\"all items\">$items</a>";
{
print "<a class=\"unread\" title=\"new items\" href=\"$u\">$unread</a>/";
}
print "<a href=\"$u2\" title=\"all items\">$items</a>"; print "</td>";
print "</td>"; print "<td align='center'>";
if($row['feed_image'] && $fof_prefs_obj->get('favicons'))
print "<a href=\"$url\" title=\"feed\"><img src='" . $row['feed_image'] . "' width='16' height='16' border='0' /></a>";
else
print "<a href=\"$url\" title=\"feed\"><img src='image/feed-icon.png' width='16' height='16' border='0' /></a>";
print "</td>";
print "<td align='center'>"; print "<td>";
if($row['feed_image'] && $fof_prefs_obj->get('favicons')) print "<a href=\"".($unread ? $u : $u2)."\" title=\"".($unread ? "unread" : "all")." items\"><b>".htmlspecialchars($title)."</b></a>";
{ if ($link)
print "<a href=\"$url\" title=\"feed\"><img src='" . $row['feed_image'] . "' width='16' height='16' border='0' /></a>"; print " <a href=\"$link\" title=\"home page\"><img style='border-width: 0px' src='image/external.png' /></a>";
} print "</td>";
else print "<td><nobr>";
{
print "<a href=\"$url\" title=\"feed\"><img src='image/feed-icon.png' width='16' height='16' border='0' /></a>";
}
print "</td>";
print "<td>"; print "<a href=\"update.php?feed=$id\" title=\"update\">u</a>";
print "<a href=\"".($unread ? $u : $u2)."\" title=\"".($unread ? "unread" : "all")." items\"><b>$title</b></a>"; $stitle = addslashes($title);
if ($link) print " <a href=\"#\" title=\"mark all read\" onclick=\"if(confirm('Mark all [$stitle] items as read --are you SURE?')) { mark_feed_read($id); return false; } else { return false; }\">m</a>";
print " <a href=\"$link\" title=\"home page\"><img style='border-width: 0px' src='image/external.png' /></a>"; print " <a href=\"delete.php?feed=$id\" title=\"delete\" onclick=\"return confirm('Unsubscribe [$stitle] --are you SURE?')\">d</a>";
print "</td>";
print "<td><nobr>";
print "<a href=\"update.php?feed=$id\" title=\"update\">u</a>"; print "</nobr></td>";
$stitle = htmlspecialchars(addslashes($title));
print " <a href=\"#\" title=\"mark all read\" onclick=\"if(confirm('Mark all [$stitle] items as read --are you SURE?')) { mark_feed_read($id); return false; } else { return false; }\">m</a>";
print " <a href=\"delete.php?feed=$id\" title=\"delete\" onclick=\"return confirm('Unsubscribe [$stitle] --are you SURE?')\">d</a>";
print "</nobr></td>"; print "</tr>";
print "</tr>";
} }
?> ?>
@ -291,21 +273,15 @@ foreach($feeds as $row)
</div> </div>
<?php <?php
$order = $_GET['order']; $order = $_GET['order'];
$direction = $_GET['direction']; $direction = $_GET['direction'];
if(!isset($order)) if(!isset($order))
{ $order = "title";
$order = "title";
}
if(!isset($direction)) if(!isset($direction))
{ $direction = "asc";
$direction = "asc";
}
?> ?>

View File

@ -59,8 +59,8 @@ print("<script>\nwindow.onload = ajaxupdate;\nfeedslist = [");
foreach($feeds as $feed) foreach($feeds as $feed)
{ {
$title = $feed['feed_title']; $title = $feed['feed_title'];
$id = $feed['feed_id']; $id = $feed['feed_id'];
$feedjson[] = "{'id': $id, 'title': '" . addslashes($title) . "'}"; $feedjson[] = "{'id': $id, 'title': '" . addslashes($title) . "'}";
} }
@ -69,5 +69,5 @@ print(join($feedjson, ", "));
print("];\n</script>"); print("];\n</script>");
include("footer.php"); include("footer.php");
?>
?>