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()
{
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");
/* Может быть, проблемы из-за этого? */
/*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");*/
}
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;
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()
{
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)
@ -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);
if(mysql_num_rows($result) == 0)
{
if (mysql_num_rows($result) == 0)
return NULL;
}
$row = mysql_fetch_array($result);
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);
@ -349,7 +353,7 @@ function fof_db_get_items($user_id=1, $feed=NULL, $what="unread", $when=NULL, $s
}
$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 ";
$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))
{
$row['prefs'] = unserialize($row['subscription_prefs']);
$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);
}
function fof_db_set_feed_filter($user_id, $feed_id, $filter)
function fof_db_set_feedprop($user_id, $feed_id, $prop, $value)
{
$chg = false;
$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;
}
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;
}
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'];
$age = $row['feed_cache_date'];
$feeds[$i]['prefs'] = unserialize($row['subscription_prefs']);
$feeds[$i]['feed_id'] = $id;
$feeds[$i]['feed_url'] = $row['feed_url'];
$feeds[$i]['feed_title'] = $row['feed_title'];
$feeds[$i]['feed_link'] = $row['feed_link'];
$feeds[$i]['feed_description'] = $row['feed_description'];
$feeds[$i]['feed_image'] = $row['feed_image'];
$feeds[$i]['prefs'] = unserialize($row['subscription_prefs']);
$feeds[$i]['feed_age'] = $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;
}
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)
{
$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 != "")
{
$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 .=' - ' . $r['feed_title'];
$title .= ' - ' . htmlspecialchars(fof_feed_title($r), ENT_QUOTES);
}
if(is_numeric($start))
{
if(!is_numeric($limit)) $limit = $prefs["howmany"];
$title .= " - items $start to " . ($start + $limit);
}
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
{
$title .= ' - all items';
}
if(isset($search))
{
@ -464,13 +488,11 @@ function fof_get_items($user_id, $feed=NULL, $what="unread", $when=NULL, $start=
global $fof_item_filters;
$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)
{
$items[$i]['item_content'] = $filter($items[$i]['item_content']);
}
$items[$i]['feed_title'] = fof_feed_title($items[$i]);
}
return $items;
@ -481,11 +503,9 @@ function fof_get_item($user_id, $item_id)
global $fof_item_filters;
$item = fof_db_get_item($user_id, $item_id);
foreach($fof_item_filters as $filter)
{
$item['item_content'] = $filter($item['item_content']);
}
$item['feed_title'] = fof_feed_title($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($when == "today")
{
$whendate = fof_todays_date();
}
$whendate = fof_todays_date();
else
{
$whendate = $when;
}
$whendate = $when;
$begin = strtotime($whendate);
@ -555,7 +571,7 @@ function fof_render_feed_link($row)
{
$link = $row['feed_link'];
$description = $row['feed_description'];
$title = $row['feed_title'];
$title = htmlspecialchars(fof_feed_title($row), ENT_QUOTES);
$url = $row['feed_url'];
$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>';
}
$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_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);
}
function rss_feed_title($rss)
{
return html_entity_decode(strip_tags($rss->get_title()), ENT_QUOTES);
}
function fof_update_feed($id)
{
if(!$id) return 0;
@ -772,7 +793,7 @@ function fof_update_feed($id)
$image_cache_date = time();
}
$title = $rss->get_title();
$title = rss_feed_title($rss);
if($title == "") $title = "[no title]";
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;
}
function fof_render_item($item)
{
$items = true;
@ -93,7 +92,7 @@ function fof_render_item($item)
id="c<?php echo $item_id ?>"
value="checked"
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'
/>
</span>
@ -157,27 +156,25 @@ function fof_render_item($item)
</div>
</span>
<span class='dash'> - </span>
<h2>
<?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 } ?>
<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>
<span class="meta">on <?php echo $item_published ?></span>
<span class="meta">on <?php echo $item_published ?></span>
</div>
<div class="body"><?php echo $item_content ?></div>
<?php
$widgets = fof_get_widgets($item);
if($widgets) {
?>
@ -187,9 +184,7 @@ function fof_render_item($item)
<?php
foreach($widgets as $widget)
{
echo "<span class='widget'>$widget</span> ";
}
?>
</div>

View File

@ -100,25 +100,26 @@ p
padding: 2px;
}
.odd-row
{
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
{
font-weight: bold;
color: red;
}
.unread-item
{
font-weight: bold;
}
#items
{
}

246
fof.js
View File

@ -49,19 +49,19 @@ var getScrollY = function() {
var getY = function(e)
{
var y = NaN;
if (e.offsetParent) {
y = e.offsetTop
while (e = e.offsetParent) {
y += e.offsetTop
}
}
return y;
}
function getWindowHeight()
{
{
if( typeof( window.innerHeight ) == 'number' ) {
//Non-IE
return window.innerHeight;
@ -72,7 +72,7 @@ function getWindowHeight()
//IE 4 compatible
return document.body.clientHeight;
}
return NaN;
}
@ -103,13 +103,13 @@ function embed_wmedia(width, height, link) {
function itemClicked(event)
{
if(!event) event = window.event;
if(!event) event = window.event;
target = window.event ? window.event.srcElement : event.target;
if(event.altKey)
{
Event.stop(event);
unselect(itemElement);
while(target.parentNode)
{
@ -119,13 +119,13 @@ function itemClicked(event)
}
target = target.parentNode;
}
if(itemElement == target)
{
itemElement = null;
return false;
}
Element.addClassName(target, 'selected');
itemElement = target;
@ -144,43 +144,43 @@ function itemClicked(event)
document.title = "Feed on Feeds - " + i + " of " + n;
return false;
}
return true;
}
function checkbox(event)
{
if(!event) event = window.event;
if(!event) event = window.event;
target = window.event ? window.event.srcElement : event.target;
if(!event.shiftKey)
return true;
flag_upto(target.id);
return true;
}
function select(item)
{
Element.addClassName(item, 'selected');
y = getY(item);
bar = $('item-display-controls').getHeight();
window.scrollTo(0, y - (bar + 10));
i = itemElements.indexOf(item);
if(i == -1)
{
// in case page was partially loaded when itemElements was initialized
itemElements = $$('.item');
i = itemElements.indexOf(item);
}
n = itemElements.length;
i++;
document.title = "Feed on Feeds - " + i + " of " + n;
}
@ -193,20 +193,20 @@ function unselect(item)
function show_enclosure(e)
{
if (!e) e = window.event;
if (!e) e = window.event;
target = window.event ? window.event.srcElement : e.target;
Element.extend(target);
div = target.nextSiblings().first();
Element.show(div);
Element.hide(target);
return false;
}
function keyboard(e)
{
if (!e) e = window.event;
target = window.event ? window.event.srcElement : e.target;
if(target != null && target.type != null && (target.type == "textarea" || target.type=="text" || target.type=="password"))
@ -216,13 +216,13 @@ function keyboard(e)
if (e.keyCode) keycode=e.keyCode;
else keycode=e.which;
if(e.ctrlKey || e.altKey || e.metaKey) return true;
key = String.fromCharCode(keycode);
key = String.fromCharCode(keycode);
if(!itemElements) itemElements = $$('.item');
windowHeight = getWindowHeight();
if(key == "H")
@ -233,15 +233,15 @@ function keyboard(e)
Element.toggleClassName(i, "hidden");
}
);
if(itemElement)
select(itemElement);
return false;
}
if(key == "h")
{
{
if(itemElement)
{
Element.toggleClassName(itemElement, "shown");
@ -250,7 +250,7 @@ function keyboard(e)
return false;
}
}
if(key == "s")
{
if(itemElement)
@ -260,7 +260,7 @@ function keyboard(e)
return false;
}
}
if(key == "f")
{
if(itemElement)
@ -270,7 +270,7 @@ function keyboard(e)
return false;
}
}
if(key == "F")
{
itemElements.each(
@ -284,7 +284,7 @@ function keyboard(e)
checkbox.checked = true;
}
);
return false;
}
@ -296,7 +296,7 @@ function keyboard(e)
checkbox.checked = false;
}
);
return false;
}
@ -304,14 +304,14 @@ function keyboard(e)
{
if(itemElement)
{
// is the next element visible yet? scroll if not.
// is the next element visible yet? scroll if not.
if(itemElement.nextSibling.id && itemElement.nextSibling.id != "end-of-items")
{
nextElement = itemElement.nextSibling;
scrollHeight = getScrollY();
y = getY(nextElement);
if(y > scrollHeight + windowHeight)
{
window.scrollTo(0, scrollHeight + (.8 * windowHeight));
@ -324,7 +324,7 @@ function keyboard(e)
checkbox.checked = true;
next = itemElement.nextSibling;
if(next.id && next.id != "end-of-items")
{
itemElement = next;
@ -334,14 +334,14 @@ function keyboard(e)
scrollHeight = getScrollY();
e = $('end-of-items');
if (e.offsetParent) {
y = e.offsetTop
while (e = e.offsetParent) {
y += e.offsetTop
}
}
if(y - 10 > scrollHeight + windowHeight)
{
window.scrollTo(0, scrollHeight + (.8 * windowHeight));
@ -357,17 +357,17 @@ function keyboard(e)
{
item = firstItem;
itemElement = $(item);
select(itemElement);
select(itemElement);
return false;
}
}
}
item = itemElement.id;
itemElement = $(item);
select(itemElement);
return false;
}
else
@ -375,13 +375,13 @@ function keyboard(e)
item = firstItem;
itemElement = $(item);
itemElements = $$('.item');
select(itemElement);
return false;
}
}
if(key == "J")
{
if(itemElement)
@ -391,7 +391,7 @@ function keyboard(e)
checkbox.checked = true;
next = itemElement.nextSibling;
if(next.id)
{
itemElement = next;
@ -408,12 +408,12 @@ function keyboard(e)
itemElement = $(item);
}
}
item = itemElement.id;
itemElement = $(item);
select(itemElement);
return false;
}
else
@ -421,9 +421,9 @@ function keyboard(e)
item = firstItem;
itemElement = $(item);
itemElements = $$('.item');
select(itemElement);
return false;
}
}
@ -433,9 +433,9 @@ function keyboard(e)
if(itemElement)
{
unselect(itemElement);
next = itemElement.nextSibling;
if(next.id)
{
itemElement = next;
@ -445,12 +445,12 @@ function keyboard(e)
item = firstItem;
itemElement = $(item);
}
item = itemElement.id;
itemElement = $(item);
select(itemElement);
return false;
}
else
@ -458,25 +458,25 @@ function keyboard(e)
item = firstItem;
itemElement = $(item);
itemElements = $$('.item');
select(itemElement);
return false;
}
}
if(key == "N")
{
if(itemElement) unselect(itemElement);
item = itemElements.last().id;
itemElement = $(item);
select(itemElement);
return false;
}
if(key == "P")
{
if(itemElement) unselect(itemElement);
@ -484,20 +484,20 @@ function keyboard(e)
item = firstItem;
itemElement = $(item);
itemElements = $$('.item');
select(itemElement);
return false;
}
if(key == "p")
{
if(itemElement)
{
unselect(itemElement);
next = itemElement.previousSibling;
if(next.id)
{
itemElement = next;
@ -507,12 +507,12 @@ function keyboard(e)
item = itemElements.last().id;
itemElement = $(item);
}
item = itemElement.id;
itemElement = $(item);
select(itemElement);
return false;
}
else
@ -520,13 +520,13 @@ function keyboard(e)
itemElements = $$('.item');
item = itemElements.last().id;
itemElement = $(item);
select(itemElement);
return false;
}
}
return true;
}
@ -535,9 +535,9 @@ function keyboard(e)
function startResize(e)
{
if (!e) e = window.event;
Event.stop(e);
drag = true;
curPos=e.clientX;
curWidth=$('sidebar').offsetWidth;
@ -548,16 +548,16 @@ function startResize(e)
function dragResize(e)
{
if (!e) e = window.event;
if(drag)
{
Event.stop(e);
newPos=e.clientX;
var x=newPos-curPos;
var w=curWidth+x;
newWidth=(w<5?5:w);
$('handle').style.left=newWidth+'px';
return false;
@ -571,14 +571,14 @@ function completeDrag(e)
if(drag)
{
Event.stop(e);
drag = false;
newPos=e.clientX;
var x=newPos-curPos;
var w=curWidth+x;
newWidth=(w<5?5:w);
$('sidebar').style.width=newWidth+'px';
$('handle').style.left=newWidth+'px';
$('items').style.marginLeft=(newWidth+20)+'px';
@ -590,15 +590,15 @@ function completeDrag(e)
for(i=0;i<tables.length;i++){
tables[i].style.width=(newWidth-20)+'px';
}
}
}
var today = new Date();
var expire = new Date();
expire.setTime(today.getTime() + 3600000*24*100);
document.cookie = "fof_sidebar_width="+newWidth+ "; expires="+expire.toGMTString()+";";
return false;
}
}
function hide_all()
@ -626,11 +626,11 @@ function show_body(id)
function flag_upto(id)
{
elements = $A(Form.getInputs('itemform', 'checkbox'));
for(i=0; i<elements.length; i++)
{
elements[i].checked = true;
if(elements[i].name == id)
{
break;
@ -652,7 +652,7 @@ function toggle_highlight()
function flag_all()
{
elements = $A(Form.getInputs('itemform', 'checkbox'));
elements = $A(Form.getInputs('itemform', 'checkbox'));
elements.each( function(e) { e.checked = true; });
}
@ -687,70 +687,70 @@ function mark_unread()
function mark_feed_read(id)
{
throb();
var url = "view-action.php";
var params = "feed=" + id;
var complete = function () { refreshlist(); };
var options = { method: 'post', parameters: params, onComplete: complete };
new Ajax.Request(url, options);
return false;
}
function add_tag(id, tag)
{
throb();
var url = "add-tag.php";
var params = "tag=" + tag + "&item=" + id;
var complete = function () { refreshlist(); refreshitem(id); };
var options = { method: 'get', parameters: params, onComplete: complete };
new Ajax.Request(url, options);
return false;
}
function remove_tag(id, tag)
{
throb();
var url = "add-tag.php";
var params = "remove=true&tag=" + tag + "&item=" + id;
var complete = function () { refreshlist(); refreshitem(id); };
var options = { method: 'get', parameters: params, onComplete: complete };
new Ajax.Request(url, options);
return false;
}
function delete_tag(tag)
{
throb();
var url = "view-action.php";
var params = "deltag=" + tag;
var complete = function () { refreshlist(); };
var options = { method: 'get', parameters: params, onComplete: complete };
new Ajax.Request(url, options);
return false;
}
function change_feed_order(order, direction)
{
throb();
var url = "set-prefs.php";
var params = "feed_order=" + order + "&feed_direction=" + direction;
var complete = function () { refreshlist(); };
var options = { method: 'post', parameters: params, onComplete: complete };
new Ajax.Request(url, options);
return false;
}
@ -758,13 +758,13 @@ function change_feed_order(order, direction)
function toggle_favorite(id)
{
throb();
var image = $('fav' + id);
var image = $('fav' + id);
var url = "add-tag.php?tag=star";
var params = "&item=" + id;
image.src = 'image/star-pending.gif';
if(image.star)
{
params += "&remove=true";
@ -802,17 +802,17 @@ function toggle_favorite(id)
unthrob();
};
}
var options = { method: 'get', parameters: params, onComplete: complete };
var options = { method: 'get', parameters: params, onComplete: complete };
new Ajax.Request(url, options);
return false;
}
function refreshitem(id)
{
throb();
var url = 'item.php';
var params = 'id=' + id;
new Ajax.Updater($("i"+id), url, {method: 'get', parameters: params });
@ -822,10 +822,10 @@ function refreshitem(id)
function refreshlist()
{
throb();
var url = 'sidebar.php';
var params = "what=" + what + "&when=" + when;
new Ajax.Updater($('sidebar'), url, {method: 'get', parameters: params, evalScripts: true });
}
@ -869,7 +869,7 @@ function continueupdate()
}
function continueadd()
{
{
if(feed = feedi())
{
f = feed();
@ -907,3 +907,13 @@ function ajaxadd()
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()
{
if (is_array($curl = curl_version()))
{
$curl = $curl['version'];
}
else if (preg_match('/curl\/(\S+)(\s|$)/', $curl, $match))
{
$curl = $match[1];
}
else
{
$curl = 0;
}
return $curl;
if (is_array($curl = curl_version()))
$curl = $curl['version'];
else if (preg_match('/curl\/(\S+)(\s|$)/', $curl, $match))
$curl = $match[1];
else
$curl = 0;
return $curl;
}
$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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>feed on feeds - installation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="fof.css" media="screen" />
<script src="fof.js" type="text/javascript"></script>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
<style>
body
{
font-family: georgia;
font-size: 16px;
}
div
{
background: #eee;
border: 1px solid black;
width: 75%;
margin: 5em auto;
padding: 1.5em;
}
hr
{
height:0;
border:0;
border-top:1px solid #999;
}
.fail { color: red; }
.pass { color: green; }
.warn { color: #a60; }
</style>
</head>
<body><div> <center style="font-size: 20px;"><a href="http://feedonfeeds.com/">Feed on Feeds</a> - Installation</center><br>
<head>
<title>feed on feeds - installation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="fof.css" media="screen" />
<script src="fof.js" type="text/javascript"></script>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
<style>
body
{
font-family: georgia;
font-size: 16px;
}
div
{
background: #eee;
border: 1px solid black;
width: 75%;
margin: 5em auto;
padding: 1.5em;
}
hr
{
height:0;
border:0;
border-top:1px solid #999;
}
.fail { color: red; }
.pass { color: green; }
.warn { color: #a60; }
</style>
</head>
<body><div><center style="font-size: 20px;"><a href="http://feedonfeeds.com/">Feed on Feeds</a> - Installation</center><br>
<?php
if($_GET['password'] && $_GET['password'] == $_GET['password2'] )
{
$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);
echo '<center><b>OK! Setup complete! <a href=".">Login as admin</a>, and start subscribing!</center></b></div></body></html>';
$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);
echo '<center><b>OK! Setup complete! <a href=".">Login as admin</a>, and start subscribing!</center></b></div></body></html>';
}
else
{
@ -107,7 +93,6 @@ else
{
echo '<center><font color="red">Passwords do not match!</font></center><br><br>';
}
?>
Checking compatibility...
@ -253,103 +238,67 @@ CREATE TABLE IF NOT EXISTS `$FOF_SUBSCRIPTION_TABLE` (
) ENGINE=InnoDB;
EOQ;
foreach($tables as $table)
{
if(!fof_db_query($table, 1))
{
exit ("Can't create table. MySQL says: <b>" . mysql_error() . "</b><br>" );
}
}
if(!fof_db_query($table, 1))
exit("Can't create table. MySQL says: <b>" . mysql_error() . "</b><br>");
?>
Tables exist.<hr>
Upgrading schema...
<?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...
<?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 (2, 'star')", 1);
?>
Done.<hr>
Checking cache directory...
<?php
if ( ! file_exists( "cache" ) )
if (!file_exists("cache"))
{
$status = @mkdir( "cache", 0755 );
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 "</div></body></html>";
$status = @mkdir("cache", 0755);
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 "</div></body></html>";
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 "</div></body></html>";
exit;
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>";
exit;
}
?>
Cache directory exists and is writable.<hr>
<?php
$result = fof_db_query("select * from $FOF_USER_TABLE where user_name = 'admin'");
if(mysql_num_rows($result) == 0) {
$result = fof_db_query("select * from $FOF_USER_TABLE where user_name = 'admin'");
if(mysql_num_rows($result) == 0) {
?>
You now need to choose an initial password for the 'admin' account:<br>
<form>

View File

@ -16,29 +16,19 @@ include_once("fof-main.php");
include_once("fof-render.php");
if($_GET['how'] == 'paged' && !isset($_GET['which']))
{
$which = 0;
}
else
{
$which = $_GET['which'];
}
$order = $_GET['order'];
if(!isset($_GET['what']))
{
$what = "unread";
}
$what = "unread";
else
{
$what = $_GET['what'];
}
$what = $_GET['what'];
if(!isset($_GET['order']))
{
$order = $fof_prefs_obj->get("order");
}
$how = $_GET['how'];
$feed = $_GET['feed'];
@ -89,8 +79,6 @@ $noedit = $_GET['noedit'];
<li><a href="javascript:hide_all()">Hide all</a></li>
</ul>
<!-- close this form to fix first item! -->
<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" />
<?php
$links = fof_get_nav_links($_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany']);
if($links)
{
?>
<center><?php echo $links ?></center>
<?php
}
$links = fof_get_nav_links($_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany']);
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']);
@ -118,7 +101,7 @@ foreach($result as $row)
$item_id = $row['item_id'];
if($first) print "<script>firstItem = 'i$item_id'; </script>";
$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);
print '</div>';
}
@ -128,9 +111,12 @@ if(count($result) == 0)
echo "<p><i>No items found.</i></p>";
}
if($links) { ?>
<center><?php echo $links ?></center><?php
}
?>
</form>
<div id="end-of-items"></div>
<script>itemElements = $$('.item');</script>
<script>itemElements = $$('.item');</script>

View File

@ -20,7 +20,7 @@ echo '<?xml version="1.0"?>';
<opml version="1.1">
<head>
<title>Feed on Feeds Subscriptions</title>
<title>Feed on Feeds Subscriptions</title>
</head>
<body>
<?php
@ -28,21 +28,20 @@ $result = fof_db_get_subscriptions(fof_current_user());
while($row = fof_db_get_row($result))
{
$url = htmlspecialchars($row['feed_url']);
$title = htmlspecialchars($row['feed_title']);
$link = htmlspecialchars($row['feed_link']);
echo <<<HEYO
<outline type="rss"
text="$title"
title="$title"
htmlUrl="$link"
xmlUrl="$url"
/>
$url = htmlspecialchars($row['feed_url']);
$row['prefs'] = unserialize($row['subscription_prefs']);
$title = htmlspecialchars(fof_feed_title($row));
$link = htmlspecialchars($row['feed_link']);
echo <<<HEYO
<outline type="rss"
text="$title"
title="$title"
htmlUrl="$link"
xmlUrl="$url"
/>
HEYO;
}
?>
</body>
</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)
{
list($prop, $feed_id) = explode('_', $k);
if (!$allow_prop[$prop])
continue;
if (!($feed = fof_db_get_feed_by_id($feed_id)))
continue;
// remove tags
if (substr($k, 0, 5) == 'untag')
if ($prop == 'untag')
{
$feed_id = substr($k, 5);
if ($feed = fof_db_get_feed_by_id($feed_id))
foreach ($v as $tag)
{
foreach ($v as $tag)
{
fof_untag_feed(fof_current_user(), $feed_id, $tag);
$message[] = 'Dropped \''.$tag.'\' from \''.$feed['feed_title'].'\'';
}
fof_untag_feed(fof_current_user(), $feed_id, $tag);
$message[] = 'Dropped \''.$tag.'\' from \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\'';
}
}
// add tags
else if (substr($k, 0, 3) == 'tag')
else if ($prop == 'tag')
{
$feed_id = substr($k, 3);
if ($feed = fof_db_get_feed_by_id($feed_id))
foreach (preg_split("/[\s,]*,[\s,]*/", $v) as $tag)
{
foreach (preg_split("/[\s,]*,[\s,]*/", $v) as $tag)
if ($tag)
{
if ($tag)
{
fof_tag_feed(fof_current_user(), $feed_id, $tag);
$message[] = 'Tagged \''.$feed['feed_title'].'\' as '.$tag;
}
fof_tag_feed(fof_current_user(), $feed_id, $tag);
$message[] = 'Tagged \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' as '.htmlspecialchars($tag);
}
}
}
// change filter
else if (substr($k, 0, 6) == 'filter')
else if ($prop == 'filter')
{
$feed_id = substr($k, 6);
if (($feed = fof_db_get_feed_by_id($feed_id)) &&
fof_db_set_feed_filter(fof_current_user(), $feed_id, $v))
$message[] = 'Set filter \''.$v.'\' for feed \''.$feed['feed_title'].'\'';
if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'filter', $v))
$message[] = 'Set filter \''.htmlspecialchars($v).'\' for feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\'';
}
// 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']))
{
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.";
}
else if($_POST['password'] || $_POST['password2'])
@ -118,19 +139,13 @@ if(isset($_POST['plugins']))
$plugins = array();
$dirlist = opendir(FOF_DIR . "/plugins");
while($file=readdir($dirlist))
{
if(ereg('\.php$',$file))
{
$plugins[] = substr($file, 0, -4);
}
}
$plugins[] = substr($file, 0, -4);
closedir();
foreach($plugins as $plugin)
{
$prefs->set("plugin_" . $plugin, $_POST[$plugin] != "on");
}
$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) { ?>
<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 } ?>
<br>
@ -241,16 +256,24 @@ URL to be linked on shared page: <input type=string name=sharedurl value="<?php
</form>
<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;">
<form method="post" action="?tagfeeds=1">
<table cellpadding=3 cellspacing=0>
<tr><th colspan="2" align="left">Feed</th><th>Remove tags</th><th>Add tags</th><th>Item filter regexp</th></tr>
<table cellpadding="3" cellspacing="0" class="feedprefs">
<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
foreach($feeds as $row)
{
$id = $row['feed_id'];
$url = $row['feed_url'];
$title = $row['feed_title'];
$title = fof_feed_title($row);
$link = $row['feed_link'];
$description = $row['feed_description'];
$age = $row['feed_age'];
@ -264,21 +287,17 @@ foreach($feeds as $row)
$tags = $row['tags'];
if(++$t % 2)
{
print '<tr class="odd-row">';
}
else
{
print '<tr>';
}
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 { ?>
<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>
<?
@ -288,17 +307,24 @@ foreach($feeds as $row)
foreach($tags as $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++;
}
}
print "</td>";
$title = htmlspecialchars($title);?>
<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>
$flt = htmlspecialchars($row['prefs']['filter']);
?>
</td>
<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>
<input type="submit" value="Update tags and filters">
<input type="submit" value="Update tags and filters" />
</form>
</div>

View File

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

View File

@ -68,7 +68,7 @@ else
echo "<script>starred = $starred;</script>";
?>
<li <?php if($what == "unread") echo "style='background: #ddd'" ?> ><a href=".?what=unread"><font color=red><b>Unread <?php if($unread) echo "($unread)" ?></b></font></a></li>
<li <?php if($what == "star") echo "style='background: #ddd'" ?> ><a href=".?what=star"><img src="image/star-on.gif" border="0" height="10" width="10"> Starred <span id="starredcount"><?php if($starred) echo "($starred)" ?></span></a></li>
<li <?php if($what == "all" && isset($when)) echo "style='background: #ddd'" ?> ><a href=".?what=all&when=today">&lt; Today</a></li>
@ -114,33 +114,27 @@ if($n)
<?php
foreach($tags as $tag)
{
$tag_name = $tag['tag_name'];
$tag_id = $tag['tag_id'];
$count = $tag['count'];
$unread = $tag['unread'];
if($tag_id == 1 || $tag_id == 2) continue;
{
$tag_name = $tag['tag_name'];
$tag_id = $tag['tag_id'];
$count = $tag['count'];
$unread = $tag['unread'];
if(++$t % 2)
{
print "<tr class=\"odd-row\">";
}
else
{
print "<tr>";
}
if($tag_id == 1 || $tag_id == 2) continue;
print "<td>";
if($unread) print "<a class='unread' href='.?what=$tag_name,unread'>$unread</a>/";
print "<a href='.?what=$tag_name'>$count</a></td>";
print "<td><b><a href='.?what=$tag_name'>$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>";
if(++$t % 2)
print "<tr class=\"odd-row\">";
else
print "<tr>";
print "</tr>";
print "<td>";
if ($unread) print "<a class='unread' href='.?what=$tag_name,unread'>$unread</a>/";
print "<a href='.?what=$tag_name&how=paged'>$count</a></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 "</tr>";
}
?>
</table>
@ -151,7 +145,6 @@ foreach($tags as $tag)
<?php } ?>
<div id="feeds">
<div id="feedlist">
@ -184,9 +177,9 @@ foreach (array("feed_age", "max_date", "feed_unread", "feed_url", "feed_title")
{
$url = "return change_feed_order('$col', 'asc')";
}
echo "<td><nobr><a href='#' title='$title[$col]' onclick=\"$url\">";
if($col == "feed_unread")
{
echo "<span class=\"unread\">#</span>";
@ -195,12 +188,12 @@ foreach (array("feed_age", "max_date", "feed_unread", "feed_url", "feed_title")
{
echo $name[$col];
}
if($col == $order)
{
echo ($direction == "asc") ? "&darr;" : "&uarr;";
}
echo "</a></nobr></td>";
}
@ -213,74 +206,63 @@ foreach (array("feed_age", "max_date", "feed_unread", "feed_url", "feed_title")
foreach($feeds as $row)
{
$id = $row['feed_id'];
$url = $row['feed_url'];
$title = $row['feed_title'];
$link = $row['feed_link'];
$description = $row['feed_description'];
$age = $row['feed_age'];
$unread = $row['feed_unread'];
$starred = $row['feed_starred'];
$items = $row['feed_items'];
$agestr = $row['agestr'];
$agestrabbr = $row['agestrabbr'];
$lateststr = $row['lateststr'];
$lateststrabbr = $row['lateststrabbr'];
$id = $row['feed_id'];
$url = $row['feed_url'];
$title = fof_feed_title($row);
$link = $row['feed_link'];
$description = $row['feed_description'];
$age = $row['feed_age'];
$unread = $row['feed_unread'];
$starred = $row['feed_starred'];
$items = $row['feed_items'];
$agestr = $row['agestr'];
$agestrabbr = $row['agestrabbr'];
$lateststr = $row['lateststr'];
$lateststrabbr = $row['lateststrabbr'];
if(++$t % 2)
print "<tr class=\"odd-row\">";
else
print "<tr>";
if(++$t % 2)
{
print "<tr class=\"odd-row\">";
}
else
{
print "<tr>";
}
$u = ".?feed=$id";
$u2 = ".?feed=$id&amp;what=all&amp;how=paged";
$u = ".?feed=$id";
$u2 = ".?feed=$id&amp;what=all&amp;how=paged";
print "<td><span title=\"$agestr\" id=\"${id}-agestr\">$agestrabbr</span></td>";
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 class=\"unread\" title=\"new items\" href=\"$u\">$unread</a>/";
}
print "<a href=\"$u2\" title=\"all items\">$items</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'>";
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>";
print "<a href=\"".($unread ? $u : $u2)."\" title=\"".($unread ? "unread" : "all")." items\"><b>".htmlspecialchars($title)."</b></a>";
if ($link)
print " <a href=\"$link\" title=\"home page\"><img style='border-width: 0px' src='image/external.png' /></a>";
print "</td>";
print "<td><nobr>";
print "<td>";
print "<a href=\"".($unread ? $u : $u2)."\" title=\"".($unread ? "unread" : "all")." items\"><b>$title</b></a>";
if ($link)
print " <a href=\"$link\" title=\"home page\"><img style='border-width: 0px' src='image/external.png' /></a>";
print "</td>";
print "<td><nobr>";
print "<a href=\"update.php?feed=$id\" title=\"update\">u</a>";
$stitle = 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 "<a href=\"update.php?feed=$id\" title=\"update\">u</a>";
$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 "</nobr></td>";
print "</tr>";
print "</tr>";
}
?>
@ -291,21 +273,15 @@ foreach($feeds as $row)
</div>
<?php
$order = $_GET['order'];
$direction = $_GET['direction'];
if(!isset($order))
{
$order = "title";
}
$order = "title";
if(!isset($direction))
{
$direction = "asc";
}
$direction = "asc";
?>

View File

@ -43,7 +43,7 @@ else
{
$title = $feed['feed_title'];
list($timestamp, ) = fof_nice_time_stamp($feed['feed_cache_date']);
print "$title was just updated $timestamp!<br>";
}
else
@ -56,12 +56,12 @@ else
$feeds = fof_multi_sort($feeds, 'feed_cache_attempt_date', false);
print("<script>\nwindow.onload = ajaxupdate;\nfeedslist = [");
foreach($feeds as $feed)
{
$title = $feed['feed_title'];
$id = $feed['feed_id'];
$title = $feed['feed_title'];
$id = $feed['feed_id'];
$feedjson[] = "{'id': $id, 'title': '" . addslashes($title) . "'}";
}
@ -69,5 +69,5 @@ print(join($feedjson, ", "));
print("];\n</script>");
include("footer.php");
?>
?>