function save_prefs_adv_autotag($post) { if (!isset($post['aa_autotag']) && !isset($post['aa_apply_u']) && !isset($post['aa_apply_a'])) { return; } global $prefs; foreach ($post['aa_pref'] as $key => $val) { if (empty($val['filter']) || empty($val['tag'])) { unset($post['aa_pref'][$key]); } } usort($post['aa_pref'], '_cb_prefsort'); $prefs->set('adv_autotag', array_values($post['aa_pref'])); $prefs->save(); // apply? if (isset($post['aa_apply_u']) || isset($post['aa_apply_a'])) { if (isset($post['aa_apply_u'])) { $items = fof_get_items(fof_current_user()); } else { $items = fof_get_items(fof_current_user(), null, 'all'); } foreach ($items as $item) { $tags = fof_adv_autotag(null, $item['item_title'], $item['item_content'], $item); if (count($tags)) { fof_tag_item(fof_current_user(), $item['item_id'], $tags); } } } }
public static function &instance() { static $instance; if (!isset($instance)) { $instance = new FoF_Prefs(fof_current_user()); } return $instance; }
fof_db_mark_feed_read(fof_current_user(), $_POST['feed']); } else { if (!empty($_POST['mark_read'])) { fof_db_mark_read(fof_current_user(), array($_POST['mark_read'])); } else { if (!empty($_POST['fold'])) { fof_db_fold(fof_current_user(), array($_POST['fold'])); } else { if (!empty($_POST['unfold'])) { fof_db_unfold(fof_current_user(), array($_POST['unfold'])); } else { if (!empty($_POST['tag_read'])) { fof_db_mark_tag_read(fof_current_user(), $_POST['tag_read']); } else { if (!empty($items) && !empty($_POST['action'])) { if ($_POST['action'] == 'read') { fof_db_mark_read(fof_current_user(), $items); } if ($_POST['action'] == 'unread') { fof_db_mark_unread(fof_current_user(), $items); } } if (!empty($_POST['return'])) { header("Location: " . urldecode($_POST['return'])); } } } } } } }
<?php /* * This file is part of FEED ON FEEDS - http://feedonfeeds.com/ * * item.php - renders a single item (useful for Ajax) * * * Copyright (C) 2004-2007 Stephen Minutillo * steve@minutillo.com - http://minutillo.com/steve/ * * Distributed under the GPL - see LICENSE * */ include_once "fof-main.php"; include_once "fof-render.php"; fof_set_content_type(); $row = fof_get_item(fof_current_user(), $_GET['id']); fof_render_item($row);
<?php /* * This file is part of FEED ON FEEDS - http://feedonfeeds.com/ * * add-tag.php - adds (or removes) a tag to an item * * * Copyright (C) 2004-2007 Stephen Minutillo * steve@minutillo.com - http://minutillo.com/steve/ * * Distributed under the GPL - see LICENSE * */ include_once "fof-main.php"; $tags = $_GET['tag']; $item = $_GET['item']; $remove = $_GET['remove']; foreach (explode(" ", $tags) as $tag) { if ($remove == 'true') { fof_untag_item(fof_current_user(), $item, $tag); } else { fof_tag_item(fof_current_user(), $item, $tag); } }
foreach (fof_get_plugin_prefs() as $plugin_pref) { $key = $plugin_pref[1]; $prefs->set($key, fof_prefs_get_key_($_POST, $key)); } $plugins = array(); $dirlist = opendir(FOF_DIR . "/plugins"); while ($file = readdir($dirlist)) { if (preg_match('/\\.php$/', $file)) { $plugins[] = substr($file, 0, -4); } } closedir(); foreach ($plugins as $plugin) { $prefs->set("plugin_" . $plugin, fof_prefs_get_key_($_POST, $plugin) != "on"); } $prefs->save(fof_current_user()); $message .= ' Saved plugin prefs.'; } if (!defined('FOF_AUTH_EXTERNAL_ONLY')) { if (isset($_POST['changepassword'])) { if ($_POST['password'] != $_POST['password2']) { $message = "Passwords do not match!"; } else { $username = $_POST['username']; $password = $_POST['password']; fof_db_change_password($username, $password); $message = "Changed password for {$username}."; } } if (fof_is_admin() && isset($_POST['adduser']) && $_POST['username'] && $_POST['password']) { $username = $_POST['username'];
* */ include "header.php"; print "<br>"; $feed = $_GET['feed']; $feeds = array(); $p =& FoF_Prefs::instance(); $admin_prefs = $p->admin_prefs; if ($feed) { $feed = fof_db_get_feed_by_id($feed); $feeds[] = $feed; } else { if ($fof_user_id == 1) { $result = fof_db_get_feeds(); } else { $result = fof_db_get_subscriptions(fof_current_user()); } while ($feed = fof_db_get_row($result)) { if (time() - $feed["feed_cache_date"] < $admin_prefs["manualtimeout"] * 60) { $title = $feed['feed_title']; list($timestamp, ) = fof_nice_time_stamp($feed['feed_cache_date']); print "{$title} was just updated {$timestamp}!<br>"; } else { $feeds[] = $feed; } } } $feeds = fof_multi_sort($feeds, 'feed_cache_attempt_date', false); print "<script>\nwindow.onload = ajaxupdate;\nfeedslist = ["; foreach ($feeds as $feed) { $title = $feed['feed_title'];
<?php if ($what == "unread") { echo "<input type='hidden' name='what' value='all'>"; } else { echo "<input type='hidden' name='what' value='{$what}'>"; } if (isset($_GET['when'])) { echo "<input type='hidden' name='what' value='{$_GET['when']}'>"; } ?> </form> </li> </ul> <?php $tags = fof_get_tags(fof_current_user()); $n = 0; foreach ($tags as $tag) { $tag_id = $tag['tag_id']; if ($tag_id == 1 || $tag_id == 2) { continue; } $n++; } if ($n) { ?> <div id="tags"> <table cellspacing="0" cellpadding="1" border="0" id="taglist">
* * * Copyright (C) 2004-2007 Stephen Minutillo * steve@minutillo.com - http://minutillo.com/steve/ * * Distributed under the GPL - see LICENSE * */ include_once "fof-main.php"; fof_set_content_type(); if (isset($_COOKIE['fof_sidebar_width'])) { $width = $_COOKIE['fof_sidebar_width']; } else { $width = 250; } $unread_count = fof_get_unread_count(fof_current_user()); ?> <!DOCTYPE html> <html> <head> <title>Feed on Feeds<?php if ($unread_count) { echo " ({$unread_count})"; } ?> </title> <link rel="stylesheet" href="fof.css" media="screen" /> <link rel="microsummary" href="microsummary.php" />
<?php /* * This file is part of FEED ON FEEDS - http://feedonfeeds.com/ * * add-single.php - adds a single feed * * * Copyright (C) 2004-2007 Stephen Minutillo * steve@minutillo.com - http://minutillo.com/steve/ * * Distributed under the GPL - see LICENSE * */ include_once "fof-main.php"; $url = $_REQUEST['url']; $unread = $_REQUEST['unread']; print fof_subscribe(fof_current_user(), $url, $unread);
<form id="itemform" name="items" action="view-action.php" method="post" onSubmit="return false;"> <input type="hidden" name="action" /> <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 } $result = fof_get_items(fof_current_user(), $_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany'], $order, $_GET['search']); $first = true; 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)">'; fof_render_item($row); print '</div>'; } if (count($result) == 0) { echo "<p><i>No items found.</i></p>"; } ?>
function fof_sidebar_tags_default() { global $sharing; global $what_a; $unread_id = fof_db_get_tag_by_name('unread'); $star_id = fof_db_get_tag_by_name('star'); $folded_id = fof_db_get_tag_by_name('folded'); $tags = fof_get_tags(fof_current_user()); $taglines = array(); $n = 0; foreach ($tags as $tag) { $tag_id = $tag['tag_id']; if ($tag_id == $unread_id || $tag_id == $star_id || $tag_id == $folded_id) { continue; } $tagline = ''; $tag_name = $tag['tag_name']; $tag_name_html = htmlentities($tag_name); $tag_name_json = htmlentities(json_encode($tag_name), ENT_QUOTES); $count = $tag['count']; $unread = $tag['unread']; $tag_classes = array(); if (++$n % 2) { $tag_classes[] = 'odd-row'; } if (in_array($tag_name, $what_a)) { $tag_classes[] = 'current-view'; } $tag_classes = implode(' ', $tag_classes); if (!empty($tag_classes)) { $tag_classes = ' class="' . $tag_classes . '"'; } $tagline .= ' <tr' . $tag_classes . '>'; $tagline .= '<td class="unread">'; if ($unread) { $tagline .= '<a class="unread" href="' . fof_url('.', array('what' => "{$tag_name} unread", 'how' => 'paged')) . "\">{$unread}</a>/"; } $tagline .= '<a href="' . fof_url('.', array('what' => $tag_name, 'how' => 'paged')) . "\">{$count}</a>"; $tagline .= '</td>'; $tagline .= '<td class="title"><b><a href="' . fof_url('.', array('what' => $tag_name, 'how' => 'paged')) . '">' . $tag_name_html . '</a></b></td>'; $tagline .= '<td class="controls"><a href="#" title="untag all items" onclick="return sb_del_tag_conf(' . $tag_name_json . ');">[x]</a></td>'; if ($sharing == 'all_tagged') { $tagline .= '<td class="sharing"><a href="' . fof_url('./shared.php', array('user' => $fof_user_id, 'which' => $tag_name, 'how' => 'paged')) . '">[' . $tag_name_html . ']</a>'; } $tagline .= '</tr>'; $taglines[] = $tagline; } if (!empty($taglines)) { ?> <div id="tags"> <table cellspacing="0" cellpadding="1" border="0" id="taglist"> <tr class="heading"><td><span class="unread">#</span></td><td class="title">tag name</td><td class="controls">untag</td><?php if ($sharing == 'all_tagged') { echo '<td class="sharing">shared page</td>'; } ?> </tr> <?php echo implode("\n", $taglines); ?> </table> </div> <!--tags end--> <?php } ?> <?php }
echo "\t"; exit; } /* modify a user's feed subscription */ if (!empty($_POST['subscription_tag'])) { if (empty($_POST['feed'])) { header('Status: 400 Bad Request'); echo 'Incomplete data.'; exit; } $tag = $_POST['subscription_tag']; $feed_id = $_POST['feed']; if (!empty($_POST['delete'])) { fof_untag_feed(fof_current_user(), $feed_id, $tag); } else { fof_tag_feed(fof_current_user(), $feed_id, $tag); } exit; } /** Serve out an SVG image showing a feed's activity history. */ if (!empty($_GET['feed_history'])) { include_once 'classes/svghistogram.php'; fof_set_content_type('image/svg+xml'); $history = fof_db_feed_history($_GET['feed_history']); $options = array('title' => 'Feed History', 'description' => 'Items added to feed.', 'min_items' => max(31, $fof_prefs_obj->admin_prefs['purge'] + 7), 'max_items' => 366, 'label_zero' => '↑ today', 'label_x' => 'days ago →'); if (!empty($fof_prefs_obj->admin_prefs['purge'])) { $options['shade_over'] = $fof_prefs_obj->admin_prefs['purge']; $options['max_items'] = min($options['max_items'], ceil($fof_prefs_obj->admin_prefs['purge'] * SVGHistogram::PHI)); } $graph = new SVGHistogram($options);
$feed_row = fof_db_get_feed_by_id($feed_id); fof_db_subscription_feed_fix($feed_row); list($feed_row['feed_items'], $feed_row['feed_tagged'], $counts) = fof_db_feed_counts(fof_current_user(), $feed_id); $feed_row = array_merge(array('tags' => array(), 'feed_unread' => 0, 'feed_read' => 0, 'feed_starred' => 0, 'feed_age' => $feed_row['feed_cache_date']), $feed_row); list($feed_row['agestr'], $feed_row['agestrabbr']) = fof_nice_time_stamp($feed_row['feed_cache_date']); $max_stmt = fof_db_get_latest_item_age(fof_current_user(), $feed_id); $feed_row['max_date'] = fof_db_get_row($max_stmt, 'max_date', TRUE); list($feed_row['lateststr'], $feed_row['lateststrabbr']) = fof_nice_time_stamp($feed_row['max_date']); /* not subscribed, so no subscription preferences to change.. */ $admin_view = true; } else { $feed_row = fof_get_feed(fof_current_user(), $feed_id); $admin_view = false; } /* only include the update scripts if subscribed */ if (!$admin_view || fof_db_is_subscribed_id(fof_current_user(), $feed_id)) { $feed_id_js = json_encode($feed_id); ?> <script> function subscription_tags_refresh(feed) { var params = { subscription_tag_list: feed }; new Ajax.Updater($("feedtags").down("ul"), "feed-action.php", { method: "post", parameters: params }); } function subscription_tag_modify(feed, tag, action) { var params = { feed: feed, subscription_tag: tag }; if (action == "delete") { params[action] = true; } var complete = function () { subscription_tags_refresh(feed); refreshlist(); // update sidebar
</div> <?php } ?> <!-- close this form to fix first item! --> <form id="itemform" name="items" action="view-action.php" method="post" onSubmit="return false;"> <input type="hidden" name="action" /> <input type="hidden" name="return" /> <?php $links = fof_get_nav_links($feed, $what, $when, $which, $howmany, $search, $itemcount); $links = ($links ? '<div class="pagination-nav">' : '') . $links . ($links ? "</div>\n" : ''); echo $links; $items = fof_get_items(fof_current_user(), $feed, $what, $when, $which, $howmany, $order, $search); if (!empty($items)) { list($first_item) = $items; echo "<script>firstItem = 'i" . $first_item['item_id'] . "';</script>\n"; foreach ($items as $item) { fof_render_item($item, true); } } else { echo "<p><i>No items found.</i></p>\n"; } ?> <div id="end-of-items"></div> </form> <?php
<?php /* * This file is part of FEED ON FEEDS - http://feedonfeeds.com/ * * delete.php - deletes a feed and all items * * * Copyright (C) 2004-2007 Stephen Minutillo * steve@minutillo.com - http://minutillo.com/steve/ * * Distributed under the GPL - see LICENSE * */ include_once "fof-main.php"; $feed = $_GET['feed']; fof_delete_subscription(fof_current_user(), $feed); include "header.php"; ?> Deleted. <?php include "footer.php";
<?php $fof_no_login = 1; require "fof-main.php"; if (defined('FOF_AUTH_EXTERNAL') && !empty($_SERVER['REMOTE_USER'])) { $unread = fof_db_tag_count(fof_db_get_user_id($_SERVER['REMOTE_USER']), 'unread'); } else { if (isset($_COOKIE['user_name']) && isset($_COOKIE['user_password_hash'])) { if (fof_authenticate($_COOKIE['user_name'], $_COOKIE['user_password_hash'])) { $unread = fof_db_tag_count(fof_current_user(), 'unread'); } } } echo 'Feed on Feeds' . ($unread ? " ({$unread})" : ''); ?>
function fof_view_title($feed = NULL, $what = 'unread', $when = NULL, $start = NULL, $limit = NULL, $search = NULL, $itemcount = 0) { $prefs = fof_prefs(); $title = 'feed on feeds - showing'; if ($itemcount) { if (is_numeric($start)) { if (!is_numeric($limit)) { $limit = $prefs['howmany']; } if ($start || $limit < $itemcount) { $end = $start + $limit; if ($end > $itemcount) { $end = $itemcount; } $start += 1; if ($start != $end) { $title .= " {$start} to {$end} of "; } } } $title .= " {$itemcount}"; } $title .= ' item' . ($itemcount != 1 ? 's' : ''); if (!empty($feed)) { /* we only need this one thing here, so try to minimize activity by shirking the full fix function call */ $feed = fof_db_subscription_feed_get(fof_current_user(), $feed); $feed['display_title'] = empty($feed['subscription_prefs']['alt_title']) ? $feed['feed_title'] : $feed['subscription_prefs']['alt_title']; $title .= ' in \'' . htmlentities($feed['display_title']) . '\''; } if (empty($what)) { $what = 'unread'; } if ($what != 'all') { $tags = explode(' ', $what); $last_tag = array_pop($tags); if (!empty($last_tag)) { $title .= ' tagged'; if (!empty($tags)) { $title .= ' ' . implode(', ', $tags) . (count($tags) > 1 ? ',' : '') . ' and'; } $title .= ' ' . $last_tag; } } if (!empty($when)) { $title .= ' from ' . $when; } if (isset($search)) { $title .= ' <a href="#" title="Toggle highlights" onclick="toggle_highlight(); return false;">matching <span class="highlight"><em>' . $search . '</em></span></a>'; } return $title; }