Compare commits
No commits in common. "master" and "orig_fof" have entirely different histories.
|
@ -1,6 +0,0 @@
|
||||||
Options -Indexes
|
|
||||||
<FilesMatch "fof\.log.*">
|
|
||||||
Order deny,allow
|
|
||||||
Allow from none
|
|
||||||
Deny from all
|
|
||||||
</FilesMatch>
|
|
74
README.md
|
@ -1,74 +0,0 @@
|
||||||
What is FeedOnFeeds?
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
FeedOnFeeds is a lightweight server-based RSS aggregator and reader,
|
|
||||||
allowing you to keep up with syndicated content (blogs, comics, and so
|
|
||||||
forth) without having to keep track of what you've read. Being
|
|
||||||
server-based means all of your feeds and history are kept in one
|
|
||||||
place, and being lightweight means you can install it pretty much
|
|
||||||
anywhere without needing a fancy dedicated server or the like.
|
|
||||||
|
|
||||||
FeedOnFeeds 0.5 is originally written by Steve Minutillo.
|
|
||||||
This is a fork of FeedOnFeeds 0.5 by Vitaliy Filippov.
|
|
||||||
|
|
||||||
FeedOnFeeds is distributed under the terms of GNU GPL v2 license, see LICENSE.
|
|
||||||
|
|
||||||
New features in this version compared to the original 0.5
|
|
||||||
---------------------------------------------------------
|
|
||||||
|
|
||||||
* Performance of all queries is greatly improved, basically almost everything
|
|
||||||
is fast even if you have lots of unread and/or tagged items (100000+)
|
|
||||||
* HTTP proxy support through standard environment variables http_proxy, no_proxy
|
|
||||||
* Password-protected feed support (HTTP basic/digest)
|
|
||||||
* Personal feed rename support (each user can rename feeds to his will)
|
|
||||||
* Possible to set tags for a feed when adding it
|
|
||||||
* The view is paged by default (you have to specify a big limit by hand to view all items)
|
|
||||||
* Mass feed tagging/untagging from the preferences page
|
|
||||||
* Per-feed and per-item collapse settings: you can set some feeds to show all items
|
|
||||||
collapsed by default or you can configure a regular expression which will specify
|
|
||||||
items that should be collapsed by default in each feed
|
|
||||||
* Most popular feed suggestions on the subscribe page
|
|
||||||
* Top reader statistics on the login page
|
|
||||||
* Very simple CSS-based mobile view
|
|
||||||
* Tables are using InnoDB, UTF-8 encoding, and foreign keys
|
|
||||||
* Code is cleaned of PHP warnings/notices and compatible with PHP 5.4+
|
|
||||||
* PHP mysqli extension is used instead of deprecated mysql
|
|
||||||
|
|
||||||
TODO
|
|
||||||
----
|
|
||||||
|
|
||||||
* Implement safer authentication (sessions?) than current password-hash-in-cookie
|
|
||||||
* Replace SimplePie (not "simple" in any way) with something simpler and faster... (MagPie?)
|
|
||||||
* Dynamic feed update times, similar to https://github.com/RomanSixty/Feed-on-Feeds
|
|
||||||
* Use multi-cURL to download feeds in parallel
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
------------
|
|
||||||
|
|
||||||
* A web server running PHP 5 or later (nginx + php5-fpm or Apache).
|
|
||||||
* PHP extensions: mysqli/mysqlnd, XML, PCRE, cURL, Zlib, mbstring, iconv.
|
|
||||||
* MariaDB/MySQL 5 or later. MariaDB 5.5 or later with Barracuda storage format
|
|
||||||
(innodb_file_format = barracuda) is recommended.
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
* Download a snapshot or checkout code from git repository into installation directory.
|
|
||||||
* Create 'cache' directory inside installation directory and make it writable by the web server.
|
|
||||||
* Create a MySQL database and a user with full access to it. If MySQL server is on the
|
|
||||||
same host it looks like:
|
|
||||||
|
|
||||||
CREATE DATABASE feedonfeeds;
|
|
||||||
GRANT ALL PRIVILEGES ON feedonfeeds.* TO feedonfeeds@localhost IDENTIFIED BY '<password>';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
|
|
||||||
* Copy fof-config-sample.php to fof-config.php and edit FOF_DB_HOST, FOF_DB_USER, FOF_DB_PASS
|
|
||||||
and FOF_DB_DBNAME as appropriate for your newly created database.
|
|
||||||
* Point your browser to `<FoF_URL>/install.php`.
|
|
||||||
|
|
||||||
Upgrade
|
|
||||||
-------
|
|
||||||
|
|
||||||
It is possible to upgrade an existing FeedOnFeeds 0.5 MySQL installation to this version.
|
|
||||||
Database will be converted automatically. Just overwrite all files in FoF installation
|
|
||||||
directory with this version and point your browser to `<FoF_URL>/install.php`.
|
|
|
@ -14,27 +14,8 @@
|
||||||
|
|
||||||
include_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
|
|
||||||
$url = isset($_REQUEST['url']) ? $_REQUEST['url'] : '';
|
$url = $_REQUEST['url'];
|
||||||
$tags = isset($_REQUEST['tags']) ? $_REQUEST['tags'] : '';
|
$unread = $_REQUEST['unread'];
|
||||||
$unread = isset($_REQUEST['unread']) ? $_REQUEST['unread'] : '';
|
|
||||||
|
|
||||||
list($error, $feed) = fof_subscribe(fof_current_user(), $url, $unread);
|
print(fof_subscribe(fof_current_user(), $url, $unread));
|
||||||
$error .= '<br />';
|
?>
|
||||||
foreach (preg_split("/[\s,]*,[\s,]*/", $tags) as $tag)
|
|
||||||
{
|
|
||||||
if ($tag !== '')
|
|
||||||
{
|
|
||||||
fof_tag_feed(fof_current_user(), $feed['feed_id'], $tag);
|
|
||||||
$error .= 'Tagged \''.htmlspecialchars($feed['feed_title']).'\' as '.htmlspecialchars($tag).'<br />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preg_match('/HTTP 401/', $error))
|
|
||||||
{
|
|
||||||
print "<script>
|
|
||||||
document.addform.basic_login.style.backgroundColor='#FFC0C0';
|
|
||||||
document.addform.basic_password.style.backgroundColor='#FFC0C0';
|
|
||||||
document.addform.basic_password.focus();
|
|
||||||
</script>";
|
|
||||||
}
|
|
||||||
print $error;
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ $tags = $_GET['tag'];
|
||||||
$item = $_GET['item'];
|
$item = $_GET['item'];
|
||||||
$remove = $_GET['remove'];
|
$remove = $_GET['remove'];
|
||||||
|
|
||||||
foreach(preg_split("/[\s,]*,[\s,]*/", $tags) as $tag)
|
foreach(explode(" ", $tags) as $tag)
|
||||||
{
|
{
|
||||||
if($remove == 'true')
|
if($remove == 'true')
|
||||||
{
|
{
|
||||||
|
@ -29,3 +29,4 @@ foreach(preg_split("/[\s,]*,[\s,]*/", $tags) as $tag)
|
||||||
fof_tag_item(fof_current_user(), $item, $tag);
|
fof_tag_item(fof_current_user(), $item, $tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|
95
add.php
|
@ -7,8 +7,6 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 Stephen Minutillo
|
* Copyright (C) 2004-2007 Stephen Minutillo
|
||||||
* steve@minutillo.com - http://minutillo.com/steve/
|
* steve@minutillo.com - http://minutillo.com/steve/
|
||||||
* Modified by Vitaliy Filippov (c) 2009
|
|
||||||
* vitalif@mail.ru - http://lib.custis.ru/
|
|
||||||
*
|
*
|
||||||
* Distributed under the GPL - see LICENSE
|
* Distributed under the GPL - see LICENSE
|
||||||
*
|
*
|
||||||
|
@ -16,46 +14,32 @@
|
||||||
|
|
||||||
include("header.php");
|
include("header.php");
|
||||||
|
|
||||||
$url = @$_REQUEST['rss_url'];
|
$url = $_POST['rss_url'];
|
||||||
$new_tags = @$_REQUEST['new_tags'];
|
if(!$url) $url = $_GET['rss_url'];
|
||||||
$login = @$_REQUEST['basic_login'];
|
$opml = $_POST['opml_url'];
|
||||||
$password = @$_REQUEST['basic_password'];
|
$file = $_POST['opml_file'];
|
||||||
$opml = @$_REQUEST['opml_url'];
|
$unread = $_POST['unread'];
|
||||||
$file = @$_POST['opml_file'];
|
|
||||||
$unread = @$_REQUEST['unread'];
|
|
||||||
|
|
||||||
if ($url && !preg_match('!^[a-z0-9_]+://!is', $url))
|
|
||||||
$url = "http://$url";
|
|
||||||
|
|
||||||
if ($login == '%user%')
|
|
||||||
$login = fof_username();
|
|
||||||
|
|
||||||
$feeds = array();
|
$feeds = array();
|
||||||
|
|
||||||
if (!empty($_REQUEST['do']))
|
if($url) $feeds[] = $url;
|
||||||
{
|
|
||||||
if($opml)
|
if($opml)
|
||||||
{
|
{
|
||||||
$sfile = new SimplePie_File($opml);
|
$sfile = new SimplePie_File($opml);
|
||||||
|
|
||||||
if(!$sfile->success)
|
if(!$sfile->success)
|
||||||
{
|
{
|
||||||
echo "Cannot open ".htmlspecialchars($opml)."<br>";
|
echo "Cannot open " . htmlentities($opml) . "<br>";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $sfile->body;
|
$content = $sfile->body;
|
||||||
|
|
||||||
$feeds = fof_opml_to_array($content);
|
$feeds = fof_opml_to_array($content);
|
||||||
}
|
}
|
||||||
if ($url)
|
|
||||||
{
|
|
||||||
if ($login && strlen($password))
|
|
||||||
$url = preg_replace('!^([a-z0-9_]+)://([^/]*:[^/]*@)?!is', '\1://' . str_replace("\\", "\\\\", urlencode($login) . ':' . urlencode($password)) . '@', $url);
|
|
||||||
$feeds[] = $url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$url = preg_replace('!^([a-z0-9_]+)://([^/]*:[^/]*@)?!is', '\1://', $url);
|
if($_FILES['opml_file']['tmp_name'])
|
||||||
|
|
||||||
if (!empty($_FILES['opml_file']['tmp_name']))
|
|
||||||
{
|
{
|
||||||
if(!$content_array = file($_FILES['opml_file']['tmp_name']))
|
if(!$content_array = file($_FILES['opml_file']['tmp_name']))
|
||||||
{
|
{
|
||||||
|
@ -69,68 +53,51 @@ if (!empty($_FILES['opml_file']['tmp_name']))
|
||||||
}
|
}
|
||||||
|
|
||||||
$add_feed_url = "http";
|
$add_feed_url = "http";
|
||||||
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
|
if($_SERVER["HTTPS"] == "on")
|
||||||
|
{
|
||||||
$add_feed_url = "https";
|
$add_feed_url = "https";
|
||||||
|
}
|
||||||
$add_feed_url .= "://" . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"];
|
$add_feed_url .= "://" . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"];
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="fof-add-feeds">
|
<div style="background: #eee; border: 1px solid black; padding: 1.5em; margin: 1.5em;">If your browser is cool, you can <a href='javascript:window.navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "<?php echo $add_feed_url ?>?rss_url=%s", "Feed on Feeds")'>register Feed on Feeds as a Feed Reader</a>. If it is not cool, you can still use the <a href="javascript:void(location.href='<?php echo $add_feed_url ?>?rss_url='+escape(location))">FoF subscribe</a> bookmarklet to subscribe to any page with a feed. Just add it as a bookmark and then click on it when you are at a page you'd like to subscribe to!</div>
|
||||||
|
|
||||||
<h1>Use FeedOnFeeds for reading feeds always</h1>
|
<form method="post" action="opml.php">
|
||||||
|
|
||||||
<div style="background: #eee; border: 1px solid black; padding: 1.5em; margin: 1em;">
|
<input type="submit" value="Export subscriptions as OPML">
|
||||||
If your browser is cool, you can <a href='javascript:window.navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "<?php echo $add_feed_url ?>?basic_login=%25user%25&do=1&rss_url=%s", "Feed on Feeds")'>register Feed on Feeds as a Feed Reader</a>.
|
|
||||||
If it is not cool, you can still use the <a href="javascript:void(location.href='<?php echo $add_feed_url ?>?basic_login=%25user%25&do=1&rss_url='+escape(location))">FoF subscribe</a> bookmarklet to subscribe to any page with a feed.
|
</form>
|
||||||
Just add it as a bookmark and then click on it when you are at a page you'd like to subscribe to!
|
<br>
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="post" name="addform" action="add.php" enctype="multipart/form-data">
|
<form method="post" name="addform" action="add.php" enctype="multipart/form-data">
|
||||||
|
|
||||||
When adding feeds, mark <select name="unread"><option value=today <?= $unread == "today" ? "selected" : "" ?> >today's</option><option value=all <?= $unread == "all" ? "selected" : "" ?> >all</option><option value=no <?= $unread == "no" ? "selected" : "" ?> >no</option></select> items as unread<br />
|
When adding feeds, mark <select name="unread"><option value=today <?php if($unread == "today") echo "selected" ?> >today's</option><option value=all <?php if($unread == "all") echo "selected" ?> >all</option><option value=no <?php if($unread == "no") echo "selected" ?> >no</option></select> items as unread<br><br>
|
||||||
|
|
||||||
<h1>Enter URL manually</h1>
|
RSS or weblog URL: <input type="text" name="rss_url" size="40" value="<?php echo htmlentities($url) ?>"><input type="Submit" value="Add a feed"><br><br>
|
||||||
|
|
||||||
<p>
|
OPML URL: <input type="hidden" name="MAX_FILE_SIZE" value="100000">
|
||||||
RSS or weblog URL: <input type="text" name="rss_url" size="40" value="<?= htmlspecialchars($url) ?>" /> <input name="do" type="Submit" value="Add a feed" /><br />
|
|
||||||
Login: <input type="text" name="basic_login" value="<?= htmlspecialchars($login) ?>" /> Password: <input type="password" name="basic_password" value="<?= htmlspecialchars($password) ?>" /> (optional) for password-protected feeds<br />
|
|
||||||
Tags for new feed(s): <input type="text" name="new_tags" size="40" value="<?= htmlspecialchars($new_tags) ?>" /> (separate by comma)
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h1>OPML import</h1>
|
<input type="text" name="opml_url" size="40" value="<?php echo htmlentities($opml) ?>"><input type="Submit" value="Add feeds from OPML file on the Internet"><br><br>
|
||||||
|
|
||||||
<p>
|
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
|
||||||
OPML URL: <input type="text" name="opml_url" size="40" value="<?= htmlspecialchars($opml) ?>" /> <input name="do" type="Submit" value="Add feeds from OPML file on the Internet" /><br>
|
OPML filename: <input type="file" name="opml_file" size="40" value="<?php echo htmlentities($file) ?>"><input type="Submit" value="Upload an OPML file">
|
||||||
OPML filename: <input type="hidden" name="MAX_FILE_SIZE" value="100000" /><input type="file" name="opml_file" size="40" value="<?= htmlspecialchars($file) ?>" /> <input name="do" type="Submit" value="Upload an OPML file" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h1>OPML export</h1>
|
|
||||||
<form style="margin: 1em" method="post" action="opml.php"><input type="submit" value="Export subscriptions as OPML"></form>
|
|
||||||
|
|
||||||
<?php if (!count($feeds) && $fof_prefs_obj && ($suggest = intval($fof_prefs_obj->admin_prefs['suggestadd'])) &&
|
|
||||||
count($suggest = fof_db_get_most_popular_feeds($suggest))) { ?>
|
|
||||||
<h1>Most popular feeds</h1>
|
|
||||||
<p>
|
|
||||||
<?php foreach ($suggest as $feed) { ?>
|
|
||||||
<a href="<?=htmlspecialchars('?do=1&rss_url='.urlencode($feed['feed_url']))?>"><?=htmlspecialchars($feed['feed_title'])?></a> <a href="<?=htmlspecialchars($feed['feed_link'])?>"><img src="image/external.png" alt=" " width="10" height="10" /></a> – <?=$feed['readers']?> readers<br />
|
|
||||||
<?php } ?>
|
|
||||||
</p>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(count($feeds))
|
if(count($feeds))
|
||||||
{
|
{
|
||||||
print("<script>\nwindow.onload = ajaxadd;\nfeedslist = [");
|
print("<script>\nwindow.onload = ajaxadd;\nfeedslist = [");
|
||||||
|
|
||||||
foreach($feeds as $feed)
|
foreach($feeds as $feed)
|
||||||
|
{
|
||||||
$feedjson[] = "{'url': '" . addslashes($feed) . "'}";
|
$feedjson[] = "{'url': '" . addslashes($feed) . "'}";
|
||||||
|
}
|
||||||
|
|
||||||
print(join($feedjson, ", "));
|
print(join($feedjson, ", "));
|
||||||
print("];\n</script>");
|
print("];\n</script>");
|
||||||
}
|
}
|
||||||
print("<br />");
|
print("<br>");
|
||||||
|
|
||||||
include("footer.php");
|
include("footer.php");
|
||||||
|
?>
|
||||||
|
|
|
@ -18,23 +18,22 @@ class FoF_Prefs
|
||||||
var $prefs;
|
var $prefs;
|
||||||
var $admin_prefs;
|
var $admin_prefs;
|
||||||
|
|
||||||
function __construct($user_id)
|
function FoF_Prefs($user_id)
|
||||||
{
|
{
|
||||||
global $FOF_USER_TABLE;
|
global $FOF_USER_TABLE;
|
||||||
|
|
||||||
$this->user_id = $user_id;
|
$this->user_id = $user_id;
|
||||||
|
|
||||||
$result = fof_safe_query("select user_prefs from $FOF_USER_TABLE where user_id = %d", $user_id);
|
$result = fof_safe_query("select user_prefs from $FOF_USER_TABLE where user_id = %d", $user_id);
|
||||||
$row = fof_db_get_row($result);
|
$row = mysql_fetch_array($result);
|
||||||
$prefs = unserialize($row['user_prefs']);
|
$prefs = unserialize($row['user_prefs']);
|
||||||
if(!is_array($prefs))
|
if(!is_array($prefs)) $prefs = array();
|
||||||
$prefs = array();
|
|
||||||
$this->prefs = $prefs;
|
$this->prefs = $prefs;
|
||||||
|
|
||||||
if($user_id != 1)
|
if($user_id != 1)
|
||||||
{
|
{
|
||||||
$result = fof_safe_query("select user_prefs from $FOF_USER_TABLE where user_id = 1");
|
$result = fof_safe_query("select user_prefs from $FOF_USER_TABLE where user_id = 1");
|
||||||
$row = fof_db_get_row($result);
|
$row = mysql_fetch_array($result);
|
||||||
$admin_prefs = unserialize($row['user_prefs']);
|
$admin_prefs = unserialize($row['user_prefs']);
|
||||||
if(!is_array($admin_prefs)) $admin_prefs = array();
|
if(!is_array($admin_prefs)) $admin_prefs = array();
|
||||||
$this->admin_prefs = $admin_prefs;
|
$this->admin_prefs = $admin_prefs;
|
||||||
|
@ -52,13 +51,10 @@ class FoF_Prefs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function instance()
|
function &instance()
|
||||||
{
|
{
|
||||||
static $instance;
|
static $instance;
|
||||||
if(!isset($instance))
|
if(!isset($instance)) $instance = new FoF_Prefs(fof_current_user());
|
||||||
{
|
|
||||||
$instance = new FoF_Prefs(fof_current_user());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
@ -76,10 +72,10 @@ class FoF_Prefs
|
||||||
);
|
);
|
||||||
|
|
||||||
$admin_defaults = array(
|
$admin_defaults = array(
|
||||||
"purge" => '',
|
"purge" => 30,
|
||||||
"autotimeout" => 30,
|
"autotimeout" => 30,
|
||||||
"manualtimeout" => 15,
|
"manualtimeout" => 15,
|
||||||
"logging" => true,
|
"logging" => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->stuff_array($this->prefs, $defaults);
|
$this->stuff_array($this->prefs, $defaults);
|
||||||
|
@ -89,13 +85,14 @@ class FoF_Prefs
|
||||||
function stuff_array(&$array, $defaults)
|
function stuff_array(&$array, $defaults)
|
||||||
{
|
{
|
||||||
foreach($defaults as $k => $v)
|
foreach($defaults as $k => $v)
|
||||||
if(!isset($array[$k]))
|
{
|
||||||
$array[$k] = $v;
|
if(!isset($array[$k])) $array[$k] = $v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get($k)
|
function get($k)
|
||||||
{
|
{
|
||||||
return isset($this->prefs[$k]) ? $this->prefs[$k] : NULL;
|
return $this->prefs[$k];
|
||||||
}
|
}
|
||||||
|
|
||||||
function set($k, $v)
|
function set($k, $v)
|
||||||
|
@ -108,3 +105,5 @@ class FoF_Prefs
|
||||||
fof_db_save_prefs($this->user_id, $this->prefs);
|
fof_db_save_prefs($this->user_id, $this->prefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
# Функция для установки прокси из переменных окружения для cURL'а < 7.3 (да и > тоже),
|
|
||||||
# который, тупая тварь, не умеет это делать самостоятельно. Используется у нас в FeedOnFeeds и MediaWiki.
|
|
||||||
# vfilippov@custis.ru, 2010-03-03
|
|
||||||
|
|
||||||
class CurlEnvProxy
|
|
||||||
{
|
|
||||||
|
|
||||||
static function set($curl, $url)
|
|
||||||
{
|
|
||||||
if ($proxy = getenv("http_proxy"))
|
|
||||||
{
|
|
||||||
$useproxy = true;
|
|
||||||
if ($url && ($noproxy = preg_split("#\s*,\s*#is", getenv("no_proxy"))))
|
|
||||||
{
|
|
||||||
foreach ($noproxy as $n)
|
|
||||||
{
|
|
||||||
if (preg_match('#(\d+)\.(\d+)\.(\d+)\.(\d+)/(\d+)#s', $n, $m) &&
|
|
||||||
preg_match('#^[a-z0-9_]+://(?:[^/]*:[^/]*@)?([^/@]+)(?:/|$|\?)#is', $url, $ip))
|
|
||||||
{
|
|
||||||
$mask = array(
|
|
||||||
max(0x100 - (1 << max( 8-$m[5], 0)), 0),
|
|
||||||
max(0x100 - (1 << max(16-$m[5], 0)), 0),
|
|
||||||
max(0x100 - (1 << max(24-$m[5], 0)), 0),
|
|
||||||
max(0x100 - (1 << max(32-$m[5], 0)), 0),
|
|
||||||
);
|
|
||||||
$ip = @gethostbyname($ip[1]);
|
|
||||||
if (preg_match('#(\d+)\.(\d+)\.(\d+)\.(\d+)#s', $ip, $ipm) &&
|
|
||||||
(intval($ipm[1]) & $mask[0]) == intval($m[1]) &&
|
|
||||||
(intval($ipm[2]) & $mask[1]) == intval($m[2]) &&
|
|
||||||
(intval($ipm[3]) & $mask[2]) == intval($m[3]) &&
|
|
||||||
(intval($ipm[4]) & $mask[3]) == intval($m[4]))
|
|
||||||
{
|
|
||||||
$useproxy = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$n = preg_replace('/#.*$/is', '', $n);
|
|
||||||
$n = preg_quote($n);
|
|
||||||
$n = str_replace('\\*', '.*', $n);
|
|
||||||
if (preg_match('#'.$n.'#is', $url))
|
|
||||||
{
|
|
||||||
$useproxy = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($useproxy)
|
|
||||||
{
|
|
||||||
$proxy = preg_replace('#^http://#is', '', $proxy);
|
|
||||||
$proxy = preg_replace('#/*$#is', '', $proxy);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$proxy = '';
|
|
||||||
curl_setopt($curl, CURLOPT_PROXY, $proxy);
|
|
||||||
}
|
|
||||||
return $proxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
BIN
favicon.ico
Before Width: | Height: | Size: 1.1 KiB |
10
favicon.php
|
@ -4,15 +4,16 @@
|
||||||
*
|
*
|
||||||
* favicon.php - displays an image cached by SimplePie
|
* favicon.php - displays an image cached by SimplePie
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 Stephen Minutillo steve@minutillo.com http://minutillo.com/steve/
|
*
|
||||||
* (C) 2009-2014 Vitaliy Filippov vitalif@mail.ru http://yourcmc.ru/wiki/
|
* Copyright (C) 2004-2007 Stephen Minutillo
|
||||||
|
* steve@minutillo.com - http://minutillo.com/steve/
|
||||||
*
|
*
|
||||||
* Distributed under the GPL - see LICENSE
|
* Distributed under the GPL - see LICENSE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
require_once('simplepie/simplepie.php');
|
require_once('simplepie/simplepie.inc');
|
||||||
|
|
||||||
if(file_exists("./cache/" . $_GET['i'] . ".spi"))
|
if(file_exists("./cache/" . md5($_GET[i]) . ".spi"))
|
||||||
{
|
{
|
||||||
SimplePie_Misc::display_cached_file($_GET['i'], './cache', 'spi');
|
SimplePie_Misc::display_cached_file($_GET['i'], './cache', 'spi');
|
||||||
}
|
}
|
||||||
|
@ -20,3 +21,4 @@ else
|
||||||
{
|
{
|
||||||
header("Location: image/feed-icon.png");
|
header("Location: image/feed-icon.png");
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|
|
@ -4,14 +4,15 @@
|
||||||
*
|
*
|
||||||
* config.php - modify this file with your database settings
|
* config.php - modify this file with your database settings
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* Copyright (C) 2004-2007 Stephen Minutillo
|
* Copyright (C) 2004-2007 Stephen Minutillo
|
||||||
* (C) 2010+ Vitaliy Filippov
|
|
||||||
* steve@minutillo.com - http://minutillo.com/steve/
|
* steve@minutillo.com - http://minutillo.com/steve/
|
||||||
*
|
*
|
||||||
* Distributed under the GPL - see LICENSE
|
* Distributed under the GPL - see LICENSE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Database connection information. Host, username, password, database name.
|
// Database connection information. Host, username, password, database name.
|
||||||
|
|
||||||
define('FOF_DB_HOST', "host.example.com");
|
define('FOF_DB_HOST', "host.example.com");
|
||||||
|
@ -19,9 +20,6 @@ define('FOF_DB_USER', "username");
|
||||||
define('FOF_DB_PASS', "password");
|
define('FOF_DB_PASS', "password");
|
||||||
define('FOF_DB_DBNAME', "database");
|
define('FOF_DB_DBNAME', "database");
|
||||||
|
|
||||||
/* You may write an auth plugin by defining function fof_require_user_hook() {}
|
|
||||||
* which should try to detect current user and then call fof_set_current_user($user);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// The rest you should not need to change
|
// The rest you should not need to change
|
||||||
|
|
||||||
|
@ -36,6 +34,7 @@ define('FOF_SUBSCRIPTION_TABLE', FOF_DB_PREFIX . "subscription");
|
||||||
define('FOF_TAG_TABLE', FOF_DB_PREFIX . "tag");
|
define('FOF_TAG_TABLE', FOF_DB_PREFIX . "tag");
|
||||||
define('FOF_USER_TABLE', FOF_DB_PREFIX . "user");
|
define('FOF_USER_TABLE', FOF_DB_PREFIX . "user");
|
||||||
|
|
||||||
|
|
||||||
// Find ourselves and the cache dir
|
// Find ourselves and the cache dir
|
||||||
|
|
||||||
if (!defined('DIR_SEP')) {
|
if (!defined('DIR_SEP')) {
|
||||||
|
@ -45,3 +44,5 @@ if (!defined('DIR_SEP')) {
|
||||||
if (!defined('FOF_DIR')) {
|
if (!defined('FOF_DIR')) {
|
||||||
define('FOF_DIR', dirname(__FILE__) . DIR_SEP);
|
define('FOF_DIR', dirname(__FILE__) . DIR_SEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
780
fof-db.php
604
fof-main.php
|
@ -4,8 +4,9 @@
|
||||||
*
|
*
|
||||||
* fof-main.php - initializes FoF, and contains functions used from other scripts
|
* fof-main.php - initializes FoF, and contains functions used from other scripts
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 Stephen Minutillo steve@minutillo.com http://minutillo.com/steve/
|
*
|
||||||
* (C) 2009-2014 Vitaliy Filippov vitalif@mail.ru http://yourcmc.ru/wiki/
|
* Copyright (C) 2004-2007 Stephen Minutillo
|
||||||
|
* steve@minutillo.com - http://minutillo.com/steve/
|
||||||
*
|
*
|
||||||
* Distributed under the GPL - see LICENSE
|
* Distributed under the GPL - see LICENSE
|
||||||
*
|
*
|
||||||
|
@ -19,27 +20,23 @@ if ( !file_exists( dirname(__FILE__) . '/fof-config.php') )
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('fof-config.php');
|
require_once("fof-config.php");
|
||||||
require_once('fof-db.php');
|
require_once("fof-db.php");
|
||||||
require_once('classes/fof-prefs.php');
|
require_once("classes/fof-prefs.php");
|
||||||
require_once('simplepie/simplepie.php');
|
|
||||||
|
|
||||||
$fof_item_prefilters = array();
|
|
||||||
$fof_tag_prefilters = array();
|
|
||||||
|
|
||||||
fof_db_connect();
|
fof_db_connect();
|
||||||
|
|
||||||
if (empty($fof_installer))
|
if(!$fof_installer)
|
||||||
{
|
{
|
||||||
if (empty($fof_no_login))
|
if(!$fof_no_login)
|
||||||
{
|
{
|
||||||
require_user();
|
require_user();
|
||||||
$fof_prefs_obj = FoF_Prefs::instance();
|
$fof_prefs_obj =& FoF_Prefs::instance();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fof_user_id = 1;
|
$fof_user_id = 1;
|
||||||
$fof_prefs_obj = FoF_Prefs::instance();
|
$fof_prefs_obj =& FoF_Prefs::instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -47,6 +44,8 @@ if (empty($fof_installer))
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once('simplepie/simplepie.inc');
|
||||||
|
|
||||||
function fof_set_content_type()
|
function fof_set_content_type()
|
||||||
{
|
{
|
||||||
static $set;
|
static $set;
|
||||||
|
@ -79,15 +78,19 @@ function fof_log($message, $topic="debug")
|
||||||
|
|
||||||
function require_user()
|
function require_user()
|
||||||
{
|
{
|
||||||
// FIXME Пилять! Да это же по безопасности, как HTTP Basic авторизация! :-(
|
if(!isset($_COOKIE["user_name"]) || !isset($_COOKIE["user_password_hash"]))
|
||||||
if (empty($_COOKIE["user_name"]) || empty($_COOKIE["user_password_hash"]) || !fof_authenticate($_COOKIE["user_name"], $_COOKIE["user_password_hash"]))
|
|
||||||
{
|
{
|
||||||
if (!function_exists('fof_require_user_hook') ||
|
Header("Location: login.php");
|
||||||
!fof_require_user_hook())
|
exit();
|
||||||
{
|
|
||||||
header("Location: login.php");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user_name = $_COOKIE["user_name"];
|
||||||
|
$user_password_hash = $_COOKIE["user_password_hash"];
|
||||||
|
|
||||||
|
if(!fof_authenticate($user_name, $user_password_hash))
|
||||||
|
{
|
||||||
|
Header("Location: login.php");
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +110,6 @@ function fof_logout()
|
||||||
{
|
{
|
||||||
setcookie ( "user_name", "", time() );
|
setcookie ( "user_name", "", time() );
|
||||||
setcookie ( "user_password_hash", "", time() );
|
setcookie ( "user_password_hash", "", time() );
|
||||||
setcookie ( "logged_out", "1", time() + 300 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_current_user()
|
function fof_current_user()
|
||||||
|
@ -131,7 +133,7 @@ function fof_get_users()
|
||||||
|
|
||||||
function fof_prefs()
|
function fof_prefs()
|
||||||
{
|
{
|
||||||
$p = FoF_Prefs::instance();
|
$p =& FoF_Prefs::instance();
|
||||||
return $p->prefs;
|
return $p->prefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +157,7 @@ function fof_get_tags($user_id)
|
||||||
|
|
||||||
$counts = fof_db_get_tag_unread($user_id);
|
$counts = fof_db_get_tag_unread($user_id);
|
||||||
|
|
||||||
foreach ($result as $row)
|
while($row = fof_db_get_row($result))
|
||||||
{
|
{
|
||||||
if(isset($counts[$row['tag_id']]))
|
if(isset($counts[$row['tag_id']]))
|
||||||
$row['unread'] = $counts[$row['tag_id']];
|
$row['unread'] = $counts[$row['tag_id']];
|
||||||
|
@ -185,31 +187,55 @@ function fof_get_item_tags($user_id, $item_id)
|
||||||
function fof_tag_feed($user_id, $feed_id, $tag)
|
function fof_tag_feed($user_id, $feed_id, $tag)
|
||||||
{
|
{
|
||||||
$tag_id = fof_db_get_tag_by_name($user_id, $tag);
|
$tag_id = fof_db_get_tag_by_name($user_id, $tag);
|
||||||
if (!$tag_id)
|
if($tag_id == NULL)
|
||||||
{
|
{
|
||||||
$tag_id = fof_db_create_tag($user_id, $tag);
|
$tag_id = fof_db_create_tag($user_id, $tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result = fof_db_get_items($user_id, $feed_id, $what="all", NULL, NULL);
|
||||||
|
|
||||||
|
foreach($result as $r)
|
||||||
|
{
|
||||||
|
$items[] = $r['item_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
fof_db_tag_items($user_id, $tag_id, $items);
|
||||||
|
|
||||||
fof_db_tag_feed($user_id, $feed_id, $tag_id);
|
fof_db_tag_feed($user_id, $feed_id, $tag_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_untag_feed($user_id, $feed_id, $tag)
|
function fof_untag_feed($user_id, $feed_id, $tag)
|
||||||
{
|
{
|
||||||
$tag_id = fof_db_get_tag_by_name($user_id, $tag);
|
$tag_id = fof_db_get_tag_by_name($user_id, $tag);
|
||||||
if ($tag_id)
|
if($tag_id == NULL)
|
||||||
{
|
|
||||||
fof_db_untag_feed($user_id, $feed_id, $tag_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function fof_tag_item($user_id, $item_id, $tags)
|
|
||||||
{
|
|
||||||
foreach((array)$tags as $tag)
|
|
||||||
{
|
|
||||||
$tag_id = fof_db_get_tag_by_name($user_id, $tag);
|
|
||||||
if (!$tag_id)
|
|
||||||
{
|
{
|
||||||
$tag_id = fof_db_create_tag($user_id, $tag);
|
$tag_id = fof_db_create_tag($user_id, $tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result = fof_db_get_items($user_id, $feed_id, $what="all", NULL, NULL);
|
||||||
|
|
||||||
|
foreach($result as $r)
|
||||||
|
{
|
||||||
|
$items[] = $r['item_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
fof_db_untag_items($user_id, $tag_id, $items);
|
||||||
|
|
||||||
|
fof_db_untag_feed($user_id, $feed_id, $tag_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fof_tag_item($user_id, $item_id, $tag)
|
||||||
|
{
|
||||||
|
if(is_array($tag)) $tags = $tag; else $tags[] = $tag;
|
||||||
|
|
||||||
|
foreach($tags as $tag)
|
||||||
|
{
|
||||||
|
$tag_id = fof_db_get_tag_by_name($user_id, $tag);
|
||||||
|
if($tag_id == NULL)
|
||||||
|
{
|
||||||
|
$tag_id = fof_db_create_tag($user_id, $tag);
|
||||||
|
}
|
||||||
|
|
||||||
fof_db_tag_items($user_id, $tag_id, $item_id);
|
fof_db_tag_items($user_id, $tag_id, $item_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,97 +322,114 @@ function fof_get_feeds($user_id, $order = 'feed_title', $direction = 'asc')
|
||||||
|
|
||||||
$result = fof_db_get_subscriptions($user_id);
|
$result = fof_db_get_subscriptions($user_id);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
while($row = fof_db_get_row($result))
|
while($row = fof_db_get_row($result))
|
||||||
{
|
{
|
||||||
|
$id = $row['feed_id'];
|
||||||
$age = $row['feed_cache_date'];
|
$age = $row['feed_cache_date'];
|
||||||
|
|
||||||
|
$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);
|
list($agestr, $agestrabbr) = fof_nice_time_stamp($age);
|
||||||
$feeds[$row['feed_id']] = array(
|
|
||||||
'prefs' => unserialize($row['subscription_prefs']),
|
$feeds[$i]['agestr'] = $agestr;
|
||||||
'feed_id' => $row['feed_id'],
|
$feeds[$i]['agestrabbr'] = $agestrabbr;
|
||||||
'feed_url' => $row['feed_url'],
|
|
||||||
'feed_title' => $row['feed_title'],
|
$i++;
|
||||||
'feed_link' => $row['feed_link'],
|
|
||||||
'feed_description' => $row['feed_description'],
|
|
||||||
'feed_image' => $row['feed_image'],
|
|
||||||
'feed_age' => $age,
|
|
||||||
'agestr' => $agestr,
|
|
||||||
'agestrabbr' => $agestrabbr,
|
|
||||||
'feed_items' => 0,
|
|
||||||
'feed_read' => 0,
|
|
||||||
'feed_unread' => 0,
|
|
||||||
'feed_starred' => 0,
|
|
||||||
'max_date' => NULL,
|
|
||||||
'lateststr' => '',
|
|
||||||
'lateststrabbr' => '',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags = fof_db_get_tag_id_map();
|
$tags = fof_db_get_tag_id_map();
|
||||||
|
|
||||||
foreach ($feeds as &$feed)
|
for($i=0; $i<count($feeds); $i++)
|
||||||
{
|
{
|
||||||
$feed['tags'] = array();
|
$feeds[$i]['tags'] = array();
|
||||||
if (is_array($feed['prefs']['tags']))
|
if(is_array($feeds[$i]['prefs']['tags']))
|
||||||
{
|
{
|
||||||
foreach ($feed['prefs']['tags'] as $tag)
|
foreach($feeds[$i]['prefs']['tags'] as $tag)
|
||||||
{
|
{
|
||||||
$feed['tags'][] = $tags[$tag];
|
$feeds[$i]['tags'][] = $tags[$tag];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = fof_db_get_item_count($user_id);
|
$result = fof_db_get_item_count($user_id);
|
||||||
|
|
||||||
while($row = fof_db_get_row($result))
|
while($row = fof_db_get_row($result))
|
||||||
{
|
{
|
||||||
$feeds[$row['id']]['feed_items'] = $row['count'];
|
for($i=0; $i<count($feeds); $i++)
|
||||||
$feeds[$row['id']]['feed_read'] = $row['count'];
|
{
|
||||||
|
if($feeds[$i]['feed_id'] == $row['id'])
|
||||||
|
{
|
||||||
|
$feeds[$i]['feed_items'] = $row['count'];
|
||||||
|
$feeds[$i]['feed_read'] = $row['count'];
|
||||||
|
$feeds[$i]['feed_unread'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = fof_db_get_tagged_item_count($user_id, 1);
|
$result = fof_db_get_unread_item_count($user_id);
|
||||||
|
|
||||||
while($row = fof_db_get_row($result))
|
while($row = fof_db_get_row($result))
|
||||||
{
|
{
|
||||||
$feeds[$row['id']]['feed_unread'] = $row['count'];
|
for($i=0; $i<count($feeds); $i++)
|
||||||
|
{
|
||||||
|
if($feeds[$i]['feed_id'] == $row['id'])
|
||||||
|
{
|
||||||
|
$feeds[$i]['feed_unread'] = $row['count'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = fof_db_get_tagged_item_count($user_id, 2);
|
foreach($feeds as $feed)
|
||||||
|
{
|
||||||
|
$feed['feed_starred'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = fof_db_get_starred_item_count($user_id);
|
||||||
|
|
||||||
while($row = fof_db_get_row($result))
|
while($row = fof_db_get_row($result))
|
||||||
{
|
{
|
||||||
$feeds[$row['id']]['feed_starred'] = $row['count'];
|
for($i=0; $i<count($feeds); $i++)
|
||||||
|
{
|
||||||
|
if($feeds[$i]['feed_id'] == $row['id'])
|
||||||
|
{
|
||||||
|
$feeds[$i]['feed_starred'] = $row['count'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = fof_db_get_latest_item_age($user_id);
|
$result = fof_db_get_latest_item_age($user_id);
|
||||||
|
|
||||||
while($row = fof_db_get_row($result))
|
while($row = fof_db_get_row($result))
|
||||||
{
|
{
|
||||||
if (!isset($feeds[$row['id']]))
|
for($i=0; $i<count($feeds); $i++)
|
||||||
{
|
{
|
||||||
var_dump($row);
|
if($feeds[$i]['feed_id'] == $row['id'])
|
||||||
die();
|
{
|
||||||
}
|
$feeds[$i]['max_date'] = $row['max_date'];
|
||||||
$feeds[$row['id']]['max_date'] = $row['max_date'];
|
|
||||||
list($agestr, $agestrabbr) = fof_nice_time_stamp($row['max_date']);
|
list($agestr, $agestrabbr) = fof_nice_time_stamp($row['max_date']);
|
||||||
$feeds[$row['id']]['lateststr'] = $agestr;
|
|
||||||
$feeds[$row['id']]['lateststrabbr'] = $agestrabbr;
|
$feeds[$i]['lateststr'] = $agestr;
|
||||||
|
$feeds[$i]['lateststrabbr'] = $agestrabbr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$feeds = fof_multi_sort($feeds, $order, $direction != "asc");
|
$feeds = fof_multi_sort($feeds, $order, $direction != "asc");
|
||||||
|
|
||||||
return $feeds;
|
return $feeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_feed_title($feed, $prefs = NULL)
|
|
||||||
{
|
|
||||||
if (!$prefs && !empty($feed['prefs']))
|
|
||||||
{
|
|
||||||
$prefs = $feed['prefs'];
|
|
||||||
}
|
|
||||||
if (!$prefs)
|
|
||||||
{
|
|
||||||
$prefs = fof_db_get_subscription_prefs(fof_current_user(), $feed['feed_id']);
|
|
||||||
}
|
|
||||||
$t = !empty($prefs['feed_title']) ? $prefs['feed_title'] : $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();
|
||||||
|
@ -396,36 +439,24 @@ function fof_view_title($feed = NULL, $what = "new", $when = NULL, $start = NULL
|
||||||
{
|
{
|
||||||
$title .= ' - ' . $when ;
|
$title .= ' - ' . $when ;
|
||||||
}
|
}
|
||||||
|
if(!is_null($feed) && $feed != "")
|
||||||
if (!is_null($feed) && $feed != "" &&
|
|
||||||
($r = fof_db_get_feed_by_id($feed)))
|
|
||||||
{
|
{
|
||||||
$title .= ' - ' . htmlspecialchars(fof_feed_title($r), ENT_QUOTES);
|
$r = fof_db_get_feed_by_id($feed);
|
||||||
|
$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")
|
||||||
{
|
{
|
||||||
$wh = array();
|
$title .=' - new items';
|
||||||
$new = '';
|
}
|
||||||
foreach(explode(',', $what) as $t)
|
else
|
||||||
{
|
{
|
||||||
if ($t == 'unread')
|
|
||||||
$new = ' new';
|
|
||||||
else
|
|
||||||
$wh[] = $t;
|
|
||||||
}
|
|
||||||
$title .= ' -' . $new . ' items';
|
|
||||||
if (count($wh))
|
|
||||||
$title .= ' tagged '.implode(',', $wh);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$title .= ' - all items';
|
$title .= ' - all items';
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($search))
|
if(isset($search))
|
||||||
{
|
{
|
||||||
|
@ -440,11 +471,13 @@ 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;
|
||||||
|
@ -455,9 +488,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -476,7 +511,7 @@ function fof_delete_subscription($user_id, $feed_id)
|
||||||
{
|
{
|
||||||
fof_db_delete_subscription($user_id, $feed_id);
|
fof_db_delete_subscription($user_id, $feed_id);
|
||||||
|
|
||||||
if (fof_num_rows(fof_db_get_subscribed_users($feed_id)) == 0)
|
if(mysql_num_rows(fof_get_subscribed_users($feed_id)) == 0)
|
||||||
{
|
{
|
||||||
fof_db_delete_feed($feed_id);
|
fof_db_delete_feed($feed_id);
|
||||||
}
|
}
|
||||||
|
@ -490,9 +525,13 @@ 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);
|
||||||
|
|
||||||
|
@ -511,9 +550,9 @@ function fof_get_nav_links($feed=NULL, $what="new", $when=NULL, $start=NULL, $li
|
||||||
$earlier = $start + $limit;
|
$earlier = $start + $limit;
|
||||||
$later = $start - $limit;
|
$later = $start - $limit;
|
||||||
|
|
||||||
$string .= "<a href=\".?feed=$feed&what=$what&when=$when&which=$earlier&howmany=$limit\">[« previous $limit]</a> ";
|
$string .= "<a href=\".?feed=$feed&what=$what&when=$when&how=paged&which=$earlier&howmany=$limit\">[« previous $limit]</a> ";
|
||||||
if($later >= 0) $string .= "<a href=\".?feed=$feed&what=$what&when=$when&howmany=$limit\">[current items]</a> ";
|
if($later >= 0) $string .= "<a href=\".?feed=$feed&what=$what&when=$when&how=paged&howmany=$limit\">[current items]</a> ";
|
||||||
if($later >= 0) $string .= "<a href=\".?feed=$feed&what=$what&when=$when&which=$later&howmany=$limit\">[next $limit »]</a> ";
|
if($later >= 0) $string .= "<a href=\".?feed=$feed&what=$what&when=$when&how=paged&which=$later&howmany=$limit\">[next $limit »]</a> ";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
|
@ -523,11 +562,11 @@ function fof_render_feed_link($row)
|
||||||
{
|
{
|
||||||
$link = $row['feed_link'];
|
$link = $row['feed_link'];
|
||||||
$description = $row['feed_description'];
|
$description = $row['feed_description'];
|
||||||
$title = htmlspecialchars(fof_feed_title($row), ENT_QUOTES);
|
$title = $row['feed_title'];
|
||||||
$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> ";
|
||||||
$s .= "<a href=\"$url\">(feed)</a>";
|
$s .= "<a href=\"$url\">(rss)</a>";
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
@ -554,21 +593,24 @@ function fof_prepare_url($url)
|
||||||
if(substr($url, 0, 7) == "feed://") $url = substr($url, 7);
|
if(substr($url, 0, 7) == "feed://") $url = substr($url, 7);
|
||||||
|
|
||||||
if(substr($url, 0, 7) != 'http://' && substr($url, 0, 8) != 'https://')
|
if(substr($url, 0, 7) != 'http://' && substr($url, 0, 8) != 'https://')
|
||||||
|
{
|
||||||
$url = 'http://' . $url;
|
$url = 'http://' . $url;
|
||||||
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_subscribe($user_id, $url, $unread="today")
|
function fof_subscribe($user_id, $url, $unread="today")
|
||||||
{
|
{
|
||||||
if (!$url)
|
if(!$url) return false;
|
||||||
return array("Empty URL", false);
|
|
||||||
|
|
||||||
$url = fof_prepare_url($url);
|
$url = fof_prepare_url($url);
|
||||||
$feed = fof_db_get_feed_by_url($url);
|
$feed = fof_db_get_feed_by_url($url);
|
||||||
|
|
||||||
if(fof_is_subscribed($user_id, $url))
|
if(fof_is_subscribed($user_id, $url))
|
||||||
return array("You are already subscribed to " . fof_render_feed_link($feed), $feed);
|
{
|
||||||
|
return "You are already subscribed to " . fof_render_feed_link($feed) . "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
if(fof_feed_exists($url))
|
if(fof_feed_exists($url))
|
||||||
{
|
{
|
||||||
|
@ -576,51 +618,61 @@ function fof_subscribe($user_id, $url, $unread = "today")
|
||||||
fof_apply_plugin_tags($id, NULL, $user_id);
|
fof_apply_plugin_tags($id, NULL, $user_id);
|
||||||
fof_update_feed($feed['feed_id']);
|
fof_update_feed($feed['feed_id']);
|
||||||
|
|
||||||
if ($unread != "no")
|
if($unread != "no") fof_db_mark_feed_unread($user_id, $feed['feed_id'], $unread);
|
||||||
fof_db_mark_feed_unread($user_id, $feed['feed_id'], $unread);
|
return '<font color="green"><b>Subscribed.</b></font><br>';
|
||||||
return array('<font color="green"><b>Subscribed.</b></font>', $feed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$rss = fof_parse($url, $user_id);
|
$rss = fof_parse($url);
|
||||||
|
|
||||||
if (isset($rss->error))
|
if (isset($rss->error))
|
||||||
return array("Error: <b>" . $rss->error . "</b>", $feed);
|
{
|
||||||
|
return "Error: <B>" . $rss->error . "</b> <a href=\"http://feedvalidator.org/check?url=$url\">try to validate it?</a><br>";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Changing saved feed URL automatically is a fucking bad idea!
|
$url = html_entity_decode($rss->subscribe_url(), ENT_QUOTES);
|
||||||
// It's very unpleasant to see that URL just changed sometime
|
$self = $rss->get_link(0, 'self');
|
||||||
// by itself because the remote site had an error and gave FOF
|
if($self) $url = html_entity_decode($self, ENT_QUOTES);
|
||||||
// some crap instead of real feed.
|
|
||||||
// The another problem is handling feeds with authorization data
|
|
||||||
// in the feed link: such feeds don't usually include login and
|
|
||||||
// password inside the 'self' link.
|
|
||||||
// So we don't change URLs in any way (original FOF did).
|
|
||||||
|
|
||||||
$id = fof_add_feed($url, rss_feed_title($rss), $rss->get_link(), $rss->get_description());
|
if(fof_feed_exists($url))
|
||||||
|
{
|
||||||
|
$feed = fof_db_get_feed_by_url($url);
|
||||||
|
|
||||||
|
if(fof_is_subscribed($user_id, $url))
|
||||||
|
{
|
||||||
|
return "You are already subscribed to " . fof_render_feed_link($feed) . "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
fof_db_add_subscription($user_id, $feed['feed_id']);
|
||||||
|
if($unread != "no") fof_db_mark_feed_unread($user_id, $feed['feed_id'], $unread);
|
||||||
|
|
||||||
|
return '<font color="green"><b>Subscribed.</b></font><br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = fof_add_feed($url, $rss->get_title(), $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);
|
||||||
if ($unread != "no")
|
if($unread != "no") fof_db_mark_feed_unread($user_id, $id, $unread);
|
||||||
fof_db_mark_feed_unread($user_id, $id, $unread);
|
|
||||||
|
|
||||||
fof_apply_plugin_tags($id, NULL, $user_id);
|
fof_apply_plugin_tags($id, NULL, $user_id);
|
||||||
|
|
||||||
$feed = fof_db_get_feed_by_id($id);
|
return '<font color="green"><b>Subscribed.</b></font><br>';
|
||||||
return array('<font color="green"><b>Subscribed.</b></font>', $feed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_add_feed($url, $title, $link, $description)
|
function fof_add_feed($url, $title, $link, $description)
|
||||||
{
|
{
|
||||||
if ($title == "")
|
if($title == "") $title = "[no title]";
|
||||||
$title = "[no title]";
|
|
||||||
|
|
||||||
return fof_db_add_feed($url, $title, $link, $description);
|
$id = fof_db_add_feed($url, $title, $link, $description);
|
||||||
|
|
||||||
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_is_subscribed($user_id, $url)
|
function fof_is_subscribed($user_id, $url)
|
||||||
{
|
{
|
||||||
return fof_db_is_subscribed($user_id, $url);
|
return(fof_db_is_subscribed($user_id, $url));
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_feed_exists($url)
|
function fof_feed_exists($url)
|
||||||
|
@ -630,28 +682,29 @@ function fof_feed_exists($url)
|
||||||
return $feed;
|
return $feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_generate_sudo_id()
|
function fof_get_subscribed_users($feed_id)
|
||||||
{
|
{
|
||||||
global $fof_sudo_id_user;
|
return(fof_db_get_subscribed_users($feed_id));
|
||||||
$sudo_id = unpack('H*', urandom(16));
|
|
||||||
$sudo_id = $sudo_id[1];
|
|
||||||
fof_cache_set("sudo-$sudo_id", $fof_sudo_id_user, 30);
|
|
||||||
return "fof_sudo_id=$sudo_id";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_parse($url, $as_user = NULL)
|
function fof_mark_item_unread($feed_id, $id)
|
||||||
{
|
{
|
||||||
$p = FoF_Prefs::instance();
|
$result = fof_get_subscribed_users($feed_id);
|
||||||
|
|
||||||
|
while($row = fof_db_get_row($result))
|
||||||
|
{
|
||||||
|
$users[] = $row['user_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
fof_db_mark_item_unread($users, $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fof_parse($url)
|
||||||
|
{
|
||||||
|
$p =& FoF_Prefs::instance();
|
||||||
$admin_prefs = $p->admin_prefs;
|
$admin_prefs = $p->admin_prefs;
|
||||||
|
|
||||||
$pie = new SimplePie();
|
$pie = new SimplePie();
|
||||||
/* Bug 63447 - Allow FoF to securely pass user authorization without verification */
|
|
||||||
if (!is_null($as_user) && strpos($url, "fof_sudo") !== false)
|
|
||||||
{
|
|
||||||
global $fof_sudo_id_user;
|
|
||||||
$fof_sudo_id_user = $as_user;
|
|
||||||
$pie->headers['Cookie'] = new SimplePie_Callback('fof_generate_sudo_id');
|
|
||||||
}
|
|
||||||
$pie->set_cache_duration($admin_prefs["manualtimeout"] * 60);
|
$pie->set_cache_duration($admin_prefs["manualtimeout"] * 60);
|
||||||
$pie->set_favicon_handler("favicon.php");
|
$pie->set_favicon_handler("favicon.php");
|
||||||
$pie->set_feed_url($url);
|
$pie->set_feed_url($url);
|
||||||
|
@ -662,53 +715,30 @@ function fof_parse($url, $as_user = NULL)
|
||||||
return $pie;
|
return $pie;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_apply_tags($item)
|
function fof_apply_tags($feed_id, $item_id)
|
||||||
{
|
{
|
||||||
global $fof_subscription_to_tags;
|
global $fof_subscription_to_tags;
|
||||||
|
|
||||||
if(!isset($fof_subscription_to_tags))
|
if(!isset($fof_subscription_to_tags))
|
||||||
|
{
|
||||||
$fof_subscription_to_tags = fof_db_get_subscription_to_tags();
|
$fof_subscription_to_tags = fof_db_get_subscription_to_tags();
|
||||||
|
}
|
||||||
|
|
||||||
// add subscription tags
|
foreach((array)$fof_subscription_to_tags[$feed_id] as $user_id => $tags)
|
||||||
if (!empty($fof_subscription_to_tags[$item['feed_id']]))
|
|
||||||
{
|
{
|
||||||
foreach ($fof_subscription_to_tags[$item['feed_id']] as $user_id => $tags)
|
|
||||||
if(is_array($tags))
|
if(is_array($tags))
|
||||||
|
{
|
||||||
foreach($tags as $tag)
|
foreach($tags as $tag)
|
||||||
fof_db_tag_items($user_id, $tag, $item['item_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$filtered = array();
|
|
||||||
|
|
||||||
// filter duplicate items
|
|
||||||
$dup = fof_db_get_is_duplicate_item($item['item_id'], $item['item_guid'], md5($item['item_content']));
|
|
||||||
foreach ($dup as $user_id)
|
|
||||||
$filtered[$user_id] = true;
|
|
||||||
|
|
||||||
// regexp filter items
|
|
||||||
if (isset($fof_subscription_to_tags['filter'][$item['feed_id']]))
|
|
||||||
{
|
{
|
||||||
foreach ((array)$fof_subscription_to_tags['filter'][$item['feed_id']] as $user_id => $filter)
|
fof_db_tag_items($user_id, $tag, $item_id);
|
||||||
if ($filter && (preg_match($filter, $title) || preg_match($filter, $content)))
|
}
|
||||||
$filtered[$user_id] = true;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark item as unread for some users
|
function fof_update_feed($id)
|
||||||
fof_db_mark_item_unread($item['item_id'], array_keys($filtered));
|
|
||||||
}
|
|
||||||
|
|
||||||
function rss_feed_title($rss)
|
|
||||||
{
|
{
|
||||||
return html_entity_decode(strip_tags($rss->get_title()), ENT_QUOTES);
|
if(!$id) return 0;
|
||||||
}
|
|
||||||
|
|
||||||
function fof_update_feed($id, $as_user = NULL)
|
|
||||||
{
|
|
||||||
if(!$id)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if($as_user === NULL)
|
|
||||||
$as_user = fof_db_get_feed_single_user($id);
|
|
||||||
|
|
||||||
$feed = fof_db_get_feed_by_id($id);
|
$feed = fof_db_get_feed_by_id($id);
|
||||||
$url = $feed['feed_url'];
|
$url = $feed['feed_url'];
|
||||||
|
@ -716,22 +746,19 @@ function fof_update_feed($id, $as_user = NULL)
|
||||||
|
|
||||||
fof_db_feed_mark_attempted_cache($id);
|
fof_db_feed_mark_attempted_cache($id);
|
||||||
|
|
||||||
$rss = fof_parse($feed['feed_url'], $as_user);
|
$rss = fof_parse($feed['feed_url']);
|
||||||
|
|
||||||
if ($rss->error())
|
if ($rss->error())
|
||||||
{
|
{
|
||||||
fof_log("feed update failed: " . $rss->error(), "update");
|
fof_log("feed update failed: " . $rss->error(), "update");
|
||||||
return array(0, "Error: <b>" . $rss->error() . "</b>");
|
return array(0, "Error: <b>" . $rss->error() . "</b> <a href=\"http://feedvalidator.org/check?url=$url\">try to validate it?</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changing saved feed URL automatically is a fucking bad idea!
|
$sub = html_entity_decode($rss->subscribe_url(), ENT_QUOTES);
|
||||||
// It's very unpleasant to see that URL just changed sometime
|
$self_link = $rss->get_link(0, 'self');
|
||||||
// by itself because the remote site had an error and gave FOF
|
if($self_link) $sub = html_entity_decode($self_link, ENT_QUOTES);
|
||||||
// some crap instead of real feed.
|
|
||||||
// The another problem is handling feeds with authorization data
|
fof_log("subscription url is $sub");
|
||||||
// in the feed link: such feeds don't usually include login and
|
|
||||||
// password inside the 'self' link.
|
|
||||||
// So we don't change URLs in any way (original FOF did).
|
|
||||||
|
|
||||||
$image = $feed['feed_image'];
|
$image = $feed['feed_image'];
|
||||||
$image_cache_date = $feed['feed_image_cache_date'];
|
$image_cache_date = $feed['feed_image_cache_date'];
|
||||||
|
@ -742,49 +769,19 @@ function fof_update_feed($id, $as_user = NULL)
|
||||||
$image_cache_date = time();
|
$image_cache_date = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = rss_feed_title($rss);
|
$title = $rss->get_title();
|
||||||
if ($title == "")
|
if($title == "") $title = "[no title]";
|
||||||
$title = "[no title]";
|
|
||||||
|
|
||||||
fof_db_feed_update_metadata($id, $feed['feed_url'], $title,
|
fof_db_feed_update_metadata($id, $sub, $title, $rss->get_link(), $rss->get_description(), $image, $image_cache_date );
|
||||||
$rss->get_link(), $rss->get_description(), $image, $image_cache_date);
|
|
||||||
|
|
||||||
$feed_id = $feed['feed_id'];
|
$feed_id = $feed['feed_id'];
|
||||||
$n = 0;
|
$n = 0;
|
||||||
|
|
||||||
if (!empty($feed['feed_filter']))
|
|
||||||
{
|
|
||||||
$filter = @unserialize($feed['feed_filter']);
|
|
||||||
if (!$filter || !$filter['re'] || !$filter['tags'])
|
|
||||||
$filter = NULL;
|
|
||||||
else
|
|
||||||
$filter['tags'] = preg_split('/[\s,]*,[\s,]*/', $filter['tags']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($rss->get_items())
|
if($rss->get_items())
|
||||||
{
|
{
|
||||||
foreach($rss->get_items() as $item)
|
foreach($rss->get_items() as $item)
|
||||||
{
|
{
|
||||||
$link = $item->get_permalink();
|
$link = $item->get_permalink();
|
||||||
$author = $item->get_authors();
|
|
||||||
if ($author)
|
|
||||||
{
|
|
||||||
foreach ($author as &$a)
|
|
||||||
{
|
|
||||||
$an = htmlspecialchars($a->get_name());
|
|
||||||
$al = htmlspecialchars($a->get_link());
|
|
||||||
$ae = htmlspecialchars($a->get_email());
|
|
||||||
if ($al)
|
|
||||||
$a = "<a href=\"$al\">$an</a>";
|
|
||||||
else if ($ae)
|
|
||||||
$a = "<a href=\"mailto:$ae\">$an</a>";
|
|
||||||
else
|
|
||||||
$a = $an;
|
|
||||||
}
|
|
||||||
$author = implode(', ', $author);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$author = '';
|
|
||||||
$title = $item->get_title();
|
$title = $item->get_title();
|
||||||
$content = $item->get_content();
|
$content = $item->get_content();
|
||||||
$date = $item->get_date('U');
|
$date = $item->get_date('U');
|
||||||
|
@ -792,7 +789,9 @@ function fof_update_feed($id, $as_user = NULL)
|
||||||
$item_id = $item->get_id();
|
$item_id = $item->get_id();
|
||||||
|
|
||||||
if(!$item_id)
|
if(!$item_id)
|
||||||
|
{
|
||||||
$item_id = $link;
|
$item_id = $link;
|
||||||
|
}
|
||||||
|
|
||||||
$id = fof_db_find_item($feed_id, $item_id);
|
$id = fof_db_find_item($feed_id, $item_id);
|
||||||
|
|
||||||
|
@ -802,20 +801,83 @@ function fof_update_feed($id, $as_user = NULL)
|
||||||
|
|
||||||
global $fof_item_prefilters;
|
global $fof_item_prefilters;
|
||||||
foreach($fof_item_prefilters as $filter)
|
foreach($fof_item_prefilters as $filter)
|
||||||
|
{
|
||||||
list($link, $title, $content) = $filter($item, $link, $title, $content);
|
list($link, $title, $content) = $filter($item, $link, $title, $content);
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = fof_db_add_item($feed_id, $item_id, $link, $title, $content, time(), $date, $date);
|
||||||
|
fof_apply_tags($feed_id, $id);
|
||||||
|
|
||||||
|
$republished = false;
|
||||||
|
|
||||||
|
// this was a failed attempt to avoid duplicates when subscribing to
|
||||||
|
// a "planet" type feed when you already have some of the feeds in the
|
||||||
|
// planet subscribed. in the end there were just too many cases where
|
||||||
|
// dupes still got through (like the 'source' feed url being just slightly
|
||||||
|
// different from the subscribed url).
|
||||||
|
//
|
||||||
|
// maybe a better approach would be simply using the Atom GUID as a
|
||||||
|
// true *GU* ID.
|
||||||
|
|
||||||
|
/*
|
||||||
|
$source = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source');
|
||||||
|
$links = $source[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
|
||||||
|
|
||||||
|
if(is_array($links))
|
||||||
|
{
|
||||||
|
foreach($links as $link)
|
||||||
|
{
|
||||||
|
if($link['attribs']['']['rel'] == 'self')
|
||||||
|
{
|
||||||
|
$feed_url = $link['attribs']['']['href'];
|
||||||
|
|
||||||
|
$feed = fof_db_get_feed_by_url($feed_url);
|
||||||
|
|
||||||
|
if($feed)
|
||||||
|
{
|
||||||
|
fof_log("was repub from $feed_url");
|
||||||
|
|
||||||
|
$republished = true;
|
||||||
|
|
||||||
|
$result = fof_get_subscribed_users($feed_id);
|
||||||
|
|
||||||
|
$repub_subscribers = array();
|
||||||
|
while($row = fof_db_get_row($result))
|
||||||
|
{
|
||||||
|
$repub_subscribers[] = $row['user_id'];
|
||||||
|
fof_log("repub_sub: " . $row['user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = fof_get_subscribed_users($feed['feed_id']);
|
||||||
|
|
||||||
|
$original_subscribers = array();
|
||||||
|
while($row = fof_db_get_row($result))
|
||||||
|
{
|
||||||
|
$original_subscribers[] = $row['user_id'];
|
||||||
|
fof_log("orig_sub: " . $row['user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_subscribers = array_diff($repub_subscribers, $original_subscribers);
|
||||||
|
|
||||||
|
fof_db_mark_item_unread($new_subscribers, $id);
|
||||||
|
|
||||||
|
$old_subscribers = array_intersect($original_subscribers, $repub_subscribers);
|
||||||
|
|
||||||
|
foreach($old_subscribers as $user)
|
||||||
|
{
|
||||||
|
fof_tag_item($user, $id, 'republished');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(!$republished)
|
||||||
|
{
|
||||||
|
fof_mark_item_unread($feed_id, $id);
|
||||||
|
}
|
||||||
|
|
||||||
$id = fof_db_add_item($feed_id, array(
|
|
||||||
'item_guid' => $item_id,
|
|
||||||
'item_link' => $link,
|
|
||||||
'item_title' => $title,
|
|
||||||
'item_author' => $author,
|
|
||||||
'item_content' => $content,
|
|
||||||
'item_cached' => time(),
|
|
||||||
'item_published' => $date,
|
|
||||||
'item_updated' => $date,
|
|
||||||
));
|
|
||||||
$fof_item = fof_db_get_item_by_id($id);
|
|
||||||
fof_apply_tags($fof_item);
|
|
||||||
fof_apply_plugin_tags($feed_id, $id, NULL);
|
fof_apply_plugin_tags($feed_id, $id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,10 +889,9 @@ function fof_update_feed($id, $as_user = NULL)
|
||||||
// unread or starred, not currently in the feed or within sizeof(feed) items
|
// unread or starred, not currently in the feed or within sizeof(feed) items
|
||||||
// of being in the feed, and are over 'purge' many days old
|
// of being in the feed, and are over 'purge' many days old
|
||||||
|
|
||||||
$p = FoF_Prefs::instance();
|
$p =& FoF_Prefs::instance();
|
||||||
$admin_prefs = $p->admin_prefs;
|
$admin_prefs = $p->admin_prefs;
|
||||||
|
|
||||||
$ndelete = 0;
|
|
||||||
if($admin_prefs['purge'] != "")
|
if($admin_prefs['purge'] != "")
|
||||||
{
|
{
|
||||||
fof_log('purge is ' . $admin_prefs['purge']);
|
fof_log('purge is ' . $admin_prefs['purge']);
|
||||||
|
@ -846,9 +907,15 @@ function fof_update_feed($id, $as_user = NULL)
|
||||||
$result = fof_db_query($sql);
|
$result = fof_db_query($sql);
|
||||||
|
|
||||||
while($row = fof_db_get_row($result))
|
while($row = fof_db_get_row($result))
|
||||||
|
{
|
||||||
if($row['item_cached'] < (time() - ($admin_prefs['purge'] * 24 * 60 * 60)))
|
if($row['item_cached'] < (time() - ($admin_prefs['purge'] * 24 * 60 * 60)))
|
||||||
|
{
|
||||||
if(!fof_item_has_tags($row['item_id']))
|
if(!fof_item_has_tags($row['item_id']))
|
||||||
|
{
|
||||||
$delete[] = $row['item_id'];
|
$delete[] = $row['item_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$ndelete = count($delete);
|
$ndelete = count($delete);
|
||||||
if(count($delete) != 0)
|
if(count($delete) != 0)
|
||||||
|
@ -879,24 +946,33 @@ function fof_apply_plugin_tags($feed_id, $item_id = NULL, $user_id = NULL)
|
||||||
$users = array();
|
$users = array();
|
||||||
|
|
||||||
if($user_id)
|
if($user_id)
|
||||||
|
{
|
||||||
$users[] = $user_id;
|
$users[] = $user_id;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = fof_db_get_subscribed_users($feed_id);
|
$result = fof_get_subscribed_users($feed_id);
|
||||||
|
|
||||||
while($row = fof_db_get_row($result))
|
while($row = fof_db_get_row($result))
|
||||||
|
{
|
||||||
$users[] = $row['user_id'];
|
$users[] = $row['user_id'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$items = array();
|
$items = array();
|
||||||
if($item_id)
|
if($item_id)
|
||||||
|
{
|
||||||
$items[] = fof_db_get_item($user_id, $item_id);
|
$items[] = fof_db_get_item($user_id, $item_id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = fof_db_get_items($user_id, $feed_id, $what="all", NULL, NULL);
|
$result = fof_db_get_items($user_id, $feed_id, $what="all", NULL, NULL);
|
||||||
|
|
||||||
foreach($result as $r)
|
foreach($result as $r)
|
||||||
|
{
|
||||||
$items[] = $r;
|
$items[] = $r;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$userdata = fof_get_users();
|
$userdata = fof_get_users();
|
||||||
|
|
||||||
|
@ -935,17 +1011,16 @@ function fof_init_plugins()
|
||||||
$fof_plugin_prefs = array();
|
$fof_plugin_prefs = array();
|
||||||
$fof_tag_prefilters = array();
|
$fof_tag_prefilters = array();
|
||||||
|
|
||||||
$p = FoF_Prefs::instance();
|
$p =& FoF_Prefs::instance();
|
||||||
|
|
||||||
$dirlist = opendir(FOF_DIR . "/plugins");
|
$dirlist = opendir(FOF_DIR . "/plugins");
|
||||||
while($file=readdir($dirlist))
|
while($file=readdir($dirlist))
|
||||||
{
|
{
|
||||||
fof_log("considering " . $file);
|
fof_log("considering " . $file);
|
||||||
if (substr($file, -4) == '.php' &&
|
if(ereg('\.php$',$file) && !$p->get('plugin_' . substr($file, 0, -4)))
|
||||||
is_readable(FOF_DIR . "/plugins/" . $file) &&
|
|
||||||
!$p->get('plugin_' . substr($file, 0, -4)))
|
|
||||||
{
|
{
|
||||||
fof_log("including " . $file);
|
fof_log("including " . $file);
|
||||||
|
|
||||||
include(FOF_DIR . "/plugins/" . $file);
|
include(FOF_DIR . "/plugins/" . $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -997,12 +1072,10 @@ function fof_get_widgets($item)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$widgets = array();
|
|
||||||
foreach($fof_item_widgets as $widget)
|
foreach($fof_item_widgets as $widget)
|
||||||
{
|
{
|
||||||
$w = $widget($item);
|
$w = $widget($item);
|
||||||
if ($w)
|
if($w) $widgets[] = $w;
|
||||||
$widgets[] = $w;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $widgets;
|
return $widgets;
|
||||||
|
@ -1034,33 +1107,29 @@ function fof_todays_date()
|
||||||
{
|
{
|
||||||
$prefs = fof_prefs();
|
$prefs = fof_prefs();
|
||||||
$offset = $prefs['tzoffset'];
|
$offset = $prefs['tzoffset'];
|
||||||
if ($prefs['dst'])
|
|
||||||
$offset += date('I');
|
|
||||||
|
|
||||||
return gmdate( "Y/m/d", time() + ($offset * 60 * 60) );
|
return gmdate( "Y/m/d", time() + ($offset * 60 * 60) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_repair_drain_bamage()
|
function fof_repair_drain_bamage()
|
||||||
{
|
{
|
||||||
if (ini_get('register_globals'))
|
if (ini_get('register_globals')) foreach($_REQUEST as $k=>$v) { unset($GLOBALS[$k]); }
|
||||||
foreach($_REQUEST as $k => $v)
|
|
||||||
unset($GLOBALS[$k]);
|
|
||||||
|
|
||||||
// thanks to submitter of http://bugs.php.net/bug.php?id=39859
|
// thanks to submitter of http://bugs.php.net/bug.php?id=39859
|
||||||
if (get_magic_quotes_gpc())
|
if (get_magic_quotes_gpc()) {
|
||||||
{
|
function undoMagicQuotes($array, $topLevel=true) {
|
||||||
function undoMagicQuotes($array, $topLevel=true)
|
|
||||||
{
|
|
||||||
$newArray = array();
|
$newArray = array();
|
||||||
foreach($array as $key => $value)
|
foreach($array as $key => $value) {
|
||||||
{
|
if (!$topLevel) {
|
||||||
if (!$topLevel)
|
|
||||||
$key = stripslashes($key);
|
$key = stripslashes($key);
|
||||||
if (is_array($value))
|
}
|
||||||
|
if (is_array($value)) {
|
||||||
$newArray[$key] = undoMagicQuotes($value, false);
|
$newArray[$key] = undoMagicQuotes($value, false);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$newArray[$key] = stripslashes($value);
|
$newArray[$key] = stripslashes($value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $newArray;
|
return $newArray;
|
||||||
}
|
}
|
||||||
$_GET = undoMagicQuotes($_GET);
|
$_GET = undoMagicQuotes($_GET);
|
||||||
|
@ -1080,3 +1149,4 @@ if(!function_exists('str_ireplace'))
|
||||||
return preg_replace("/".$search."/i", $replace, $subject);
|
return preg_replace("/".$search."/i", $replace, $subject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
#addupd, #nav, #tags { display: inline; font-size: 100%; }
|
|
||||||
#taglist, #welcome, #item-display-controls, #nav li, #taglist tr, #sidebar { display: block; }
|
|
||||||
#item-display-controls-spacer, #taglist tr.heading, #feeds { display: none; }
|
|
||||||
#welcome { text-align: left; }
|
|
||||||
#addupd { float: left; margin: 4px 8px 4px 4px; }
|
|
||||||
#nav li { float: left; margin: 4px 8px 4px 0; }
|
|
||||||
#taglist { clear: both; }
|
|
||||||
#taglist tr { background-color: #e0e0e0; margin: 4px 4px 0 0; padding: 2px 0; float: left; }
|
|
||||||
#taglist td { margin: 0 4px; display: inline; background-color: transparent; }
|
|
||||||
#sidebar { float: none; width: auto !important; height: auto !important; overflow: visible; position: static; }
|
|
||||||
#handle { display: none; }
|
|
||||||
#item-display-controls { position: static; clear: both; }
|
|
||||||
.odd-row { background: transparent; }
|
|
||||||
.items-title { margin-top: 0; }
|
|
||||||
.flagall { background-color: #e0e0e0; content: "A"; }
|
|
|
@ -20,7 +20,6 @@ function do_highlight($full_body, $q, $class){
|
||||||
preg_match_all($pat,$full_body,$tag_matches);
|
preg_match_all($pat,$full_body,$tag_matches);
|
||||||
|
|
||||||
/* loop through and highlight $q value in data and recombine with tags */
|
/* loop through and highlight $q value in data and recombine with tags */
|
||||||
$full_body_hl = '';
|
|
||||||
for ($i=0; $i< count($tag_matches[0]); $i++) {
|
for ($i=0; $i< count($tag_matches[0]); $i++) {
|
||||||
/* ignore all text within these tags */
|
/* ignore all text within these tags */
|
||||||
if (
|
if (
|
||||||
|
@ -44,6 +43,7 @@ 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;
|
||||||
|
@ -56,13 +56,11 @@ function fof_render_item($item)
|
||||||
$item_link = $item['item_link'];
|
$item_link = $item['item_link'];
|
||||||
$item_id = $item['item_id'];
|
$item_id = $item['item_id'];
|
||||||
$item_title = $item['item_title'];
|
$item_title = $item['item_title'];
|
||||||
$item_author = $item['item_author'];
|
|
||||||
$item_content = $item['item_content'];
|
$item_content = $item['item_content'];
|
||||||
|
$item_read = $item['item_read'];
|
||||||
|
|
||||||
$prefs = fof_prefs();
|
$prefs = fof_prefs();
|
||||||
$offset = $prefs['tzoffset'];
|
$offset = $prefs['tzoffset'];
|
||||||
if (!empty($prefs['dst']))
|
|
||||||
$offset += date('I');
|
|
||||||
|
|
||||||
$item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset*60*60);
|
$item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset*60*60);
|
||||||
$item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset*60*60);
|
$item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset*60*60);
|
||||||
|
@ -70,7 +68,7 @@ function fof_render_item($item)
|
||||||
|
|
||||||
if(!$item_title) $item_title = "[no title]";
|
if(!$item_title) $item_title = "[no title]";
|
||||||
|
|
||||||
if(!empty($_GET['search']))
|
if($_GET['search'])
|
||||||
{
|
{
|
||||||
$item_content = do_highlight("<span>$item_content</span>", $_GET['search'], "highlight");
|
$item_content = do_highlight("<span>$item_content</span>", $_GET['search'], "highlight");
|
||||||
$item_title = do_highlight("<span>$item_title</span>", $_GET['search'], "highlight");
|
$item_title = do_highlight("<span>$item_title</span>", $_GET['search'], "highlight");
|
||||||
|
@ -98,7 +96,6 @@ function fof_render_item($item)
|
||||||
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'
|
||||||
/>
|
/>
|
||||||
<img src="image/flagall.gif" class="flagall" onclick='flag_upto("c<?= $item_id ?>")' title='flag all items up to this one' />
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<h1 <?php if($unread) echo "class='unread-item'" ?> >
|
<h1 <?php if($unread) echo "class='unread-item'" ?> >
|
||||||
|
@ -107,8 +104,6 @@ function fof_render_item($item)
|
||||||
width="16"
|
width="16"
|
||||||
src="<?php echo $star_image ?>"
|
src="<?php echo $star_image ?>"
|
||||||
id="fav<?php echo $item_id ?>"
|
id="fav<?php echo $item_id ?>"
|
||||||
alt=" "
|
|
||||||
class="star<?= $star ? "-on" : "" ?>"
|
|
||||||
onclick="return toggle_favorite('<?php echo $item_id ?>')"
|
onclick="return toggle_favorite('<?php echo $item_id ?>')"
|
||||||
/>
|
/>
|
||||||
<script>
|
<script>
|
||||||
|
@ -168,19 +163,21 @@ 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="<?=htmlspecialchars($feed_link)?>" title="<?=htmlspecialchars($feed_description)?>"><img src="<?=$feed_image?>" height="16" width="16" border="0" /></a>
|
<a href="<?php echo $feed_link ?>" title='<?php echo $feed_description ?>'><img src="<?php echo $feed_image ?>" height="16" width="16" border="0" /></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a href="<?=htmlspecialchars($feed_link)?>" title="<?=htmlspecialchars($feed_description)?>"><?=htmlspecialchars($feed_title)?></a>
|
<a href="<?php echo $feed_link ?>" title='<?php echo $feed_description ?>'><?php echo $feed_title ?></a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<span class="meta">on <?php echo $item_published ?><?= $item_author?" by $item_author":"" ?></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) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -190,7 +187,9 @@ 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>
|
||||||
|
|
26
fof-sudo.php
|
@ -1,26 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
$fof_no_login = 1;
|
|
||||||
include_once("fof-main.php");
|
|
||||||
|
|
||||||
$sudo_id = $_GET['id'];
|
|
||||||
if ($sudo_id)
|
|
||||||
{
|
|
||||||
$user_id = fof_cache_get("sudo-$sudo_id");
|
|
||||||
fof_cache_unset("sudo-$sudo_id");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user_id)
|
|
||||||
$user = fof_db_get_user(NULL, $user_id);
|
|
||||||
|
|
||||||
if ($user)
|
|
||||||
{
|
|
||||||
$prefs = unserialize($user['user_prefs']);
|
|
||||||
$globalauth = $prefs['globalauth'];
|
|
||||||
if (!$globalauth)
|
|
||||||
$globalauth = array('user_name' => $user['user_name']);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$globalauth = array('error' => "FOF_SUDO authorization error: session id $sudo_id is unknown");
|
|
||||||
|
|
||||||
print json_encode($globalauth);
|
|
64
fof.css
|
@ -1,5 +1,3 @@
|
||||||
img { border-width: 0; }
|
|
||||||
|
|
||||||
p
|
p
|
||||||
{
|
{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -13,6 +11,7 @@ p
|
||||||
|
|
||||||
#view-page
|
#view-page
|
||||||
{
|
{
|
||||||
|
font-family: georgia;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,28 +101,28 @@ 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
|
||||||
{
|
{
|
||||||
|
font-family: georgia;
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlight-on .highlight
|
.highlight-on .highlight
|
||||||
|
@ -272,27 +271,39 @@ body
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden h2 { font-size: 80%; }
|
.hidden h2
|
||||||
.hidden .tags { display: none; }
|
{
|
||||||
.hidden .meta { display: none; }
|
font-size: 80%;
|
||||||
.hidden .dash { display: inline; }
|
}
|
||||||
.shown .dash { display: none; }
|
|
||||||
|
.hidden .tags
|
||||||
|
{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden .meta
|
||||||
|
{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden .dash
|
||||||
|
{
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shown .dash
|
||||||
|
{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
#welcome
|
#welcome
|
||||||
{
|
{
|
||||||
text-align: center;
|
|
||||||
font: normal 10px Verdana;
|
font: normal 10px Verdana;
|
||||||
background: #ddd;
|
background: #ddd;
|
||||||
border-bottom: 1px solid #666;
|
border-bottom: 1px solid #666;
|
||||||
padding: 5px 7px;
|
padding: 5px 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#addupd { text-align: center; margin-top: 8px; }
|
|
||||||
|
|
||||||
#throbber { width: 16px; height: 16px; position: fixed; left: 0; top: 0; }
|
|
||||||
img.star { background-color: #c0c0c0; }
|
|
||||||
img.star-on { background-color: red; }
|
|
||||||
|
|
||||||
#item-display-controls
|
#item-display-controls
|
||||||
{
|
{
|
||||||
font: normal 10px Verdana;
|
font: normal 10px Verdana;
|
||||||
|
@ -307,10 +318,15 @@ border-bottom: 1px solid #666;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.items-title { clear: both; margin-top: 40px; }
|
#item-display-controls li
|
||||||
|
{
|
||||||
|
padding: 5px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
#item-display-controls li { padding: 5px 4px; }
|
#item-display-controls li a
|
||||||
#item-display-controls li a { padding: 0; }
|
{
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
#item-display-controls-spacer
|
#item-display-controls-spacer
|
||||||
{
|
{
|
||||||
|
@ -359,9 +375,3 @@ display: block;
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fof-add-feeds { margin: 0.5em; }
|
|
||||||
.fof-add-feeds form { margin: 0; }
|
|
||||||
.fof-add-feeds h1 { border-width: 0 0 2px; border-color: #ddd; border-style: solid; margin: 1em 0 0 0; padding: 0 0.5em; }
|
|
||||||
.fof-add-feeds p { line-height: 2; margin: 0.5em; }
|
|
||||||
|
|
||||||
.flagall { width: 16px; height: 16px; cursor: pointer; }
|
|
||||||
|
|
44
fof.js
|
@ -604,15 +604,13 @@ function completeDrag(e)
|
||||||
function hide_all()
|
function hide_all()
|
||||||
{
|
{
|
||||||
items = document.getElementsByClassName("item", "items");
|
items = document.getElementsByClassName("item", "items");
|
||||||
for (var i = 0; i < items.length; i++)
|
items.each( function(e) { e.className = "item hidden"; });
|
||||||
items[i].className = "item hidden";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_all()
|
function show_all()
|
||||||
{
|
{
|
||||||
items = document.getElementsByClassName("item", "items");
|
items = document.getElementsByClassName("item", "items");
|
||||||
for (var i = 0; i < items.length; i++)
|
items.each( function(e) { e.className = "item shown"; });
|
||||||
items[i].className = "item shown";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide_body(id)
|
function hide_body(id)
|
||||||
|
@ -658,6 +656,7 @@ function flag_all()
|
||||||
elements.each( function(e) { e.checked = true; });
|
elements.each( function(e) { e.checked = true; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function toggle_all()
|
function toggle_all()
|
||||||
{
|
{
|
||||||
elements = $A(Form.getInputs('itemform', 'checkbox'));
|
elements = $A(Form.getInputs('itemform', 'checkbox'));
|
||||||
|
@ -670,6 +669,7 @@ function unflag_all()
|
||||||
elements.each( function(e) { e.checked = false; });
|
elements.each( function(e) { e.checked = false; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function mark_read()
|
function mark_read()
|
||||||
{
|
{
|
||||||
document.items['action'].value = 'read';
|
document.items['action'].value = 'read';
|
||||||
|
@ -684,17 +684,6 @@ function mark_unread()
|
||||||
document.items.submit();
|
document.items.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_flagged(is_adm)
|
|
||||||
{
|
|
||||||
if (confirm('Are you sure to remove selected items from FeedOnFeeds database?'+
|
|
||||||
(is_adm ? '' : ' Only items from your private feeds can be removed!')))
|
|
||||||
{
|
|
||||||
document.items['action'].value = 'delete';
|
|
||||||
document.items['return'].value = escape(location);
|
|
||||||
document.items.submit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function mark_feed_read(id)
|
function mark_feed_read(id)
|
||||||
{
|
{
|
||||||
throb();
|
throb();
|
||||||
|
@ -782,7 +771,6 @@ function toggle_favorite(id)
|
||||||
var complete = function()
|
var complete = function()
|
||||||
{
|
{
|
||||||
image.src='image/star-off.gif';
|
image.src='image/star-off.gif';
|
||||||
image.className = 'star';
|
|
||||||
image.star = false;
|
image.star = false;
|
||||||
starred--;
|
starred--;
|
||||||
if(starred)
|
if(starred)
|
||||||
|
@ -801,7 +789,6 @@ function toggle_favorite(id)
|
||||||
var complete = function()
|
var complete = function()
|
||||||
{
|
{
|
||||||
image.src='image/star-on.gif';
|
image.src='image/star-on.gif';
|
||||||
image.className = 'star-on';
|
|
||||||
image.star = true;
|
image.star = true;
|
||||||
starred++;
|
starred++;
|
||||||
if(starred)
|
if(starred)
|
||||||
|
@ -883,29 +870,24 @@ function continueupdate()
|
||||||
|
|
||||||
function continueadd()
|
function continueadd()
|
||||||
{
|
{
|
||||||
var feed, f, m, dispUrl;
|
|
||||||
if(feed = feedi())
|
if(feed = feedi())
|
||||||
{
|
{
|
||||||
f = feed();
|
f = feed();
|
||||||
dispUrl = f['url'].replace(/^([a-z]+:\/\/[^\/]+:)([^\/]+)(@.*)$/, '$1******$3');
|
new Insertion.Bottom($('items'), 'Adding ' + f['url'] + "... ");
|
||||||
new Insertion.Bottom($('items'), 'Adding ' + dispUrl + "... ");
|
|
||||||
$('items').childElements().last().scrollTo();
|
$('items').childElements().last().scrollTo();
|
||||||
|
|
||||||
var parameters = 'url=' + encodeURIComponent(f['url']);
|
parameters = 'url=' + encodeURIComponent(f['url']) + "&unread=" + document.addform.unread.value;
|
||||||
parameters += "&unread=" + document.addform.unread.value;
|
|
||||||
parameters += "&tags=" + document.addform.new_tags.value;
|
|
||||||
|
|
||||||
new Ajax.Updater('items', 'add-single.php', {
|
new Ajax.Updater('items', 'add-single.php', {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
insertion: Insertion.Bottom,
|
insertion: Insertion.Bottom,
|
||||||
onComplete: continueadd,
|
onComplete: continueadd
|
||||||
evalScripts: true,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new Insertion.Bottom($('items'), '<br />Done!');
|
new Insertion.Bottom($('items'), '<br>Done!');
|
||||||
refreshlist();
|
refreshlist();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -924,13 +906,3 @@ 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);
|
|
||||||
}
|
|
||||||
|
|
67
header.php
|
@ -17,53 +17,74 @@ include_once("fof-main.php");
|
||||||
fof_set_content_type();
|
fof_set_content_type();
|
||||||
|
|
||||||
if(isset($_COOKIE['fof_sidebar_width']))
|
if(isset($_COOKIE['fof_sidebar_width']))
|
||||||
|
{
|
||||||
$width = $_COOKIE['fof_sidebar_width'];
|
$width = $_COOKIE['fof_sidebar_width'];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$width = 250;
|
$width = 250;
|
||||||
|
}
|
||||||
|
|
||||||
$unread_count = fof_get_unread_count(fof_current_user());
|
$unread_count = fof_get_unread_count(fof_current_user());
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html>
|
||||||
<head>
|
|
||||||
|
|
||||||
|
<head>
|
||||||
<title>Feed on Feeds<?php if($unread_count) echo " ($unread_count)";?></title>
|
<title>Feed on Feeds<?php if($unread_count) echo " ($unread_count)";?></title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="fof.css" media="screen" />
|
<link rel="stylesheet" href="fof.css" media="screen" />
|
||||||
<link rel="stylesheet" type="text/css" href="fof-mobile.css" media="handheld" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="fof-mobile.css" media="only screen and (max-device-width: 600px)" />
|
<link rel="microsummary" href="microsummary.php" />
|
||||||
|
|
||||||
<script src="prototype/prototype.js" type="text/javascript"></script>
|
<script src="prototype/prototype.js" type="text/javascript"></script>
|
||||||
|
|
||||||
<script src="fof.js" type="text/javascript"></script>
|
<script src="fof.js" type="text/javascript"></script>
|
||||||
|
|
||||||
<!--[if IE]>
|
|
||||||
<script>window.isIE = true;</script>
|
|
||||||
<style>
|
|
||||||
@media screen { #sidebar table { width: <?=($width-20)?>px; } }
|
|
||||||
</style>
|
|
||||||
<![endif]-->
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen and (min-device-width: 600px) {
|
|
||||||
#sidebar { width: <?=$width?>px; }
|
|
||||||
#handle { left: <?=$width?>px; }
|
|
||||||
#items { margin-left: <?=($width+20)?>px; }
|
|
||||||
#item-display-controls { left: <?=($width+10)?>px; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.onmousemove = dragResize;
|
document.onmousemove = dragResize;
|
||||||
document.onmouseup = completeDrag;
|
document.onmouseup = completeDrag;
|
||||||
<?php if($fof_prefs_obj->get('keyboard')) { ?>
|
<?php if($fof_prefs_obj->get('keyboard')) { ?>
|
||||||
document.onkeypress = keyboard;
|
document.onkeypress = keyboard;
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
isIE = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#sidebar
|
||||||
|
{
|
||||||
|
width: <?php echo $width ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#handle
|
||||||
|
{
|
||||||
|
left:<?php echo $width ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#items
|
||||||
|
{
|
||||||
|
margin-left: <?php echo $width+20 ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#item-display-controls { left: <?php echo $width+10 ?>px; }
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!--[if IE]>
|
||||||
|
<style>
|
||||||
|
#sidebar table
|
||||||
|
{
|
||||||
|
width: <?php echo $width - 20?>px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>isIE = true;</script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="highlight-on">
|
<body class="highlight-on"> <!--onkeypress="keyboard(event)"-->
|
||||||
|
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<?php include("sidebar.php") ?>
|
<?php include("sidebar.php") ?>
|
||||||
|
|
Before Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 75 B |
Before Width: | Height: | Size: 585 B After Width: | Height: | Size: 585 B |
Before Width: | Height: | Size: 1008 B After Width: | Height: | Size: 1008 B |
|
@ -17,3 +17,4 @@ include("header.php");
|
||||||
include("items.php");
|
include("items.php");
|
||||||
|
|
||||||
include("footer.php");
|
include("footer.php");
|
||||||
|
?>
|
||||||
|
|
225
install.php
|
@ -4,8 +4,9 @@
|
||||||
*
|
*
|
||||||
* install.php - creates tables and cache directory, if they don't exist
|
* install.php - creates tables and cache directory, if they don't exist
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 Stephen Minutillo steve@minutillo.com http://minutillo.com/steve/
|
*
|
||||||
* (C) 2009-2014 Vitaliy Filippov vitalif@mail.ru http://yourcmc.ru/wiki/
|
* Copyright (C) 2004-2007 Stephen Minutillo
|
||||||
|
* steve@minutillo.com - http://minutillo.com/steve/
|
||||||
*
|
*
|
||||||
* Distributed under the GPL - see LICENSE
|
* Distributed under the GPL - see LICENSE
|
||||||
*
|
*
|
||||||
|
@ -23,18 +24,24 @@ 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))
|
else if (preg_match('/curl\/(\S+)(\s|$)/', $curl, $match))
|
||||||
|
{
|
||||||
$curl = $match[1];
|
$curl = $match[1];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$curl = 0;
|
$curl = 0;
|
||||||
|
}
|
||||||
return $curl;
|
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', '>='));
|
||||||
$xml_ok = extension_loaded('xml');
|
$xml_ok = extension_loaded('xml');
|
||||||
$pcre_ok = extension_loaded('pcre');
|
$pcre_ok = extension_loaded('pcre');
|
||||||
$mysql_ok = extension_loaded('mysqli');
|
$mysql_ok = extension_loaded('mysql');
|
||||||
|
|
||||||
$curl_ok = (extension_loaded('curl') && version_compare(get_curl_version(), '7.10.5', '>='));
|
$curl_ok = (extension_loaded('curl') && version_compare(get_curl_version(), '7.10.5', '>='));
|
||||||
$zlib_ok = extension_loaded('zlib');
|
$zlib_ok = extension_loaded('zlib');
|
||||||
|
@ -42,12 +49,10 @@ $mbstring_ok = extension_loaded('mbstring');
|
||||||
$iconv_ok = extension_loaded('iconv');
|
$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>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html>
|
||||||
|
|
||||||
<head>
|
<head><title>feed on feeds - installation</title>
|
||||||
<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" />
|
<link rel="stylesheet" href="fof.css" media="screen" />
|
||||||
<script src="fof.js" type="text/javascript"></script>
|
<script src="fof.js" type="text/javascript"></script>
|
||||||
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
|
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
|
||||||
|
@ -57,6 +62,7 @@ $iconv_ok = extension_loaded('iconv');
|
||||||
font-family: georgia;
|
font-family: georgia;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div
|
div
|
||||||
{
|
{
|
||||||
background: #eee;
|
background: #eee;
|
||||||
|
@ -65,36 +71,42 @@ $iconv_ok = extension_loaded('iconv');
|
||||||
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; }
|
.fail { color: red; }
|
||||||
|
|
||||||
.pass { color: green; }
|
.pass { color: green; }
|
||||||
|
|
||||||
.warn { color: #a60; }
|
.warn { color: #a60; }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</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 (!empty($_GET['password']))
|
if($_GET['password'] && $_GET['password'] == $_GET['password2'] )
|
||||||
{
|
|
||||||
if ($_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
|
||||||
|
{
|
||||||
|
if($_GET['password'] != $_GET['password2'] )
|
||||||
{
|
{
|
||||||
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>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
Checking compatibility...
|
Checking compatibility...
|
||||||
|
@ -126,7 +138,7 @@ else
|
||||||
if($mysql_ok) echo "<span class='pass'>MySQL ok...</span> ";
|
if($mysql_ok) echo "<span class='pass'>MySQL ok...</span> ";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<br><span class='fail'>Your PHP installation is missing the MySQLi extension!</span> This is required by Feed on Feeds. Sorry!";
|
echo "<br><span class='fail'>Your PHP installation is missing the MySQL extension!</span> This is required by Feed on Feeds. Sorry!";
|
||||||
echo "</div></body></html>";
|
echo "</div></body></html>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -175,27 +187,7 @@ CREATE TABLE IF NOT EXISTS `$FOF_FEED_TABLE` (
|
||||||
`feed_cache_attempt_date` int(11) default '0',
|
`feed_cache_attempt_date` int(11) default '0',
|
||||||
`feed_cache` text,
|
`feed_cache` text,
|
||||||
PRIMARY KEY (`feed_id`)
|
PRIMARY KEY (`feed_id`)
|
||||||
) ENGINE=InnoDB COLLATE=utf8_unicode_ci;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
EOQ;
|
|
||||||
|
|
||||||
$tables[] = <<<EOQ
|
|
||||||
CREATE TABLE IF NOT EXISTS `$FOF_TAG_TABLE` (
|
|
||||||
`tag_id` int(11) NOT NULL auto_increment,
|
|
||||||
`tag_name` char(100) NOT NULL default '',
|
|
||||||
PRIMARY KEY (`tag_id`),
|
|
||||||
UNIQUE KEY (`tag_name`)
|
|
||||||
) ENGINE=InnoDB COLLATE=utf8_unicode_ci;
|
|
||||||
EOQ;
|
|
||||||
|
|
||||||
$tables[] = <<<EOQ
|
|
||||||
CREATE TABLE IF NOT EXISTS `$FOF_USER_TABLE` (
|
|
||||||
`user_id` int(11) NOT NULL auto_increment,
|
|
||||||
`user_name` varchar(100) NOT NULL default '',
|
|
||||||
`user_password_hash` varchar(32) NOT NULL default '',
|
|
||||||
`user_level` enum('user','admin') NOT NULL default 'user',
|
|
||||||
`user_prefs` text,
|
|
||||||
PRIMARY KEY (`user_id`)
|
|
||||||
) ENGINE=InnoDB COLLATE=utf8_unicode_ci;
|
|
||||||
EOQ;
|
EOQ;
|
||||||
|
|
||||||
$tables[] = <<<EOQ
|
$tables[] = <<<EOQ
|
||||||
|
@ -208,14 +200,12 @@ CREATE TABLE IF NOT EXISTS `$FOF_ITEM_TABLE` (
|
||||||
`item_published` int(11) NOT NULL default '0',
|
`item_published` int(11) NOT NULL default '0',
|
||||||
`item_updated` int(11) NOT NULL default '0',
|
`item_updated` int(11) NOT NULL default '0',
|
||||||
`item_title` text NOT NULL,
|
`item_title` text NOT NULL,
|
||||||
`item_author` text NOT NULL,
|
|
||||||
`item_content` text NOT NULL,
|
`item_content` text NOT NULL,
|
||||||
PRIMARY KEY (`item_id`),
|
PRIMARY KEY (`item_id`),
|
||||||
|
KEY `feed_id` (`feed_id`),
|
||||||
KEY `item_guid` (`item_guid`(255)),
|
KEY `item_guid` (`item_guid`(255)),
|
||||||
KEY `feed_id_item_cached` (`feed_id`,`item_cached`),
|
KEY `feed_id_item_cached` (`feed_id`,`item_cached`)
|
||||||
KEY `item_published` (`item_published`),
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
FOREIGN KEY (`feed_id`) REFERENCES `$FOF_FEED_TABLE` (`feed_id`) ON UPDATE CASCADE
|
|
||||||
) ENGINE=InnoDB COLLATE=utf8_unicode_ci;
|
|
||||||
EOQ;
|
EOQ;
|
||||||
|
|
||||||
$tables[] = <<<EOQ
|
$tables[] = <<<EOQ
|
||||||
|
@ -223,17 +213,8 @@ CREATE TABLE IF NOT EXISTS `$FOF_ITEM_TAG_TABLE` (
|
||||||
`user_id` int(11) NOT NULL default '0',
|
`user_id` int(11) NOT NULL default '0',
|
||||||
`item_id` int(11) NOT NULL default '0',
|
`item_id` int(11) NOT NULL default '0',
|
||||||
`tag_id` int(11) NOT NULL default '0',
|
`tag_id` int(11) NOT NULL default '0',
|
||||||
`item_published` int(11) NOT NULL default '0',
|
PRIMARY KEY (`user_id`,`item_id`,`tag_id`)
|
||||||
`feed_id` int(11) NOT NULL default '0',
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
PRIMARY KEY (`tag_id`,`user_id`,`item_id`),
|
|
||||||
KEY `tag_id_user_id_item_published_item_id` (tag_id, user_id, item_published, item_id),
|
|
||||||
KEY `tag_id_user_id_feed_id` (tag_id, user_id, feed_id),
|
|
||||||
KEY `item_id_user_id_tag_id` (item_id, user_id, tag_id),
|
|
||||||
FOREIGN KEY (`tag_id`) REFERENCES `$FOF_TAG_TABLE` (`tag_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
FOREIGN KEY (`user_id`) REFERENCES `$FOF_USER_TABLE` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
FOREIGN KEY (`item_id`) REFERENCES `$FOF_ITEM_TABLE` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
FOREIGN KEY (`feed_id`) REFERENCES `$FOF_FEED_TABLE` (`feed_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
|
||||||
) ENGINE=InnoDB COLLATE=utf8_unicode_ci;
|
|
||||||
EOQ;
|
EOQ;
|
||||||
|
|
||||||
$tables[] = <<<EOQ
|
$tables[] = <<<EOQ
|
||||||
|
@ -241,110 +222,93 @@ CREATE TABLE IF NOT EXISTS `$FOF_SUBSCRIPTION_TABLE` (
|
||||||
`feed_id` int(11) NOT NULL default '0',
|
`feed_id` int(11) NOT NULL default '0',
|
||||||
`user_id` int(11) NOT NULL default '0',
|
`user_id` int(11) NOT NULL default '0',
|
||||||
`subscription_prefs` text,
|
`subscription_prefs` text,
|
||||||
PRIMARY KEY (`feed_id`,`user_id`),
|
PRIMARY KEY (`feed_id`,`user_id`)
|
||||||
FOREIGN KEY (`user_id`) REFERENCES `$FOF_USER_TABLE` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
FOREIGN KEY (`feed_id`) REFERENCES `$FOF_FEED_TABLE` (`feed_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
EOQ;
|
||||||
) ENGINE=InnoDB COLLATE=utf8_unicode_ci;
|
|
||||||
|
$tables[] = <<<EOQ
|
||||||
|
CREATE TABLE IF NOT EXISTS `$FOF_TAG_TABLE` (
|
||||||
|
`tag_id` int(11) NOT NULL auto_increment,
|
||||||
|
`tag_name` char(100) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`tag_id`),
|
||||||
|
UNIQUE KEY (`tag_name`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
EOQ;
|
||||||
|
|
||||||
|
$tables[] = <<<EOQ
|
||||||
|
CREATE TABLE IF NOT EXISTS `$FOF_USER_TABLE` (
|
||||||
|
`user_id` int(11) NOT NULL auto_increment,
|
||||||
|
`user_name` varchar(100) NOT NULL default '',
|
||||||
|
`user_password_hash` varchar(32) NOT NULL default '',
|
||||||
|
`user_level` enum('user','admin') NOT NULL default 'user',
|
||||||
|
`user_prefs` text,
|
||||||
|
PRIMARY KEY (`user_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
EOQ;
|
EOQ;
|
||||||
|
|
||||||
foreach($tables as $table)
|
foreach($tables as $table)
|
||||||
fof_db_query($table, 1);
|
{
|
||||||
|
if(!fof_db_query($table, 1))
|
||||||
|
{
|
||||||
|
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'");
|
||||||
|
|
||||||
function add_fk($show_create_table, $table, $column, $ref_table, $action = 'on delete cascade on update cascade')
|
if(mysql_num_rows($result) == 0)
|
||||||
{
|
{
|
||||||
if (!strpos($show_create_table, "FOREIGN KEY (`$column`)"))
|
|
||||||
fof_db_query("alter table $table add foreign key ($column) references $ref_table ($column) $action");
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = fof_db_query("show table status");
|
print "Upgrading schema...";
|
||||||
while ($row = fof_db_get_row($r))
|
|
||||||
{
|
|
||||||
$table = $row['Name'];
|
|
||||||
$alter = array();
|
|
||||||
if (strtolower($row['Engine']) === 'myisam')
|
|
||||||
$alter[] = 'engine=innodb';
|
|
||||||
if (strpos($row['Collation'], 'utf8') === false)
|
|
||||||
$alter[] = 'convert to character set utf8 collate utf8_unicode_ci';
|
|
||||||
$r2 = fof_db_query("desc $table");
|
|
||||||
while ($row2 = fof_db_get_row($r2))
|
|
||||||
if (strtolower($row2['Type']) == 'mediumtext')
|
|
||||||
$alter[] = 'change '.$row2['Field'].' '.$row2['Field'].' text'.(strtolower($row2['Null']) == 'no' ? ' not null' : '');
|
|
||||||
if ($alter)
|
|
||||||
fof_db_query("alter table $table ".implode(', ', $alter));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fof_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` ;");
|
fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_image_cache_date` INT( 11 ) DEFAULT '0' AFTER `feed_image` ;");
|
||||||
|
|
||||||
if (!fof_num_rows(fof_db_query("show columns from $FOF_USER_TABLE like 'user_password_hash'")))
|
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("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))");
|
fof_db_query("update $FOF_USER_TABLE set user_password_hash = md5(concat(user_password_hash, user_name))");
|
||||||
}
|
|
||||||
|
|
||||||
if (!fof_num_rows(fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_cache_attempt_date'")))
|
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` ;");
|
fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_cache_attempt_date` INT( 11 ) DEFAULT '0' AFTER `feed_cache_date` ;");
|
||||||
|
|
||||||
if (!fof_num_rows(fof_db_query("show columns from $FOF_ITEM_TABLE like 'item_author'")))
|
print "Done.<hr>";
|
||||||
fof_db_query("ALTER TABLE $FOF_ITEM_TABLE ADD `item_author` text NOT NULL AFTER `item_title`;");
|
|
||||||
|
|
||||||
$check = fof_db_get_row(fof_db_query("show create table $FOF_ITEM_TABLE"));
|
|
||||||
if (strpos($check[1], 'KEY `feed_id`') !== false)
|
|
||||||
fof_db_query("alter table $FOF_ITEM_TABLE drop key feed_id, add key item_published (item_published)");
|
|
||||||
|
|
||||||
add_fk($check[1], $FOF_ITEM_TABLE, 'feed_id', $FOF_FEED_TABLE, 'on update cascade');
|
|
||||||
|
|
||||||
$check = fof_db_get_row(fof_db_query("show create table $FOF_ITEM_TAG_TABLE"));
|
|
||||||
|
|
||||||
add_fk($check[1], $FOF_ITEM_TAG_TABLE, 'tag_id', $FOF_TAG_TABLE);
|
|
||||||
add_fk($check[1], $FOF_ITEM_TAG_TABLE, 'user_id', $FOF_USER_TABLE);
|
|
||||||
add_fk($check[1], $FOF_ITEM_TAG_TABLE, 'item_id', $FOF_ITEM_TABLE);
|
|
||||||
|
|
||||||
if (strpos($check[1], 'PRIMARY KEY (`user_id`,`item_id`,`tag_id`)') !== false)
|
|
||||||
{
|
|
||||||
fof_db_query(
|
|
||||||
"alter table $FOF_ITEM_TAG_TABLE add key user_id (user_id),".
|
|
||||||
" add key item_id_user_id_tag_id (item_id, user_id, tag_id), drop primary key,".
|
|
||||||
" add primary key (tag_id, user_id, item_id), drop key tag_id, drop key item_id"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strpos($check[1], '`item_published`'))
|
|
||||||
{
|
|
||||||
fof_db_query(
|
|
||||||
"alter table $FOF_ITEM_TAG_TABLE add item_published int not null default '0',".
|
|
||||||
" add feed_id int not null default 0,".
|
|
||||||
" add key tag_id_user_id_item_published_item_id (tag_id, user_id, item_published, item_id),".
|
|
||||||
" add key tag_id_user_id_feed_id (tag_id, user_id, feed_id),".
|
|
||||||
" add key feed_id (feed_id)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fof_num_rows(fof_db_query("select count(*) from $FOF_ITEM_TAG_TABLE where feed_id=0")))
|
|
||||||
{
|
|
||||||
fof_db_query(
|
|
||||||
"update $FOF_ITEM_TAG_TABLE it, $FOF_ITEM_TABLE i".
|
|
||||||
" set it.item_published=i.item_published, it.feed_id=i.feed_id".
|
|
||||||
" where it.feed_id=0 and it.item_id=i.item_id"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
add_fk($check[1], $FOF_ITEM_TAG_TABLE, 'feed_id', $FOF_FEED_TABLE);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
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...
|
||||||
|
@ -353,6 +317,7 @@ Checking cache directory...
|
||||||
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>";
|
||||||
|
@ -369,12 +334,14 @@ if(!is_writable("cache"))
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
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 (fof_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>
|
||||||
|
|
7
item.php
|
@ -17,11 +17,8 @@ include_once("fof-render.php");
|
||||||
|
|
||||||
fof_set_content_type();
|
fof_set_content_type();
|
||||||
|
|
||||||
if (empty($_GET['id']))
|
|
||||||
{
|
|
||||||
die("No post ID");
|
|
||||||
}
|
|
||||||
|
|
||||||
$row = fof_get_item(fof_current_user(), $_GET['id']);
|
$row = fof_get_item(fof_current_user(), $_GET['id']);
|
||||||
|
|
||||||
fof_render_item($row);
|
fof_render_item($row);
|
||||||
|
|
||||||
|
?>
|
78
items.php
|
@ -15,21 +15,58 @@
|
||||||
include_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
include_once("fof-render.php");
|
include_once("fof-render.php");
|
||||||
|
|
||||||
$which = !empty($_GET['which']) ? $_GET['which'] : 0;
|
if($_GET['how'] == 'paged' && !isset($_GET['which']))
|
||||||
$order = !empty($_GET['order']) ? $_GET['order'] : $fof_prefs_obj->get('order');
|
{
|
||||||
$what = !empty($_GET['what']) ? $_GET['what'] : 'unread';
|
$which = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$which = $_GET['which'];
|
||||||
|
}
|
||||||
|
|
||||||
$how = !empty($_GET['how']) ? $_GET['how'] : NULL;
|
$order = $_GET['order'];
|
||||||
$feed = !empty($_GET['feed']) ? $_GET['feed'] : NULL;
|
|
||||||
$when = !empty($_GET['when']) ? $_GET['when'] : NULL;
|
|
||||||
$howmany = !empty($_GET['howmany']) ? $_GET['howmany'] : $fof_prefs_obj->get('howmany');
|
|
||||||
$search = !empty($_GET['search']) ? $_GET['search'] : NULL;
|
|
||||||
|
|
||||||
$title = fof_view_title($feed, $what, $when, $which, $howmany, $search);
|
if(!isset($_GET['what']))
|
||||||
|
{
|
||||||
|
$what = "unread";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$what = $_GET['what'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($_GET['order']))
|
||||||
|
{
|
||||||
|
$order = $fof_prefs_obj->get("order");
|
||||||
|
}
|
||||||
|
|
||||||
|
$how = $_GET['how'];
|
||||||
|
$feed = $_GET['feed'];
|
||||||
|
$when = $_GET['when'];
|
||||||
|
$howmany = $_GET['howmany'];
|
||||||
|
|
||||||
|
$title = fof_view_title($_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany'], $_GET['search']);
|
||||||
|
$noedit = $_GET['noedit'];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<p class="items-title"><?php echo $title ?></p>
|
<ul id="item-display-controls-spacer" class="inline-list">
|
||||||
|
<li class="orderby">[new to old]</li>
|
||||||
|
<li class="orderby">[old to new]</li>
|
||||||
|
<li><a href="javascript:flag_all();mark_read()"><strong>Mark all read</strong></a></li>
|
||||||
|
<li><a href="javascript:flag_all()">Flag all</a></li>
|
||||||
|
<li><a href="javascript:unflag_all()">Unflag all</a></li>
|
||||||
|
<li><a href="javascript:toggle_all()">Toggle all</a></li>
|
||||||
|
<li><a href="javascript:mark_read()">Mark flagged read</a></li>
|
||||||
|
<li><a href="javascript:mark_unread()">Mark flagged unread</a></li>
|
||||||
|
<li><a href="javascript:show_all()">Show all</a></li>
|
||||||
|
<li><a href="javascript:hide_all()">Hide all</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<br style="clear: both"><br>
|
||||||
|
|
||||||
|
<p><?php echo $title?></p>
|
||||||
|
|
||||||
|
|
||||||
<ul id="item-display-controls" class="inline-list">
|
<ul id="item-display-controls" class="inline-list">
|
||||||
<li class="orderby"><?php
|
<li class="orderby"><?php
|
||||||
|
@ -50,9 +87,10 @@ $title = fof_view_title($feed, $what, $when, $which, $howmany, $search);
|
||||||
<li><a href="javascript:mark_unread()">Mark flagged unread</a></li>
|
<li><a href="javascript:mark_unread()">Mark flagged unread</a></li>
|
||||||
<li><a href="javascript:show_all()">Show all</a></li>
|
<li><a href="javascript:show_all()">Show all</a></li>
|
||||||
<li><a href="javascript:hide_all()">Hide all</a></li>
|
<li><a href="javascript:hide_all()">Hide all</a></li>
|
||||||
<li><a href="javascript:delete_flagged(<?= fof_is_admin() ? 1 : 0 ?>)">Delete flagged</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;">
|
||||||
|
@ -60,13 +98,18 @@ $title = fof_view_title($feed, $what, $when, $which, $howmany, $search);
|
||||||
<input type="hidden" name="return" />
|
<input type="hidden" name="return" />
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$links = fof_get_nav_links($feed, $what, $when, $which, $howmany);
|
$links = fof_get_nav_links($_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany']);
|
||||||
|
|
||||||
if($links) { ?>
|
if($links)
|
||||||
<center><?php echo $links ?></center><?php
|
{
|
||||||
|
?>
|
||||||
|
<center><?php echo $links ?></center>
|
||||||
|
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = fof_get_items(fof_current_user(), $feed, $what, $when, $which, $howmany, $order, $search);
|
|
||||||
|
$result = fof_get_items(fof_current_user(), $_GET['feed'], $what, $_GET['when'], $which, $_GET['howmany'], $order, $_GET['search']);
|
||||||
|
|
||||||
$first = true;
|
$first = true;
|
||||||
|
|
||||||
|
@ -75,7 +118,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 '.(!empty($row['prefs']['hide_content']) ? 'hidden' : 'shown').'" id="i' . $item_id . '" onclick="return itemClicked(event)">';
|
print '<div class="item shown" id="i' . $item_id . '" onclick="return itemClicked(event)">';
|
||||||
fof_render_item($row);
|
fof_render_item($row);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
@ -85,9 +128,6 @@ 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>
|
||||||
|
|
||||||
|
|
57
login.php
|
@ -4,21 +4,22 @@
|
||||||
*
|
*
|
||||||
* login.php - username / password entry
|
* login.php - username / password entry
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* Copyright (C) 2004-2007 Stephen Minutillo
|
* Copyright (C) 2004-2007 Stephen Minutillo
|
||||||
* steve@minutillo.com - http://minutillo.com/steve/
|
* steve@minutillo.com - http://minutillo.com/steve/
|
||||||
*
|
*
|
||||||
* Distributed under the GPL - see LICENSE
|
* Distributed under the GPL - see LICENSE
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
$fof_no_login = true;
|
$fof_no_login = true;
|
||||||
|
|
||||||
require_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
|
|
||||||
fof_set_content_type();
|
fof_set_content_type();
|
||||||
|
|
||||||
$failed = false;
|
|
||||||
if(isset($_POST["user_name"]) && isset($_POST["user_password"]))
|
if(isset($_POST["user_name"]) && isset($_POST["user_password"]))
|
||||||
{
|
{
|
||||||
if(fof_authenticate($_POST['user_name'], md5($_POST['user_password'] . $_POST['user_name'])))
|
if(fof_authenticate($_POST['user_name'], md5($_POST['user_password'] . $_POST['user_name'])))
|
||||||
|
@ -26,51 +27,47 @@ if(isset($_POST["user_name"]) && isset($_POST["user_password"]))
|
||||||
Header("Location: .");
|
Header("Location: .");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$failed = true;
|
$failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Site stats */
|
|
||||||
$users = fof_db_get_value("SELECT COUNT(*) FROM fof_user");
|
|
||||||
$feeds = fof_db_get_value("SELECT COUNT(*) FROM fof_feed");
|
|
||||||
$items = fof_db_get_value("SELECT COUNT(*) FROM fof_item");
|
|
||||||
|
|
||||||
$topreaders = false;
|
|
||||||
if ($fof_prefs_obj && ($days = intval($fof_prefs_obj->admin_prefs['topreaders_days'])) && ($count = intval($fof_prefs_obj->admin_prefs['topreaders_count'])))
|
|
||||||
{
|
|
||||||
$topreaders = fof_db_get_top_readers($days, $count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>Feed on Feeds - Log on</title>
|
<title>Feed on Feeds - Log on</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body { font-family: georgia; font-size: 16px; text-align: center; }
|
body
|
||||||
div { background: #eee; border: 1px solid black; width: 20em; margin: 5em auto 2em; padding: 1.5em; }
|
{
|
||||||
form { margin: 0 0 0 -3px; }
|
font-family: georgia;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div
|
||||||
|
{
|
||||||
|
background: #eee;
|
||||||
|
border: 1px solid black;
|
||||||
|
width: 20em;
|
||||||
|
margin: 5em auto;
|
||||||
|
padding: 1.5em;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
<form action="login.php" method="POST">
|
<form action="login.php" method="POST" style="display: inline">
|
||||||
<center><a href="http://feedonfeeds.com/" style="font-size: 20px; font-family: georgia;">Feed on Feeds</a></center><br>
|
<center><a href="http://feedonfeeds.com/" style="font-size: 20px; font-family: georgia;">Feed on Feeds</a></center><br>
|
||||||
User name:<br><input class="editbox" type='string' name='user_name' style='font-size: 16px; width: 20em'><br><br>
|
User name:<br><input type=string name=user_name style='font-size: 16px'><br><br>
|
||||||
Password:<br><input class="editbox" type='password' name='user_password' style='font-size: 16px; width: 20em'><br><br>
|
Password:<br><input type=password name=user_password style='font-size: 16px'><br><br>
|
||||||
<p style="text-align: right; margin: 0"><input type="submit" value="Log on!" style='font-size: 16px'></p>
|
<input type=submit value="Log on!" style='font-size: 16px; float: right;'><br>
|
||||||
<?php if($failed) echo '<br><center><font color="red"><b>Incorrect user name or password</b></font></center>'; ?>
|
<?php if($failed) echo "<br><center><font color=red><b>Incorrect user name or password</b></font></center>"; ?>
|
||||||
<center style="padding: 20px 0 0 0; font-size: 75%"><?= "As of ".date("Y-m-d").", $users our users subscribed to $feeds unique feeds with $items items." ?></center>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php if($topreaders) { ?>
|
|
||||||
<p><?=$days > 1 ? "Last $days days" : "Today's"?> top readers:<br />
|
|
||||||
<?php foreach($topreaders as $t) { ?>
|
|
||||||
<b><?=htmlspecialchars($t['user_name'])?></b>: <?=$t['posts']?> posts read<br />
|
|
||||||
<?php } ?>
|
|
||||||
</p>
|
|
||||||
<?php } ?>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
$fof_no_login = 1;
|
||||||
|
require("fof-main.php");
|
||||||
|
|
||||||
|
if(isset($_COOKIE["user_name"]) && isset($_COOKIE["user_password_hash"]))
|
||||||
|
{
|
||||||
|
$user_name = $_COOKIE["user_name"];
|
||||||
|
$user_password_hash = $_COOKIE["user_password_hash"];
|
||||||
|
|
||||||
|
if(fof_authenticate($user_name, $user_password_hash))
|
||||||
|
{
|
||||||
|
$unread = fof_get_unread_count(fof_current_user());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Feed on Feeds";
|
||||||
|
if($unread) echo " ($unread)";
|
||||||
|
?>
|
||||||
|
|
|
@ -0,0 +1,187 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* This file is part of FEED ON FEEDS - http://feedonfeeds.com/
|
||||||
|
*
|
||||||
|
* shared.php - display shared items for a user
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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");
|
||||||
|
|
||||||
|
$result = fof_get_items($fof_user_id, NULL, "unread", NULL, 0, 10);
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=utf-8");
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Feed on Feeds</title>
|
||||||
|
<meta name = "viewport" content = "width=700">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="fof.css" media="screen" />
|
||||||
|
<style>
|
||||||
|
.box
|
||||||
|
{
|
||||||
|
font-family: georgia;
|
||||||
|
background: #eee;
|
||||||
|
border: 1px solid black;
|
||||||
|
width: 30em;
|
||||||
|
margin: 10px auto 20px;
|
||||||
|
padding: 1em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script src="prototype/prototype.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="fof.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function toggle_favorite(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";
|
||||||
|
var complete = function()
|
||||||
|
{
|
||||||
|
image.src='image/star-off.gif';
|
||||||
|
image.star = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var complete = function()
|
||||||
|
{
|
||||||
|
image.src='image/star-on.gif';
|
||||||
|
image.star = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var options = { method: 'get', parameters: params, onComplete: complete };
|
||||||
|
new Ajax.Request(url, options);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function newWindowIfy()
|
||||||
|
{
|
||||||
|
a=document.getElementsByTagName('a');
|
||||||
|
|
||||||
|
for(var i=0,j=a.length;i<j;i++){a[i].setAttribute('target','_blank')};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onload="newWindowIfy()">
|
||||||
|
<form id="itemform" name="items" action="view-action.php" method="post" onSubmit="return false;">
|
||||||
|
<input type="hidden" name="action" value="read" />
|
||||||
|
<input type="hidden" name="return" />
|
||||||
|
|
||||||
|
<div id="items">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$first = true;
|
||||||
|
|
||||||
|
foreach($result as $item)
|
||||||
|
{
|
||||||
|
$item_id = $item['item_id'];
|
||||||
|
print '<div class="item shown" id="i' . $item_id . '">';
|
||||||
|
|
||||||
|
$feed_link = $item['feed_link'];
|
||||||
|
$feed_title = $item['feed_title'];
|
||||||
|
$feed_image = $item['feed_image'];
|
||||||
|
$feed_description = $item['feed_description'];
|
||||||
|
|
||||||
|
$item_link = $item['item_link'];
|
||||||
|
$item_id = $item['item_id'];
|
||||||
|
$item_title = $item['item_title'];
|
||||||
|
$item_content = $item['item_content'];
|
||||||
|
$item_read = $item['item_read'];
|
||||||
|
|
||||||
|
$item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset*60*60);
|
||||||
|
$item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset*60*60);
|
||||||
|
$item_updated = gmdate("Y-n-d g:ia", $item['item_updated'] + $offset*60*60);
|
||||||
|
|
||||||
|
if(!$item_title) $item_title = "[no title]";
|
||||||
|
$tags = $item['tags'];
|
||||||
|
$star = in_array("star", $tags) ? true : false;
|
||||||
|
$star_image = $star ? "image/star-on.gif" : "image/star-off.gif";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
|
||||||
|
<h1>
|
||||||
|
<img
|
||||||
|
height="16"
|
||||||
|
width="16"
|
||||||
|
src="<?php echo $star_image ?>"
|
||||||
|
id="fav<?php echo $item_id ?>"
|
||||||
|
onclick="return toggle_favorite('<?php echo $item_id ?>')"
|
||||||
|
/>
|
||||||
|
<script>
|
||||||
|
document.getElementById('fav<?php echo $item_id ?>').star = <?php if($star) echo 'true'; else echo 'false'; ?>;
|
||||||
|
</script>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<span class="meta">on <?php echo $item_published ?> GMT</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="body"><?php echo $item_content ?></div>
|
||||||
|
|
||||||
|
<div class="clearer"></div>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="c<?php echo $item_id ?>"
|
||||||
|
id="c<?php echo $item_id ?>"
|
||||||
|
value="checked"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($result) == 0)
|
||||||
|
{
|
||||||
|
echo "<p><i>No new items.</i></p>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "<center><a href='#' onclick='mark_read(); return false;'><b>Mark All Read</b></a></center>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form></body></html>
|
||||||
|
|
5
opml.php
|
@ -29,8 +29,7 @@ $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']);
|
||||||
$row['prefs'] = unserialize($row['subscription_prefs']);
|
$title = htmlspecialchars($row['feed_title']);
|
||||||
$title = htmlspecialchars(fof_feed_title($row));
|
|
||||||
$link = htmlspecialchars($row['feed_link']);
|
$link = htmlspecialchars($row['feed_link']);
|
||||||
|
|
||||||
echo <<<HEYO
|
echo <<<HEYO
|
||||||
|
@ -40,8 +39,10 @@ while($row = fof_db_get_row($result))
|
||||||
htmlUrl="$link"
|
htmlUrl="$link"
|
||||||
xmlUrl="$url"
|
xmlUrl="$url"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
HEYO;
|
HEYO;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
</opml>
|
</opml>
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ function fof_balancetags($text) {
|
||||||
// clear the shifter
|
// clear the shifter
|
||||||
$tagqueue = '';
|
$tagqueue = '';
|
||||||
// Pop or Push
|
// Pop or Push
|
||||||
if ($regex[1] && $regex[1][0] == "/") { // End Tag
|
if ($regex[1][0] == "/") { // End Tag
|
||||||
$tag = strtolower(substr($regex[1],1));
|
$tag = strtolower(substr($regex[1],1));
|
||||||
// if too many closing tags
|
// if too many closing tags
|
||||||
if($stacksize <= 0) {
|
if($stacksize <= 0) {
|
||||||
|
|
|
@ -4,7 +4,6 @@ fof_add_item_prefilter('fof_enclosures');
|
||||||
|
|
||||||
function fof_enclosures($item, $link, $title, $content)
|
function fof_enclosures($item, $link, $title, $content)
|
||||||
{
|
{
|
||||||
$html = '';
|
|
||||||
if ($enclosure = $item->get_enclosure(0))
|
if ($enclosure = $item->get_enclosure(0))
|
||||||
{
|
{
|
||||||
$html = '<br><br><a href="#" onclick="show_enclosure(event); return false;">show enclosure</a><div style="display: none" align="center" width="auto">';
|
$html = '<br><br><a href="#" onclick="show_enclosure(event); return false;">show enclosure</a><div style="display: none" align="center" width="auto">';
|
||||||
|
@ -19,9 +18,12 @@ function fof_enclosures($item, $link, $title, $content)
|
||||||
if ($enclosure->get_size())
|
if ($enclosure->get_size())
|
||||||
{
|
{
|
||||||
$html .= '; ' . $enclosure->get_size() . ' MB';
|
$html .= '; ' . $enclosure->get_size() . ' MB';
|
||||||
|
|
||||||
}
|
}
|
||||||
$html .= ')</i>';
|
$html .= ')</i>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($link, $title, $content . $html);
|
return array($link, $title, $content . $html);
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|
206
prefs.php
|
@ -14,105 +14,56 @@
|
||||||
|
|
||||||
include_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
|
|
||||||
$prefs = FoF_Prefs::instance();
|
$prefs =& FoF_Prefs::instance();
|
||||||
|
|
||||||
if(fof_is_admin() && isset($_POST['adminprefs']))
|
if(fof_is_admin() && isset($_POST['adminprefs']))
|
||||||
{
|
{
|
||||||
$prefs->set('purge', $_POST['purge']);
|
$prefs->set('purge', $_POST['purge']);
|
||||||
$prefs->set('manualtimeout', $_POST['manualtimeout']);
|
$prefs->set('manualtimeout', $_POST['manualtimeout']);
|
||||||
$prefs->set('autotimeout', $_POST['autotimeout']);
|
$prefs->set('autotimeout', $_POST['autotimeout']);
|
||||||
$prefs->set('logging', !empty($_POST['logging']));
|
$prefs->set('logging', $_POST['logging']);
|
||||||
$prefs->set('suggestadd', intval($_POST['suggestadd']));
|
|
||||||
$prefs->set('topreaders_days', intval($_POST['topreaders_days']));
|
|
||||||
$prefs->set('topreaders_count', intval($_POST['topreaders_count']));
|
|
||||||
|
|
||||||
$prefs->save();
|
$prefs->save();
|
||||||
|
|
||||||
$message[] = 'Saved admin prefs.';
|
$message .= ' Saved admin prefs.';
|
||||||
|
|
||||||
if($prefs->get('logging') && !@fopen("fof.log", 'a'))
|
if($prefs->get('logging') && !@fopen("fof.log", 'a'))
|
||||||
{
|
{
|
||||||
$message[] = 'Warning: could not write to log file!';
|
$message .= ' Warning: could not write to log file!';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['tagfeeds']))
|
if(isset($_POST['tagfeed']))
|
||||||
{
|
{
|
||||||
$allow_prop = array('untag' => 1, 'tag' => 1, 'filter' => 1, 'title' => 1, 'hide' => 1, 'orighide' => 1);
|
$tags = $_POST['tag'];
|
||||||
foreach ($_REQUEST as $k => $v)
|
$feed_id = $_POST['feed_id'];
|
||||||
{
|
$title = $_POST['title'];
|
||||||
$prop = explode('_', $k);
|
|
||||||
if (count($prop) < 2)
|
foreach(explode(" ", $tags) as $tag)
|
||||||
continue;
|
|
||||||
list($prop, $feed_id) = $prop;
|
|
||||||
if (empty($allow_prop[$prop]))
|
|
||||||
continue;
|
|
||||||
if (!($feed = fof_db_get_feed_by_id($feed_id)))
|
|
||||||
continue;
|
|
||||||
// remove tags
|
|
||||||
if ($prop == 'untag')
|
|
||||||
{
|
|
||||||
foreach ($v as $tag)
|
|
||||||
{
|
|
||||||
fof_untag_feed(fof_current_user(), $feed_id, $tag);
|
|
||||||
$message[] = 'Dropped \''.$tag.'\' from \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\'';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// add tags
|
|
||||||
elseif ($prop == 'tag')
|
|
||||||
{
|
|
||||||
foreach (preg_split("/[\s,]*,[\s,]*/", $v) as $tag)
|
|
||||||
{
|
|
||||||
if ($tag)
|
|
||||||
{
|
{
|
||||||
fof_tag_feed(fof_current_user(), $feed_id, $tag);
|
fof_tag_feed(fof_current_user(), $feed_id, $tag);
|
||||||
$message[] = 'Tagged \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' as '.htmlspecialchars($tag);
|
$message .= " Tagged '$title' as $tag.";
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// change filter
|
|
||||||
elseif ($prop == 'filter')
|
|
||||||
{
|
|
||||||
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 && empty($_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 && empty($_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';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($message))
|
if(isset($_GET['untagfeed']))
|
||||||
$message = join('<br>', $message);
|
{
|
||||||
|
$feed_id = $_GET['untagfeed'];
|
||||||
|
$tags = $_GET['tag'];
|
||||||
|
$title = $_GET['title'];
|
||||||
|
|
||||||
|
foreach(explode(" ", $tags) as $tag)
|
||||||
|
{
|
||||||
|
fof_untag_feed(fof_current_user(), $feed_id, $tag);
|
||||||
|
$message .= " Dropped $tag from '$title'.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_POST['prefs']))
|
if(isset($_POST['prefs']))
|
||||||
{
|
{
|
||||||
$prefs->set('favicons', isset($_POST['favicons']));
|
$prefs->set('favicons', isset($_POST['favicons']));
|
||||||
$prefs->set('keyboard', isset($_POST['keyboard']));
|
$prefs->set('keyboard', isset($_POST['keyboard']));
|
||||||
$prefs->set('tzoffset', intval($_POST['tzoffset']));
|
$prefs->set('tzoffset', intval($_POST['tzoffset']));
|
||||||
$prefs->set('dst', isset($_POST['dst']));
|
|
||||||
$prefs->set('howmany', intval($_POST['howmany']));
|
$prefs->set('howmany', intval($_POST['howmany']));
|
||||||
$prefs->set('order', $_POST['order']);
|
$prefs->set('order', $_POST['order']);
|
||||||
$prefs->set('sharing', $_POST['sharing']);
|
$prefs->set('sharing', $_POST['sharing']);
|
||||||
|
@ -146,13 +97,19 @@ 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(substr($file, -4) == '.php')
|
{
|
||||||
|
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());
|
||||||
|
|
||||||
|
@ -184,6 +141,7 @@ if(fof_is_admin() && isset($_POST['adduser']) && $_POST['username'] && $_POST['p
|
||||||
$message = "User '$username' added.";
|
$message = "User '$username' added.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(fof_is_admin() && isset($_POST['deleteuser']) && $_POST['username'])
|
if(fof_is_admin() && isset($_POST['deleteuser']) && $_POST['username'])
|
||||||
{
|
{
|
||||||
$username = $_POST['username'];
|
$username = $_POST['username'];
|
||||||
|
@ -208,7 +166,7 @@ Default display order: <select name="order"><option value=desc>new to old</optio
|
||||||
Number of items in paged displays: <input type="string" name="howmany" value="<?php echo $prefs->get('howmany') ?>"><br><br>
|
Number of items in paged displays: <input type="string" name="howmany" value="<?php echo $prefs->get('howmany') ?>"><br><br>
|
||||||
Display custom feed favicons? <input type="checkbox" name="favicons" <?php if($prefs->get('favicons')) echo "checked=true";?> ><br><br>
|
Display custom feed favicons? <input type="checkbox" name="favicons" <?php if($prefs->get('favicons')) echo "checked=true";?> ><br><br>
|
||||||
Use keyboard shortcuts? <input type="checkbox" name="keyboard" <?php if($prefs->get('keyboard')) echo "checked=true";?> ><br><br>
|
Use keyboard shortcuts? <input type="checkbox" name="keyboard" <?php if($prefs->get('keyboard')) echo "checked=true";?> ><br><br>
|
||||||
Time offset in hours: <input size=3 type=string name=tzoffset value="<?php echo $prefs->get('tzoffset')?>"> <input type="checkbox" name="dst" <?php if($prefs->get('dst')) echo "checked=true";?> /> use <a href="http://en.wikipedia.org/wiki/Daylight_saving_time">DST</a> (UTC time: <?php echo gmdate("Y-n-d g:ia") ?>, local time: <?php echo gmdate("Y-n-d g:ia", time() + ($prefs->get("tzoffset") + ($prefs->get('dst') ? date('I') : 0))*60*60) ?>)<br><br>
|
Time offset in hours: <input size=3 type=string name=tzoffset value="<?php echo $prefs->get('tzoffset')?>"> (UTC time: <?php echo gmdate("Y-n-d g:ia") ?>, local time: <?php echo gmdate("Y-n-d g:ia", time() + $prefs->get("tzoffset")*60*60) ?>)<br><br>
|
||||||
<table border=0 cellspacing=0 cellpadding=2><tr><td>New password:</td><td><input type=password name=password> (leave blank to not change)</td></tr>
|
<table border=0 cellspacing=0 cellpadding=2><tr><td>New password:</td><td><input type=password name=password> (leave blank to not change)</td></tr>
|
||||||
<tr><td>Repeat new password:</td><td><input type=password name=password2></td></tr></table>
|
<tr><td>Repeat new password:</td><td><input type=password name=password2></td></tr></table>
|
||||||
<br>
|
<br>
|
||||||
|
@ -217,8 +175,7 @@ Share
|
||||||
<select name="sharing">
|
<select name="sharing">
|
||||||
<option value=no>no</option>
|
<option value=no>no</option>
|
||||||
<option value=all <?php if($prefs->get('sharing') == "all") echo "selected";?>>all</option>
|
<option value=all <?php if($prefs->get('sharing') == "all") echo "selected";?>>all</option>
|
||||||
<option value=shared <?php if($prefs->get('sharing') == "shared") echo "selected";?>>tagged as "shared"</option>
|
<option value=tagged <?php if($prefs->get('sharing') == "tagged") echo "selected";?>>tagged as "shared"</option>
|
||||||
<option value=star <?php if($prefs->get('sharing') == "star") echo "selected";?>>starred</option>
|
|
||||||
</select>
|
</select>
|
||||||
items.
|
items.
|
||||||
<?php if($prefs->get('sharing') != "no") echo " <small><i>(your shared page is <a href='./shared.php?user=$fof_user_id'>here</a>)</i></small>";?><br><br>
|
<?php if($prefs->get('sharing') != "no") echo " <small><i>(your shared page is <a href='./shared.php?user=$fof_user_id'>here</a>)</i></small>";?><br><br>
|
||||||
|
@ -238,14 +195,18 @@ URL to be linked on shared page: <input type=string name=sharedurl value="<?php
|
||||||
while($file=readdir($dirlist))
|
while($file=readdir($dirlist))
|
||||||
{
|
{
|
||||||
fof_log("considering " . $file);
|
fof_log("considering " . $file);
|
||||||
if(substr($file, -4) === '.php' && is_readable(FOF_DIR . "/plugins/" . $file))
|
if(ereg('\.php$',$file))
|
||||||
|
{
|
||||||
$plugins[] = substr($file, 0, -4);
|
$plugins[] = substr($file, 0, -4);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
closedir();
|
closedir();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?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>
|
||||||
|
@ -258,28 +219,20 @@ URL to be linked on shared page: <input type=string name=sharedurl value="<?php
|
||||||
<input name="<?php echo $key ?>" value="<?php echo $prefs->get($key)?>"><br>
|
<input name="<?php echo $key ?>" value="<?php echo $prefs->get($key)?>"><br>
|
||||||
<?php } } ?>
|
<?php } } ?>
|
||||||
<br>
|
<br>
|
||||||
<input type="submit" name="plugins" value="Save Plugin Preferences">
|
<input type=submit name=plugins value="Save Plugin Preferences">
|
||||||
</form>
|
</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 />
|
<br><h1>Feed on Feeds - Feeds and Tags</h1>
|
||||||
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">
|
<table cellpadding=3 cellspacing=0>
|
||||||
<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
|
<?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 = fof_feed_title($row);
|
$title = $row['feed_title'];
|
||||||
$link = $row['feed_link'];
|
$link = $row['feed_link'];
|
||||||
$description = $row['feed_description'];
|
$description = $row['feed_description'];
|
||||||
$age = $row['feed_age'];
|
$age = $row['feed_age'];
|
||||||
|
@ -293,58 +246,58 @@ 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="<?=htmlspecialchars($row['feed_title'])?>"><img src='<?=$row['feed_image']?>' width='16' height='16' border='0' /></a></td>
|
{
|
||||||
<?php } else { ?>
|
print "<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='image/feed-icon.png' width='16' height='16' border='0' /></a></td>
|
}
|
||||||
<?php } ?>
|
else
|
||||||
|
{
|
||||||
|
print "<td><a href=\"$url\" title=\"feed\"><img src='image/feed-icon.png' width='16' height='16' border='0' /></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>
|
print "<td><a href=\"$link\" title=\"home page\">$title</a></td>";
|
||||||
<td align=right>
|
|
||||||
|
print "<td align=right>";
|
||||||
|
|
||||||
<?php
|
|
||||||
if($tags)
|
if($tags)
|
||||||
{
|
{
|
||||||
$i = 0;
|
|
||||||
foreach($tags as $tag)
|
foreach($tags as $tag)
|
||||||
{
|
{
|
||||||
$utag = htmlspecialchars($tag);
|
$utag = urlencode($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'>";
|
$utitle = urlencode($title);
|
||||||
$i++;
|
print "$tag <a href='prefs.php?untagfeed=$id&tag=$utag&title=$utitle'>[x]</a> ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$flt = isset($row['prefs']['filter']) ? htmlspecialchars($row['prefs']['filter']) : '';
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</td>";
|
||||||
|
$title = htmlspecialchars($title);
|
||||||
|
print "<td><form method=post action=prefs.php><input type=hidden name=title value=\"$title\"><input type=hidden name=feed_id value=$id><input type=string name=tag> <input type=submit name=tagfeed value='Tag Feed'> <small><i>(separate tags with spaces)</i></small></form></td></tr>";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
|
||||||
<td><input class="editbox" type="text" name="tag_<?=$id?>" /></td>
|
|
||||||
<td>
|
|
||||||
<input type="hidden" name="orighide_<?=$id?>" value="<?=!empty($row['prefs']['hide_content']) ? 1 : 0?>" />
|
|
||||||
<input type="checkbox" value="1" name="hide_<?=$id?>" title="Hide item content by default" <?= !empty($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>
|
|
||||||
<?php } ?>
|
|
||||||
</table>
|
</table>
|
||||||
<input type="submit" value="Save feed preferences" />
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php if(fof_is_admin()) { ?>
|
<?php if(fof_is_admin()) { ?>
|
||||||
|
|
||||||
<br><h1>Feed on Feeds - Admin Options</h1>
|
<br><h1>Feed on Feeds - Admin Options</h1>
|
||||||
<form method="post" action="prefs.php" style="border: 1px solid black; margin: 10px; padding: 10px;">
|
<form method="post" action="prefs.php" style="border: 1px solid black; margin: 10px; padding: 10px;">
|
||||||
Enable logging? <input type=checkbox name=logging <?php if($prefs->get('logging')) echo "checked" ?> /><br><br>
|
Enable logging? <input type=checkbox name=logging <?php if($prefs->get('logging')) echo "checked" ?>><br><br>
|
||||||
Purge read items after <input size=4 type=string name=purge value="<?php echo $prefs->get('purge')?>" /> days (leave blank to never purge)<br><br>
|
Purge read items after <input size=4 type=string name=purge value="<?php echo $prefs->get('purge')?>"> days (leave blank to never purge)<br><br>
|
||||||
Allow automatic feed updates every <input size=4 type=string name=autotimeout value="<?php echo $prefs->get('autotimeout')?>" /> minutes<br><br>
|
Allow automatic feed updates every <input size=4 type=string name=autotimeout value="<?php echo $prefs->get('autotimeout')?>"> minutes<br><br>
|
||||||
Allow manual feed updates every <input size=4 type=string name=manualtimeout value="<?php echo $prefs->get('manualtimeout')?>" /> minutes<br><br>
|
Allow manual feed updates every <input size=4 type=string name=manualtimeout value="<?php echo $prefs->get('manualtimeout')?>"> minutes<br><br>
|
||||||
Show <b>Top <input size=3 type=string name=topreaders_count value="<?=intval($prefs->get('topreaders_count'))?>" /> readers in last <input size=3 type=string name=topreaders_days value="<?=intval($prefs->get('topreaders_days'))?>" /> days</b> statistics on the login page<br><br>
|
<input type=submit name=adminprefs value="Save Options">
|
||||||
Suggest users to subscribe to <input size=3 type=string name=suggestadd value="<?=intval($prefs->get('suggestadd'))?>" /> most popular feeds<br><br>
|
|
||||||
<input type=submit name=adminprefs value="Save Options" />
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<br><h1>Add User</h1>
|
<br><h1>Add User</h1>
|
||||||
|
@ -355,7 +308,6 @@ Username: <input type=string name=username> Password: <input type=string name=pa
|
||||||
<?php
|
<?php
|
||||||
$result = fof_db_query("select user_name from $FOF_USER_TABLE where user_id > 1");
|
$result = fof_db_query("select user_name from $FOF_USER_TABLE where user_id > 1");
|
||||||
|
|
||||||
$delete_options = '';
|
|
||||||
while($row = fof_db_get_row($result))
|
while($row = fof_db_get_row($result))
|
||||||
{
|
{
|
||||||
$username = $row['user_name'];
|
$username = $row['user_name'];
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
include_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
|
|
||||||
$prefs = FoF_Prefs::instance();
|
$prefs =& FoF_Prefs::instance();
|
||||||
|
|
||||||
foreach($_POST as $k => $v)
|
foreach($_POST as $k => $v)
|
||||||
{
|
{
|
||||||
|
@ -22,3 +22,5 @@ foreach($_POST as $k => $v)
|
||||||
}
|
}
|
||||||
|
|
||||||
$prefs->save();
|
$prefs->save();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
430
sha256.inc
|
@ -1,430 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
* Transparent SHA-256 Implementation for PHP 4 and PHP 5
|
|
||||||
*
|
|
||||||
* Author: Perry McGee (pmcgee@nanolink.ca)
|
|
||||||
* Website: http://www.nanolink.ca/pub/sha256
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006,2007,2008,2009 Nanolink Solutions
|
|
||||||
*
|
|
||||||
* Created: Feb 11, 2006
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
* or see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* Include:
|
|
||||||
*
|
|
||||||
* require_once("[path/]sha256.inc.php");
|
|
||||||
*
|
|
||||||
* Usage Options:
|
|
||||||
*
|
|
||||||
* 1) $shaStr = hash('sha256', $string_to_hash);
|
|
||||||
*
|
|
||||||
* 2) $shaStr = sha256($string_to_hash[, bool ignore_php5_hash = false]);
|
|
||||||
*
|
|
||||||
* 3) $obj = new nanoSha2([bool $upper_case_output = false]);
|
|
||||||
* $shaStr = $obj->hash($string_to_hash[, bool $ignore_php5_hash = false]);
|
|
||||||
*
|
|
||||||
* Reference: http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html
|
|
||||||
*
|
|
||||||
* 2007-12-13: Cleaned up for initial public release
|
|
||||||
* 2008-05-10: Moved all helper functions into a class. API access unchanged.
|
|
||||||
* 2009-06-23: Created abstraction of hash() routine
|
|
||||||
* 2009-07-23: Added detection of 32 vs 64bit platform, and patches.
|
|
||||||
* Ability to define "_NANO_SHA2_UPPER" to yeild upper case hashes.
|
|
||||||
* 2009-08-01: Added ability to attempt to use mhash() prior to running pure
|
|
||||||
* php code.
|
|
||||||
*
|
|
||||||
* NOTE: Some sporadic versions of PHP do not handle integer overflows the
|
|
||||||
* same as the majority of builds. If you get hash results of:
|
|
||||||
* 7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff
|
|
||||||
*
|
|
||||||
* If you do not have permissions to change PHP versions (if you did
|
|
||||||
* you'd probably upgrade to PHP 5 anyway) it is advised you install a
|
|
||||||
* module that will allow you to use their hashing routines, examples are:
|
|
||||||
* - mhash module : http://ca3.php.net/mhash
|
|
||||||
* - Suhosin : http://www.hardened-php.net/suhosin/
|
|
||||||
*
|
|
||||||
* If you install the Suhosin module, this script will transparently
|
|
||||||
* use their routine and define the PHP routine as _nano_sha256().
|
|
||||||
*
|
|
||||||
* If the mhash module is present, and $ignore_php5_hash = false the
|
|
||||||
* script will attempt to use the output from mhash prior to running
|
|
||||||
* the PHP code.
|
|
||||||
*/
|
|
||||||
if (!class_exists('nanoSha2'))
|
|
||||||
{
|
|
||||||
class nanoSha2
|
|
||||||
{
|
|
||||||
// php 4 - 5 compatable class properties
|
|
||||||
var $toUpper;
|
|
||||||
var $platform;
|
|
||||||
|
|
||||||
// Php 4 - 6 compatable constructor
|
|
||||||
function nanoSha2($toUpper = false) {
|
|
||||||
// Determine if the caller wants upper case or not.
|
|
||||||
$this->toUpper = is_bool($toUpper)
|
|
||||||
? $toUpper
|
|
||||||
: ((defined('_NANO_SHA2_UPPER')) ? true : false);
|
|
||||||
|
|
||||||
// Deteremine if the system is 32 or 64 bit.
|
|
||||||
$tmpInt = (int)4294967295;
|
|
||||||
$this->platform = ($tmpInt > 0) ? 64 : 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do the SHA-256 Padding routine (make input a multiple of 512 bits)
|
|
||||||
function char_pad($str)
|
|
||||||
{
|
|
||||||
$tmpStr = $str;
|
|
||||||
|
|
||||||
$l = strlen($tmpStr)*8; // # of bits from input string
|
|
||||||
|
|
||||||
$tmpStr .= "\x80"; // append the "1" bit followed by 7 0's
|
|
||||||
|
|
||||||
$k = (512 - (($l + 8 + 64) % 512)) / 8; // # of 0 bytes to append
|
|
||||||
$k += 4; // PHP Strings will never exceed (2^31)-1, 1st 32bits of
|
|
||||||
// the 64-bit value representing $l can be all 0's
|
|
||||||
|
|
||||||
for ($x = 0; $x < $k; $x++) {
|
|
||||||
$tmpStr .= "\0";
|
|
||||||
}
|
|
||||||
|
|
||||||
// append the 32-bits representing # of bits from input string ($l)
|
|
||||||
$tmpStr .= chr((($l>>24) & 0xFF));
|
|
||||||
$tmpStr .= chr((($l>>16) & 0xFF));
|
|
||||||
$tmpStr .= chr((($l>>8) & 0xFF));
|
|
||||||
$tmpStr .= chr(($l & 0xFF));
|
|
||||||
|
|
||||||
return $tmpStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Here are the bitwise and functions as defined in FIPS180-2 Standard
|
|
||||||
function addmod2n($x, $y, $n = 4294967296) // Z = (X + Y) mod 2^32
|
|
||||||
{
|
|
||||||
$mask = 0x80000000;
|
|
||||||
|
|
||||||
if ($x < 0) {
|
|
||||||
$x &= 0x7FFFFFFF;
|
|
||||||
$x = (float)$x + $mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($y < 0) {
|
|
||||||
$y &= 0x7FFFFFFF;
|
|
||||||
$y = (float)$y + $mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = $x + $y;
|
|
||||||
|
|
||||||
if ($r >= $n) {
|
|
||||||
while ($r >= $n) {
|
|
||||||
$r -= $n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int)$r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logical bitwise right shift (PHP default is arithmetic shift)
|
|
||||||
function SHR($x, $n) // x >> n
|
|
||||||
{
|
|
||||||
if ($n >= 32) { // impose some limits to keep it 32-bit
|
|
||||||
return (int)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($n <= 0) {
|
|
||||||
return (int)$x;
|
|
||||||
}
|
|
||||||
|
|
||||||
$mask = 0x40000000;
|
|
||||||
|
|
||||||
if ($x < 0) {
|
|
||||||
$x &= 0x7FFFFFFF;
|
|
||||||
$mask = $mask >> ($n-1);
|
|
||||||
return ($x >> $n) | $mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int)$x >> (int)$n;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ROTR($x, $n) { return (int)(($this->SHR($x, $n) | ($x << (32-$n)) & 0xFFFFFFFF)); }
|
|
||||||
function Ch($x, $y, $z) { return ($x & $y) ^ ((~$x) & $z); }
|
|
||||||
function Maj($x, $y, $z) { return ($x & $y) ^ ($x & $z) ^ ($y & $z); }
|
|
||||||
function Sigma0($x) { return (int) ($this->ROTR($x, 2)^$this->ROTR($x, 13)^$this->ROTR($x, 22)); }
|
|
||||||
function Sigma1($x) { return (int) ($this->ROTR($x, 6)^$this->ROTR($x, 11)^$this->ROTR($x, 25)); }
|
|
||||||
function sigma_0($x) { return (int) ($this->ROTR($x, 7)^$this->ROTR($x, 18)^$this->SHR($x, 3)); }
|
|
||||||
function sigma_1($x) { return (int) ($this->ROTR($x, 17)^$this->ROTR($x, 19)^$this->SHR($x, 10)); }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Custom functions to provide PHP support
|
|
||||||
*/
|
|
||||||
// split a byte-string into integer array values
|
|
||||||
function int_split($input)
|
|
||||||
{
|
|
||||||
$l = strlen($input);
|
|
||||||
|
|
||||||
if ($l <= 0) {
|
|
||||||
return (int)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($l % 4) != 0) { // invalid input
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ($i = 0; $i < $l; $i += 4)
|
|
||||||
{
|
|
||||||
$int_build = (ord($input[$i]) << 24);
|
|
||||||
$int_build += (ord($input[$i+1]) << 16);
|
|
||||||
$int_build += (ord($input[$i+2]) << 8);
|
|
||||||
$int_build += (ord($input[$i+3]));
|
|
||||||
|
|
||||||
$result[] = $int_build;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process and return the hash.
|
|
||||||
*
|
|
||||||
* @param $str Input string to hash
|
|
||||||
* @param $ig_func Option param to ignore checking for php > 5.1.2
|
|
||||||
* @return string Hexadecimal representation of the message digest
|
|
||||||
*/
|
|
||||||
function hash($str, $ig_func = false)
|
|
||||||
{
|
|
||||||
unset($binStr); // binary representation of input string
|
|
||||||
unset($hexStr); // 256-bit message digest in readable hex format
|
|
||||||
|
|
||||||
// check for php's internal sha256 function, ignore if ig_func==true
|
|
||||||
if ($ig_func == false) {
|
|
||||||
if (version_compare(PHP_VERSION,'5.1.2','>=')) {
|
|
||||||
return hash("sha256", $str, false);
|
|
||||||
} else if (function_exists('mhash') && defined('MHASH_SHA256')) {
|
|
||||||
return base64_encode(bin2hex(mhash(MHASH_SHA256, $str)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SHA-256 Constants
|
|
||||||
* Sequence of sixty-four constant 32-bit words representing the
|
|
||||||
* first thirty-two bits of the fractional parts of the cube roots
|
|
||||||
* of the first sixtyfour prime numbers.
|
|
||||||
*/
|
|
||||||
$K = array((int)0x428a2f98, (int)0x71374491, (int)0xb5c0fbcf,
|
|
||||||
(int)0xe9b5dba5, (int)0x3956c25b, (int)0x59f111f1,
|
|
||||||
(int)0x923f82a4, (int)0xab1c5ed5, (int)0xd807aa98,
|
|
||||||
(int)0x12835b01, (int)0x243185be, (int)0x550c7dc3,
|
|
||||||
(int)0x72be5d74, (int)0x80deb1fe, (int)0x9bdc06a7,
|
|
||||||
(int)0xc19bf174, (int)0xe49b69c1, (int)0xefbe4786,
|
|
||||||
(int)0x0fc19dc6, (int)0x240ca1cc, (int)0x2de92c6f,
|
|
||||||
(int)0x4a7484aa, (int)0x5cb0a9dc, (int)0x76f988da,
|
|
||||||
(int)0x983e5152, (int)0xa831c66d, (int)0xb00327c8,
|
|
||||||
(int)0xbf597fc7, (int)0xc6e00bf3, (int)0xd5a79147,
|
|
||||||
(int)0x06ca6351, (int)0x14292967, (int)0x27b70a85,
|
|
||||||
(int)0x2e1b2138, (int)0x4d2c6dfc, (int)0x53380d13,
|
|
||||||
(int)0x650a7354, (int)0x766a0abb, (int)0x81c2c92e,
|
|
||||||
(int)0x92722c85, (int)0xa2bfe8a1, (int)0xa81a664b,
|
|
||||||
(int)0xc24b8b70, (int)0xc76c51a3, (int)0xd192e819,
|
|
||||||
(int)0xd6990624, (int)0xf40e3585, (int)0x106aa070,
|
|
||||||
(int)0x19a4c116, (int)0x1e376c08, (int)0x2748774c,
|
|
||||||
(int)0x34b0bcb5, (int)0x391c0cb3, (int)0x4ed8aa4a,
|
|
||||||
(int)0x5b9cca4f, (int)0x682e6ff3, (int)0x748f82ee,
|
|
||||||
(int)0x78a5636f, (int)0x84c87814, (int)0x8cc70208,
|
|
||||||
(int)0x90befffa, (int)0xa4506ceb, (int)0xbef9a3f7,
|
|
||||||
(int)0xc67178f2);
|
|
||||||
|
|
||||||
// Pre-processing: Padding the string
|
|
||||||
$binStr = $this->char_pad($str);
|
|
||||||
|
|
||||||
// Parsing the Padded Message (Break into N 512-bit blocks)
|
|
||||||
$M = str_split($binStr, 64);
|
|
||||||
|
|
||||||
// Set the initial hash values
|
|
||||||
$h[0] = (int)0x6a09e667;
|
|
||||||
$h[1] = (int)0xbb67ae85;
|
|
||||||
$h[2] = (int)0x3c6ef372;
|
|
||||||
$h[3] = (int)0xa54ff53a;
|
|
||||||
$h[4] = (int)0x510e527f;
|
|
||||||
$h[5] = (int)0x9b05688c;
|
|
||||||
$h[6] = (int)0x1f83d9ab;
|
|
||||||
$h[7] = (int)0x5be0cd19;
|
|
||||||
|
|
||||||
// loop through message blocks and compute hash. ( For i=1 to N : )
|
|
||||||
for ($i = 0; $i < count($M); $i++)
|
|
||||||
{
|
|
||||||
// Break input block into 16 32bit words (message schedule prep)
|
|
||||||
$MI = $this->int_split($M[$i]);
|
|
||||||
|
|
||||||
// Initialize working variables
|
|
||||||
$_a = (int)$h[0];
|
|
||||||
$_b = (int)$h[1];
|
|
||||||
$_c = (int)$h[2];
|
|
||||||
$_d = (int)$h[3];
|
|
||||||
$_e = (int)$h[4];
|
|
||||||
$_f = (int)$h[5];
|
|
||||||
$_g = (int)$h[6];
|
|
||||||
$_h = (int)$h[7];
|
|
||||||
unset($_s0);
|
|
||||||
unset($_s1);
|
|
||||||
unset($_T1);
|
|
||||||
unset($_T2);
|
|
||||||
$W = array();
|
|
||||||
|
|
||||||
// Compute the hash and update
|
|
||||||
for ($t = 0; $t < 16; $t++)
|
|
||||||
{
|
|
||||||
// Prepare the first 16 message schedule values as we loop
|
|
||||||
$W[$t] = $MI[$t];
|
|
||||||
|
|
||||||
// Compute hash
|
|
||||||
$_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)), $this->Ch($_e, $_f, $_g)), $K[$t]), $W[$t]);
|
|
||||||
$_T2 = $this->addmod2n($this->Sigma0($_a), $this->Maj($_a, $_b, $_c));
|
|
||||||
|
|
||||||
// Update working variables
|
|
||||||
$_h = $_g; $_g = $_f; $_f = $_e; $_e = $this->addmod2n($_d, $_T1);
|
|
||||||
$_d = $_c; $_c = $_b; $_b = $_a; $_a = $this->addmod2n($_T1, $_T2);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; $t < 64; $t++)
|
|
||||||
{
|
|
||||||
// Continue building the message schedule as we loop
|
|
||||||
$_s0 = $W[($t+1)&0x0F];
|
|
||||||
$_s0 = $this->sigma_0($_s0);
|
|
||||||
$_s1 = $W[($t+14)&0x0F];
|
|
||||||
$_s1 = $this->sigma_1($_s1);
|
|
||||||
|
|
||||||
$W[$t&0xF] = $this->addmod2n($this->addmod2n($this->addmod2n($W[$t&0xF], $_s0), $_s1), $W[($t+9)&0x0F]);
|
|
||||||
|
|
||||||
// Compute hash
|
|
||||||
$_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)), $this->Ch($_e, $_f, $_g)), $K[$t]), $W[$t&0xF]);
|
|
||||||
$_T2 = $this->addmod2n($this->Sigma0($_a), $this->Maj($_a, $_b, $_c));
|
|
||||||
|
|
||||||
// Update working variables
|
|
||||||
$_h = $_g; $_g = $_f; $_f = $_e; $_e = $this->addmod2n($_d, $_T1);
|
|
||||||
$_d = $_c; $_c = $_b; $_b = $_a; $_a = $this->addmod2n($_T1, $_T2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$h[0] = $this->addmod2n($h[0], $_a);
|
|
||||||
$h[1] = $this->addmod2n($h[1], $_b);
|
|
||||||
$h[2] = $this->addmod2n($h[2], $_c);
|
|
||||||
$h[3] = $this->addmod2n($h[3], $_d);
|
|
||||||
$h[4] = $this->addmod2n($h[4], $_e);
|
|
||||||
$h[5] = $this->addmod2n($h[5], $_f);
|
|
||||||
$h[6] = $this->addmod2n($h[6], $_g);
|
|
||||||
$h[7] = $this->addmod2n($h[7], $_h);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert the 32-bit words into human readable hexadecimal format.
|
|
||||||
$hexStr = sprintf("%08x%08x%08x%08x%08x%08x%08x%08x", $h[0], $h[1], $h[2], $h[3], $h[4], $h[5], $h[6], $h[7]);
|
|
||||||
|
|
||||||
return ($this->toUpper) ? strtoupper($hexStr) : $hexStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('str_split'))
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Splits a string into an array of strings with specified length.
|
|
||||||
* Compatability with older verions of PHP
|
|
||||||
*/
|
|
||||||
function str_split($string, $split_length = 1)
|
|
||||||
{
|
|
||||||
$sign = ($split_length < 0) ? -1 : 1;
|
|
||||||
$strlen = strlen($string);
|
|
||||||
$split_length = abs($split_length);
|
|
||||||
|
|
||||||
if (($split_length == 0) || ($strlen == 0)) {
|
|
||||||
$result = false;
|
|
||||||
} elseif ($split_length >= $strlen) {
|
|
||||||
$result[] = $string;
|
|
||||||
} else {
|
|
||||||
$length = $split_length;
|
|
||||||
|
|
||||||
for ($i = 0; $i < $strlen; $i++)
|
|
||||||
{
|
|
||||||
$i = (($sign < 0) ? $i + $length : $i);
|
|
||||||
$result[] = substr($string, $sign*$i, $length);
|
|
||||||
$i--;
|
|
||||||
$i = (($sign < 0) ? $i : $i + $length);
|
|
||||||
|
|
||||||
$length = (($i + $split_length) > $strlen)
|
|
||||||
? ($strlen - ($i + 1))
|
|
||||||
: $split_length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main routine called from an application using this include.
|
|
||||||
*
|
|
||||||
* General usage:
|
|
||||||
* require_once('sha256.inc.php');
|
|
||||||
* $hashstr = sha256('abc');
|
|
||||||
*
|
|
||||||
* Note:
|
|
||||||
* PHP Strings are limitd to (2^31)-1, so it is not worth it to
|
|
||||||
* check for input strings > 2^64 as the FIPS180-2 defines.
|
|
||||||
*/
|
|
||||||
// 2009-07-23: Added check for function as the Suhosin plugin adds this routine.
|
|
||||||
if (!function_exists('sha256')) {
|
|
||||||
function sha256($str, $ig_func = false) {
|
|
||||||
$obj = new nanoSha2((defined('_NANO_SHA2_UPPER')) ? true : false);
|
|
||||||
return $obj->hash($str, $ig_func);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
function _nano_sha256($str, $ig_func = false) {
|
|
||||||
$obj = new nanoSha2((defined('_NANO_SHA2_UPPER')) ? true : false);
|
|
||||||
return $obj->hash($str, $ig_func);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// support to give php4 the hash() routine which abstracts this code.
|
|
||||||
if (!function_exists('hash'))
|
|
||||||
{
|
|
||||||
function hash($algo, $data)
|
|
||||||
{
|
|
||||||
if (empty($algo) || !is_string($algo) || !is_string($data)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (function_exists($algo)) {
|
|
||||||
return $algo($data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bugzilla password hashing */
|
|
||||||
function bz_crypt($password, $salt)
|
|
||||||
{
|
|
||||||
$algorithm = '';
|
|
||||||
if (preg_match('/{([^}]+)}$/', $salt, $m))
|
|
||||||
$algorithm = $m[1];
|
|
||||||
|
|
||||||
if (!$algorithm)
|
|
||||||
return crypt($password, $salt);
|
|
||||||
elseif (strtolower($algorithm) == 'sha-256')
|
|
||||||
{
|
|
||||||
$salt = substr($salt, 0, 8);
|
|
||||||
return $salt . substr(base64_encode(pack('H*',sha256($password . $salt))), 0, -1) . '{' . $algorithm . '}';
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
172
shared.php
|
@ -16,10 +16,10 @@ $fof_no_login = true;
|
||||||
include_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
include_once("fof-render.php");
|
include_once("fof-render.php");
|
||||||
|
|
||||||
$user = !empty($_GET['user']) ? intval($_GET['user']) : 0;
|
$user = $_GET['user'];
|
||||||
if(!$user) die;
|
if(!isset($user)) die;
|
||||||
|
|
||||||
$format = !empty($_GET['format']) ? $_GET['format'] : '';
|
$format = $_GET['format'];
|
||||||
|
|
||||||
$prefs = new FoF_Prefs($user);
|
$prefs = new FoF_Prefs($user);
|
||||||
$sharing = $prefs->get("sharing");
|
$sharing = $prefs->get("sharing");
|
||||||
|
@ -28,82 +28,71 @@ if($sharing == "no") die;
|
||||||
$name = $prefs->get("sharedname");
|
$name = $prefs->get("sharedname");
|
||||||
$url = $prefs->get("sharedurl");
|
$url = $prefs->get("sharedurl");
|
||||||
|
|
||||||
$what = $sharing;
|
$which = ($sharing == "all") ? "all" : "shared";
|
||||||
$extratitle = '';
|
|
||||||
if(isset($_GET['what']))
|
if(isset($_GET['which']))
|
||||||
{
|
{
|
||||||
$what = ($sharing == "all") ? $_GET['what'] : "$sharing, " . $_GET['what'];
|
$which = ($sharing == "all") ? $_GET['which'] : "shared " . $_GET['which'];
|
||||||
$extratitle .= " items tagged " . $_GET['what'];
|
$extratitle = " items tagged " . $_GET['which'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed = NULL;
|
$feed = NULL;
|
||||||
if(isset($_GET['feed']))
|
if(isset($_GET['feed']))
|
||||||
{
|
{
|
||||||
$feed = intval($_GET['feed']);
|
$feed = $_GET['feed'];
|
||||||
$r = fof_db_get_feed_by_id($feed, fof_current_user());
|
$r = fof_db_get_feed_by_id($feed);
|
||||||
$extratitle .= ' from <a href="' . htmlspecialchars($r['feed_link']) . '">' . htmlspecialchars(fof_feed_title($r)) . '</a>';
|
$extratitle .= " from <a href='" . $r['feed_link'] . "'>" . $r['feed_title'] . "</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$when = NULL;
|
$result = fof_get_items($user, $feed, $which, NULL, 0, 100);
|
||||||
if(isset($_GET['when']) && preg_match('#^\d+/\d+/\d+$#s', $_GET['when']))
|
|
||||||
$when = $_GET['when'];
|
|
||||||
|
|
||||||
$offset = isset($_GET['offset']) ? intval($_GET['offset']) : 0;
|
|
||||||
|
|
||||||
$result = fof_get_items($user, $feed, $what, $when, $offset, 101);
|
$shared_feed = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?user=$user&format=atom");
|
||||||
if (count($result) > 100)
|
$shared_link = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?user=$user");
|
||||||
|
|
||||||
|
if(isset($_GET['which']))
|
||||||
{
|
{
|
||||||
$next = true;
|
$shared_feed .= '&which=' . $_GET['which'];
|
||||||
array_pop($result);
|
$shared_link .= '&which=' . $_GET['which'];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$next = false;
|
|
||||||
|
|
||||||
function lnk($what = NULL, $atom = false, $offset = NULL)
|
if(isset($_GET['feed']))
|
||||||
{
|
{
|
||||||
global $user;
|
$shared_feed .= '&feed=' . $_GET['feed'];
|
||||||
$link = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?user=$user";
|
$shared_link .= '&feed=' . $_GET['feed'];
|
||||||
if (isset($_GET['what']) && $what === NULL)
|
|
||||||
$what = $_GET['what'];
|
|
||||||
if ($what !== NULL)
|
|
||||||
$link .= '&what='.urlencode($what);
|
|
||||||
if (!empty($_GET['feed']))
|
|
||||||
$link .= '&feed='.intval($_GET['feed']);
|
|
||||||
if ($offset > 0)
|
|
||||||
$link .= '&offset='.intval($offset);
|
|
||||||
if ($atom)
|
|
||||||
$link .= '&format=atom';
|
|
||||||
return htmlspecialchars($link);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($format == "atom")
|
if($format == "atom")
|
||||||
{
|
{
|
||||||
header("Content-Type: application/atom+xml; charset=utf-8");
|
header("Content-Type: application/atom+xml; charset=utf-8");
|
||||||
print '<?xml version="1.0"?>';
|
echo '<?xml version="1.0"?>';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
<title>Feed on Feeds - Shared Items<?php if($name) echo " from $name"; if($extratitle) echo " " . strip_tags($extratitle) ?></title>
|
<title>Feed on Feeds - Shared Items<?php if($name) echo " from $name"; if($extratitle) echo " " . strip_tags($extratitle) ?></title>
|
||||||
<updated><?= gmdate('Y-m-d\TH:i:s\Z')?></updated>
|
<updated><?php echo gmdate('Y-m-d\TH:i:s\Z')?></updated>
|
||||||
<generator uri="http://feedonfeeds.com/">Feed on Feeds</generator>
|
<generator uri="http://feedonfeeds.com/">Feed on Feeds</generator>
|
||||||
<?php if($name) echo "<author><name>$name</name></author>"; ?>
|
<?php if($name) echo "<author><name>$name</name></author>"; ?>
|
||||||
<id><?= lnk(NULL, true) ?></id>
|
<id><?php echo $shared_feed ?></id>
|
||||||
<link href="<?= lnk(NULL, true) ?>" rel="self" type="application/atom+xml"/>
|
<link href="<?php echo $shared_feed ?>" rel="self" type="application/atom+xml"/>
|
||||||
<link href="<?= lnk() ?>" rel="alternate"/>
|
<link href="<?php echo $shared_link ?>" rel="alternate"/>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
foreach($result as $item)
|
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($item['feed_url']);
|
||||||
$feed_title = htmlspecialchars(fof_feed_title($item));
|
$feed_title = htmlspecialchars($item['feed_title']);
|
||||||
|
|
||||||
$item_link = htmlspecialchars($item['item_link']);
|
$item_link = htmlspecialchars($item['item_link']);
|
||||||
|
|
||||||
$item_guid = $item['item_guid'];
|
$item_guid = $item['item_guid'];
|
||||||
if (!preg_match("/^[a-z0-9\.\+\-]+:/", $item_guid))
|
if(!ereg("^[a-z0-9\.\+\-]+:", $item_guid))
|
||||||
|
{
|
||||||
$item_guid = $feed_link . '#' . $item_guid;
|
$item_guid = $feed_link . '#' . $item_guid;
|
||||||
|
}
|
||||||
$item_guid = htmlspecialchars($item_guid);
|
$item_guid = htmlspecialchars($item_guid);
|
||||||
|
|
||||||
$item_title = htmlspecialchars($item['item_title']);
|
$item_title = htmlspecialchars($item['item_title']);
|
||||||
|
@ -118,16 +107,16 @@ foreach($result as $item)
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<entry>
|
<entry>
|
||||||
<id><?= $item_guid ?></id>
|
<id><?php echo $item_guid ?></id>
|
||||||
<link href="<?= $item_link ?>" rel="alternate" type="text/html"/>
|
<link href="<?php echo $item_link ?>" rel="alternate" type="text/html"/>
|
||||||
<title type="html"><?= $item_title ?></title>
|
<title type="html"><?php echo $item_title ?></title>
|
||||||
<summary type="html"><?= $item_content ?></summary>
|
<summary type="html"><?php echo $item_content ?></summary>
|
||||||
<updated><?= $item_updated ?></updated>
|
<updated><?php echo $item_updated ?></updated>
|
||||||
<source>
|
<source>
|
||||||
<id><?= $feed_link ?></id>
|
<id><?php echo $feed_link ?></id>
|
||||||
<link href="<?= $feed_link ?>" rel="alternate" type="text/html"/>
|
<link href="<?php echo $feed_link ?>" rel="alternate" type="text/html"/>
|
||||||
<link href="<?= $feed_url ?>" rel="self" type="application/atom+xml"/>
|
<link href="<?php echo $feed_url ?>" rel="self" type="application/atom+xml"/>
|
||||||
<title><?= $feed_title ?></title>
|
<title><?php echo $feed_title ?></title>
|
||||||
</source>
|
</source>
|
||||||
</entry>
|
</entry>
|
||||||
<?php
|
<?php
|
||||||
|
@ -138,11 +127,11 @@ else
|
||||||
{
|
{
|
||||||
header("Content-Type: text/html; charset=utf-8");
|
header("Content-Type: text/html; charset=utf-8");
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<link rel="alternate" href="<?= lnk(NULL, true) ?>" type="application/atom+xml"/>
|
<link rel="alternate" href="<?php echo $shared_feed?>" type="application/atom+xml"/>
|
||||||
<title>Feed on Feeds - Shared Items<?php if($name) echo " from $name"; if($extratitle) echo " " . strip_tags($extratitle) ?></title>
|
<title>Feed on Feeds - Shared Items<?php if($name) echo " from $name"; if($extratitle) echo " " . strip_tags($extratitle) ?></title>
|
||||||
<link rel="stylesheet" href="fof.css" media="screen" />
|
<link rel="stylesheet" href="fof.css" media="screen" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -156,32 +145,19 @@ header("Content-Type: text/html; charset=utf-8");
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.pages { text-align: center; }
|
|
||||||
.pages a { margin: 0.5em; }
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1 class="box">
|
<h1 class="box"><a href="http://feedonfeeds.com/">Feed on Feeds</a> - Shared Items
|
||||||
<a href="http://feedonfeeds.com/">Feed on Feeds</a> - Shared Items
|
<?php if($name) echo " from ";
|
||||||
<?php if($name) { ?>
|
if($url) echo "<a href='$url'>";
|
||||||
from <a href="<?= lnk() ?>"><?= $name ?></a>
|
if($name) echo "$name";
|
||||||
<?php if($url) { ?>
|
if($url) echo "</a>";
|
||||||
<a href="<?= $url ?>"><img src="image/external.png" width="10" height="10" /></a>
|
if($extratitle) echo "<br><i>$extratitle</i>" ?>
|
||||||
<?php } ?>
|
|
||||||
<?= $extratitle ? "<br><i>$extratitle</i>" : "" ?>
|
|
||||||
<?php } ?>
|
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="pages">
|
|
||||||
<?php if($offset) { ?>
|
|
||||||
<a href="<?= lnk(NULL, false, max($offset-100, 0)) ?>">newer items</a>
|
|
||||||
<?php } if($next) { ?>
|
|
||||||
<a href="<?= lnk(NULL, false, $offset+100) ?>">earlier items</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="items">
|
<div id="items">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -194,7 +170,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 = fof_feed_title($item);
|
$feed_title = $item['feed_title'];
|
||||||
$feed_image = $item['feed_image'];
|
$feed_image = $item['feed_image'];
|
||||||
$feed_description = $item['feed_description'];
|
$feed_description = $item['feed_description'];
|
||||||
|
|
||||||
|
@ -202,6 +178,7 @@ foreach($result as $item)
|
||||||
$item_id = $item['item_id'];
|
$item_id = $item['item_id'];
|
||||||
$item_title = $item['item_title'];
|
$item_title = $item['item_title'];
|
||||||
$item_content = $item['item_content'];
|
$item_content = $item['item_content'];
|
||||||
|
$item_read = $item['item_read'];
|
||||||
|
|
||||||
$item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset*60*60);
|
$item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset*60*60);
|
||||||
$item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset*60*60);
|
$item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset*60*60);
|
||||||
|
@ -212,35 +189,42 @@ foreach($result as $item)
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
|
||||||
<h1>
|
<h1>
|
||||||
<?php if($item_link) { ?>
|
<a href="<?php echo $item_link ?>">
|
||||||
<a href="<?=htmlspecialchars($item_link)?>"><?= $item_title ?></a>
|
<?php echo $item_title ?>
|
||||||
<?php } else { ?>
|
</a>
|
||||||
<?= $item_title ?>
|
|
||||||
<?php } ?>
|
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
|
||||||
<span class='dash'> - </span>
|
<span class='dash'> - </span>
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
<span class="tags">
|
|
||||||
<?php foreach($item['tags'] as $t) {
|
<span class="meta">on <?php echo $item_published ?> GMT</span>
|
||||||
if (!preg_match('#\b'.str_replace('#', '\\#', preg_quote($t)).'\b#', $sharing)) { ?>
|
|
||||||
<a href="<?= lnk($t) ?>"><?=htmlspecialchars($t)?></a>
|
|
||||||
<?php } } ?>
|
|
||||||
</span>
|
|
||||||
<span class="meta">on <?= $item_published ?> GMT</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="body"><?= $item_content ?></div>
|
|
||||||
|
<div class="body"><?php echo $item_content ?></div>
|
||||||
|
|
||||||
<div class="clearer"></div>
|
<div class="clearer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } if(!$result) { ?>
|
<?php
|
||||||
<p><i>No shared items.</i></p>
|
}
|
||||||
<?php } ?>
|
|
||||||
|
if(count($result) == 0)
|
||||||
|
{
|
||||||
|
echo "<p><i>No shared items.</i></p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
</div></body></html>
|
</div></body></html>
|
||||||
|
|
||||||
|
|
90
sidebar.php
|
@ -17,10 +17,11 @@ include_once("fof-main.php");
|
||||||
fof_set_content_type();
|
fof_set_content_type();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<img id="throbber" src="image/throbber.gif" align="left" style="display: none" />
|
<img id="throbber" src="image/throbber.gif" align="left" style="position: fixed; left: 0; top: 0; display: none;">
|
||||||
|
|
||||||
<div id="welcome">Welcome <b><?php echo $fof_user_name ?></b>! <a href="prefs.php">prefs</a> | <a href="logout.php">log out</a> | <a href="http://feedonfeeds.com/">about</a></div>
|
<center id="welcome">Welcome <b><?php echo $fof_user_name ?></b>! <a href="prefs.php">prefs</a> | <a href="logout.php">log out</a> | <a href="http://feedonfeeds.com/">about</a></center>
|
||||||
<div id="addupd"><a href="add.php"><b>Add Feeds</b></a> / <a href="update.php"><b>Update Feeds</b></a></div>
|
<br>
|
||||||
|
<center><a href="add.php"><b>Add Feeds</b></a> / <a href="update.php"><b>Update Feeds</b></a></center>
|
||||||
|
|
||||||
<ul id="nav">
|
<ul id="nav">
|
||||||
|
|
||||||
|
@ -29,17 +30,27 @@ fof_set_content_type();
|
||||||
$order = $fof_prefs_obj->get('feed_order');
|
$order = $fof_prefs_obj->get('feed_order');
|
||||||
$direction = $fof_prefs_obj->get('feed_direction');
|
$direction = $fof_prefs_obj->get('feed_direction');
|
||||||
|
|
||||||
$what = !empty($_GET['what']) ? $_GET['what'] : 'unread';
|
if(!isset($_GET['what']))
|
||||||
$when = !empty($_GET['when']) ? $_GET['when'] : NULL;
|
{
|
||||||
$search = !empty($_GET['search']) ? $_GET['search'] : NULL;
|
$what = "unread";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$what = $_GET['what'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$when = $_GET['when'];
|
||||||
|
|
||||||
|
$search = $_GET['search'];
|
||||||
|
|
||||||
echo "<script>what='$what'; when='$when';</script>";
|
echo "<script>what='$what'; when='$when';</script>";
|
||||||
|
|
||||||
|
|
||||||
$feeds = fof_get_feeds(fof_current_user(), $order, $direction);
|
$feeds = fof_get_feeds(fof_current_user(), $order, $direction);
|
||||||
|
|
||||||
$unread = $starred = $total = 0;
|
|
||||||
foreach($feeds as $row)
|
foreach($feeds as $row)
|
||||||
{
|
{
|
||||||
|
$n++;
|
||||||
$unread += $row['feed_unread'];
|
$unread += $row['feed_unread'];
|
||||||
$starred += $row['feed_starred'];
|
$starred += $row['feed_starred'];
|
||||||
$total += $row['feed_items'];
|
$total += $row['feed_items'];
|
||||||
|
@ -60,8 +71,8 @@ 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 == "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 == "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">< Today</a></li>
|
<li <?php if($what == "all" && isset($when)) echo "style='background: #ddd'" ?> ><a href=".?what=all&when=today">< Today</a></li>
|
||||||
<li <?php if($what == "all" && !isset($when)) echo "style='background: #ddd'" ?> ><a href="?what=all">All Items <?php if($total) echo "($total)" ?></a></li>
|
<li <?php if($what == "all" && !isset($when)) echo "style='background: #ddd'" ?> ><a href=".?what=all&how=paged">All Items <?php if($total) echo "($total)" ?></a></li>
|
||||||
<li <?php if(isset($search)) echo "style='background: #ddd'" ?> ><a href="javascript:Element.toggle('search'); Field.focus('searchfield');void(0);">Search</a>
|
<li <?php if(isset($search)) echo "style='background: #ddd'" ?> ><a href="javascript:Element.toggle('search'); Field.focus('searchfield');void(0);">Search</a>
|
||||||
<form action="." id="search" <?php if(!isset($search)) echo 'style="display: none"' ?>>
|
<form action="." id="search" <?php if(!isset($search)) echo 'style="display: none"' ?>>
|
||||||
<input id="searchfield" name="search" value="<?php echo $search?>">
|
<input id="searchfield" name="search" value="<?php echo $search?>">
|
||||||
|
@ -81,6 +92,7 @@ echo "<script>starred = $starred;</script>";
|
||||||
$tags = fof_get_tags(fof_current_user());
|
$tags = fof_get_tags(fof_current_user());
|
||||||
|
|
||||||
$n = 0;
|
$n = 0;
|
||||||
|
|
||||||
foreach($tags as $tag)
|
foreach($tags as $tag)
|
||||||
{
|
{
|
||||||
$tag_id = $tag['tag_id'];
|
$tag_id = $tag['tag_id'];
|
||||||
|
@ -101,7 +113,6 @@ if($n)
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$t = 0;
|
|
||||||
foreach($tags as $tag)
|
foreach($tags as $tag)
|
||||||
{
|
{
|
||||||
$tag_name = $tag['tag_name'];
|
$tag_name = $tag['tag_name'];
|
||||||
|
@ -112,31 +123,40 @@ foreach($tags as $tag)
|
||||||
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
|
else
|
||||||
|
{
|
||||||
print "<tr>";
|
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'>$count</a></td>";
|
||||||
print "<td><b><a href='.?what=$tag_name".($unread?",unread":"")."'>$tag_name</a></b></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>";
|
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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
<div id="feeds">
|
<div id="feeds">
|
||||||
|
|
||||||
<div id="feedlist">
|
<div id="feedlist">
|
||||||
|
|
||||||
<table cellspacing="0" cellpadding="1" border="0" id="feedlisttable">
|
<table cellspacing="0" cellpadding="1" border="0">
|
||||||
|
|
||||||
<tr class="heading">
|
<tr class="heading">
|
||||||
|
|
||||||
|
@ -195,7 +215,7 @@ foreach($feeds as $row)
|
||||||
{
|
{
|
||||||
$id = $row['feed_id'];
|
$id = $row['feed_id'];
|
||||||
$url = $row['feed_url'];
|
$url = $row['feed_url'];
|
||||||
$title = fof_feed_title($row);
|
$title = $row['feed_title'];
|
||||||
$link = $row['feed_link'];
|
$link = $row['feed_link'];
|
||||||
$description = $row['feed_description'];
|
$description = $row['feed_description'];
|
||||||
$age = $row['feed_age'];
|
$age = $row['feed_age'];
|
||||||
|
@ -207,13 +227,18 @@ foreach($feeds as $row)
|
||||||
$lateststr = $row['lateststr'];
|
$lateststr = $row['lateststr'];
|
||||||
$lateststrabbr = $row['lateststrabbr'];
|
$lateststrabbr = $row['lateststrabbr'];
|
||||||
|
|
||||||
|
|
||||||
if(++$t % 2)
|
if(++$t % 2)
|
||||||
|
{
|
||||||
print "<tr class=\"odd-row\">";
|
print "<tr class=\"odd-row\">";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
|
}
|
||||||
|
|
||||||
$u = ".?feed=$id";
|
$u = ".?feed=$id";
|
||||||
$u2 = ".?feed=$id&what=all";
|
$u2 = ".?feed=$id&what=all&how=paged";
|
||||||
|
|
||||||
print "<td><span title=\"$agestr\" id=\"${id}-agestr\">$agestrabbr</span></td>";
|
print "<td><span title=\"$agestr\" id=\"${id}-agestr\">$agestrabbr</span></td>";
|
||||||
|
|
||||||
|
@ -222,7 +247,9 @@ foreach($feeds as $row)
|
||||||
print "<td class=\"nowrap\" id=\"${id}-items\">";
|
print "<td class=\"nowrap\" id=\"${id}-items\">";
|
||||||
|
|
||||||
if($unread)
|
if($unread)
|
||||||
|
{
|
||||||
print "<a class=\"unread\" title=\"new items\" href=\"$u\">$unread</a>/";
|
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>";
|
||||||
|
|
||||||
|
@ -230,20 +257,22 @@ foreach($feeds as $row)
|
||||||
|
|
||||||
print "<td align='center'>";
|
print "<td align='center'>";
|
||||||
if($row['feed_image'] && $fof_prefs_obj->get('favicons'))
|
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>";
|
print "<a href=\"$url\" title=\"feed\"><img src='" . $row['feed_image'] . "' width='16' height='16' border='0' /></a>";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
print "<a href=\"$url\" title=\"feed\"><img src='image/feed-icon.png' width='16' height='16' border='0' /></a>";
|
print "<a href=\"$url\" title=\"feed\"><img src='image/feed-icon.png' width='16' height='16' border='0' /></a>";
|
||||||
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print "<a href=\"".($unread ? $u : $u2)."\" title=\"".($unread ? "unread" : "all")." items\"><b>".htmlspecialchars($title)."</b></a>";
|
print "<a href=\"$link\" title=\"home page\"><b>$title</b></a></td>";
|
||||||
if ($link)
|
|
||||||
print " <a href=\"$link\" title=\"home page\"><img width=\"10\" height=\"10\" alt='home page' src='image/external.png' /></a>";
|
|
||||||
print "</td>";
|
|
||||||
print "<td><nobr>";
|
print "<td><nobr>";
|
||||||
|
|
||||||
print "<a href=\"update.php?feed=$id\" title=\"update\">u</a>";
|
print "<a href=\"update.php?feed=$id\" title=\"update\">u</a>";
|
||||||
$stitle = addslashes($title);
|
$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=\"#\" 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=\"delete.php?feed=$id\" title=\"delete\" onclick=\"return confirm('Unsubscribe [$stitle] --are you SURE?')\">d</a>";
|
||||||
|
|
||||||
|
@ -259,3 +288,22 @@ foreach($feeds as $row)
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$order = $_GET['order'];
|
||||||
|
$direction = $_GET['direction'];
|
||||||
|
|
||||||
|
if(!isset($order))
|
||||||
|
{
|
||||||
|
$order = "title";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($direction))
|
||||||
|
{
|
||||||
|
$direction = "asc";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
Index: simplepie.inc
|
||||||
|
===================================================================
|
||||||
|
--- simplepie.inc (revision 810)
|
||||||
|
+++ simplepie.inc (working copy)
|
||||||
|
@@ -6495,6 +6495,10 @@
|
||||||
|
curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // added by FoF to enable https and digest authentication
|
||||||
|
+ curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
+ curl_setopt($fp, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
||||||
|
|
||||||
|
$this->headers = curl_exec($fp);
|
||||||
|
if (curl_errno($fp) == 23 || curl_errno($fp) == 61)
|
|
@ -17,12 +17,11 @@ include_once("fof-main.php");
|
||||||
fof_set_content_type();
|
fof_set_content_type();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>feed on feeds - uninstallation</title>
|
<title>feed on feeds - uninstallation</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<link rel="stylesheet" href="fof.css" media="screen" />
|
<link rel="stylesheet" href="fof.css" media="screen" />
|
||||||
<script src="fof.js" type="text/javascript"></script>
|
<script src="fof.js" type="text/javascript"></script>
|
||||||
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
|
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_time_limit(60*100);
|
set_time_limit(60*10);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ $fof_no_login = true;
|
||||||
$fof_user_id = 1;
|
$fof_user_id = 1;
|
||||||
include_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
|
|
||||||
$p = FoF_Prefs::instance();
|
$p =& FoF_Prefs::instance();
|
||||||
$fof_admin_prefs = $p->prefs;
|
$fof_admin_prefs = $p->prefs;
|
||||||
|
|
||||||
fof_log("=== update started, timeout = $fof_admin_prefs[autotimeout], purge = $fof_admin_prefs[purge] ===", "update");
|
fof_log("=== update started, timeout = $fof_admin_prefs[autotimeout], purge = $fof_admin_prefs[purge] ===", "update");
|
||||||
|
@ -57,3 +57,4 @@ fof_db_optimize();
|
||||||
fof_log("=== update complete ===", "update");
|
fof_log("=== update complete ===", "update");
|
||||||
|
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
?>
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ -z "`ps ax | grep php | grep update-quiet | head -n 1 | awk '{print $1}'`" ]; then
|
|
||||||
cd `dirname $0` && /usr/bin/php update-quiet.php
|
|
||||||
fi
|
|
|
@ -19,7 +19,7 @@ print("<br>");
|
||||||
$feed = $_GET['feed'];
|
$feed = $_GET['feed'];
|
||||||
$feeds = array();
|
$feeds = array();
|
||||||
|
|
||||||
$p = FoF_Prefs::instance();
|
$p =& FoF_Prefs::instance();
|
||||||
$admin_prefs = $p->admin_prefs;
|
$admin_prefs = $p->admin_prefs;
|
||||||
|
|
||||||
if($feed)
|
if($feed)
|
||||||
|
@ -69,5 +69,5 @@ print(join($feedjson, ", "));
|
||||||
print("];\n</script>");
|
print("];\n</script>");
|
||||||
|
|
||||||
include("footer.php");
|
include("footer.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
30
urandom.inc
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
function urandom($nbytes = 16)
|
|
||||||
{
|
|
||||||
$pr_bits = NULL;
|
|
||||||
// Unix/Linux platform?
|
|
||||||
$fp = @fopen('/dev/urandom', 'rb');
|
|
||||||
if ($fp !== FALSE)
|
|
||||||
{
|
|
||||||
$pr_bits = @fread($fp, $nbytes);
|
|
||||||
@fclose($fp);
|
|
||||||
}
|
|
||||||
// MS-Windows platform?
|
|
||||||
elseif (@class_exists('COM'))
|
|
||||||
{
|
|
||||||
// http://msdn.microsoft.com/en-us/library/aa388176(VS.85).aspx
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$CAPI_Util = new COM('CAPICOM.Utilities.1');
|
|
||||||
$pr_bits = $CAPI_Util->GetRandom($nbytes,0);
|
|
||||||
// if we ask for binary data PHP munges it, so we
|
|
||||||
// request base64 return value.
|
|
||||||
$pr_bits = base64_decode($pr_bits);
|
|
||||||
}
|
|
||||||
catch (Exception $ex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $pr_bits;
|
|
||||||
}
|
|
|
@ -4,18 +4,20 @@
|
||||||
*
|
*
|
||||||
* view-action.php - marks selected items as read (or unread)
|
* view-action.php - marks selected items as read (or unread)
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* Copyright (C) 2004-2007 Stephen Minutillo
|
* Copyright (C) 2004-2007 Stephen Minutillo
|
||||||
* steve@minutillo.com - http://minutillo.com/steve/
|
* steve@minutillo.com - http://minutillo.com/steve/
|
||||||
*
|
*
|
||||||
* Distributed under the GPL - see LICENSE
|
* Distributed under the GPL - see LICENSE
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
|
|
||||||
$items = [];
|
|
||||||
while (list ($key, $val) = each ($_POST))
|
while (list ($key, $val) = each ($_POST))
|
||||||
{
|
{
|
||||||
$first = false;
|
$first = false;
|
||||||
|
|
||||||
if($val == "checked")
|
if($val == "checked")
|
||||||
{
|
{
|
||||||
$key = substr($key, 1);
|
$key = substr($key, 1);
|
||||||
|
@ -23,11 +25,11 @@ while (list ($key, $val) = each ($_POST))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_REQUEST['deltag']))
|
if($_REQUEST['deltag'])
|
||||||
{
|
{
|
||||||
fof_untag(fof_current_user(), $_REQUEST['deltag']);
|
fof_untag(fof_current_user(), $_REQUEST['deltag']);
|
||||||
}
|
}
|
||||||
elseif (!empty($_POST['feed']))
|
else if($_POST['feed'])
|
||||||
{
|
{
|
||||||
fof_db_mark_feed_read(fof_current_user(), $_POST['feed']);
|
fof_db_mark_feed_read(fof_current_user(), $_POST['feed']);
|
||||||
}
|
}
|
||||||
|
@ -36,12 +38,16 @@ else
|
||||||
if($items)
|
if($items)
|
||||||
{
|
{
|
||||||
if($_POST['action'] == 'read')
|
if($_POST['action'] == 'read')
|
||||||
|
{
|
||||||
fof_db_mark_read(fof_current_user(), $items);
|
fof_db_mark_read(fof_current_user(), $items);
|
||||||
elseif ($_POST['action'] == 'unread')
|
}
|
||||||
|
|
||||||
|
if($_POST['action'] == 'unread')
|
||||||
|
{
|
||||||
fof_db_mark_unread(fof_current_user(), $items);
|
fof_db_mark_unread(fof_current_user(), $items);
|
||||||
elseif ($_POST['action'] == 'delete')
|
}
|
||||||
fof_db_delete_items(fof_current_user(), $items, !fof_is_admin());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: " . urldecode($_POST['return']));
|
header("Location: " . urldecode($_POST['return']));
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|