Commit 64fcb6e7 authored by Sebastian Reichel's avatar Sebastian Reichel

Imported Upstream version 1.5.4

parent ea560b7b
......@@ -3,4 +3,5 @@ icons/*
cache/*/*
lock/*
tags
cache/htmlpurifier/*/*ser
lib/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/*/*ser
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:stylesheet
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:template match="/atom:feed">
<html>
<head>
<title><xsl:value-of select="rss/channel/title"/></title>
<title><xsl:value-of select="atom:title"/></title>
<link rel="stylesheet" type="text/css" href="utility.css"/>
<script language="javascript" src="lib/xsl_mop-up.js"></script>
</head>
......@@ -21,24 +23,18 @@
<img class="feedicon" src="images/feed-icon-64x64.png" alt="feed icon"/>
<h1><xsl:value-of select="rss/channel/title"/></h1>
<h1><xsl:value-of select="atom:title"/></h1>
<p class="description">This is an RSS feed exported from
<p class="description">This feed has been exported from
<a target="_new" class="extlink" href="http://tt-rss.org">Tiny Tiny RSS</a>.
You must install a news aggregator to subscribe to it.
This feed contains the following items:</p>
You need a news reader software to subscribe to it.
It contains the following items:</p>
<!-- <p class="description"><xsl:value-of
select="rss/channel/description"/></p> -->
<xsl:for-each select="rss/channel/item">
<h2><a target="_new" href="{link}"><xsl:value-of select="title"/></a></h2>
<!-- <div><a class="extlink" target="_new"
href="{link}"><xsl:value-of select="link"/></a></div> -->
<xsl:for-each select="atom:entry">
<h2><a target="_new" href="{atom:link/@href}"><xsl:value-of select="atom:title"/></a></h2>
<div name="decodeme" class="content">
<xsl:value-of select="description" disable-output-escaping="yes"/>
<xsl:value-of select="atom:content" disable-output-escaping="yes"/>
</div>
<xsl:if test="enclosure">
......
......@@ -44,8 +44,6 @@
$subop = $_REQUEST["subop"];
$mode = $_REQUEST["mode"];
$print_exec_time = false;
if ((!$op || $op == "rss" || $op == "dlg") && !$_REQUEST["noxml"]) {
header("Content-Type: application/xml; charset=utf-8");
} else {
......@@ -61,7 +59,8 @@
}
if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" &&
$op != "rss" && $op != "getUnread" && $op != "getProfiles") {
$op != "rss" && $op != "getUnread" && $op != "getProfiles" &&
$op != "fbexport" && $op != "logout" && $op != "pubsub") {
header("Content-Type: text/plain");
print json_encode(array("error" => array("code" => 6)));
......@@ -122,10 +121,11 @@
require_once "modules/pref-filters.php";
require_once "modules/pref-labels.php";
require_once "modules/pref-users.php";
require_once "modules/pref-instances.php";
$error = sanity_check($link);
if ($error['code'] != 0) {
if ($error['code'] != 0 && $op != "logout") {
print json_encode(array("error" => $error));
return;
}
......@@ -181,7 +181,8 @@
$id = db_escape_string($_REQUEST['id']);
$result = db_query($link, "SELECT link FROM ttrss_entries, ttrss_user_entries
WHERE id = '$id' AND id = ref_id AND owner_uid = '".$_SESSION['uid']."'");
WHERE id = '$id' AND id = ref_id AND owner_uid = '".$_SESSION['uid']."'
LIMIT 1");
if (db_num_rows($result) == 1) {
$article_url = db_fetch_result($result, 0, 'link');
......@@ -211,6 +212,15 @@
array_push($articles, format_article($link, $id, false));
} else if ($mode == "zoom") {
array_push($articles, format_article($link, $id, false, true, true));
} else if ($mode == "raw") {
if ($_REQUEST['html']) {
header("Content-Type: text/html");
print '<link rel="stylesheet" type="text/css" href="tt-rss.css"/>';
}
$article = format_article($link, $id, false);
print $article['content'];
return;
} else {
catchupArticleById($link, $id, 0);
}
......@@ -427,6 +437,10 @@
module_pref_feed_browser($link);
break; // pref-feed-browser
case "pref-instances":
module_pref_instances($link);
break; // pref-instances
case "rss":
$feed = db_escape_string($_REQUEST["id"]);
$key = db_escape_string($_REQUEST["key"]);
......@@ -482,22 +496,21 @@
print "-1;User not found";
}
$print_exec_time = false;
break; // getUnread
case "digestTest":
print_r(prepare_headlines_digest($link, $_SESSION["uid"]));
$print_exec_time = false;
break; // digestTest
case "digestSend":
send_headlines_digests($link);
$print_exec_time = false;
break; // digestSend
case "loading":
header("Content-type: text/html");
print __("Loading, please wait...") . " " .
"<img src='images/indicator_tiny.gif'>";
break; // loading
case "getProfiles":
$login = db_escape_string($_REQUEST["login"]);
......@@ -522,15 +535,91 @@
$_SESSION = array();
}
break;
break; // getprofiles
} // Select action according to $op value.
case "pubsub":
$mode = db_escape_string($_REQUEST['hub_mode']);
$feed_id = db_escape_string($_REQUEST['id']);
$feed_url = db_escape_string($_REQUEST['hub_topic']);
// TODO: implement hub_verifytoken checking
$result = db_query($link, "SELECT feed_url FROM ttrss_feeds
WHERE id = '$feed_id'");
$check_feed_url = db_fetch_result($result, 0, "feed_url");
if ($check_feed_url && ($check_feed_url == $feed_url || !$feed_url)) {
if ($mode == "subscribe") {
db_query($link, "UPDATE ttrss_feeds SET pubsub_state = 2
WHERE id = '$feed_id'");
print $_REQUEST['hub_challenge'];
return;
} else if ($mode == "unsubscribe") {
db_query($link, "UPDATE ttrss_feeds SET pubsub_state = 0
WHERE id = '$feed_id'");
print $_REQUEST['hub_challenge'];
return;
} else if (!$mode) {
// Received update ping, schedule feed update.
update_rss_feed($link, $feed_id, true, true);
}
} else {
header('HTTP/1.0 404 Not Found');
}
break; // pubsub
case "logout":
logout_user();
header("Location: tt-rss.php");
break; // logout
case "fbexport":
$access_key = db_escape_string($_POST["key"]);
// TODO: rate limit checking using last_connected
$result = db_query($link, "SELECT id FROM ttrss_linked_instances
WHERE access_key = '$access_key'");
if (db_num_rows($result) == 1) {
$instance_id = db_fetch_result($result, 0, "id");
$result = db_query($link, "SELECT feed_url, site_url, title, subscribers
FROM ttrss_feedbrowser_cache ORDER BY subscribers DESC LIMIT 100");
$feeds = array();
while ($line = db_fetch_assoc($result)) {
array_push($feeds, $line);
}
db_query($link, "UPDATE ttrss_linked_instances SET
last_status_in = 1 WHERE id = '$instance_id'");
print json_encode(array("feeds" => $feeds));
} else {
print json_encode(array("error" => array("code" => 6)));
}
break; // fbexport
default:
header("Content-Type: text/plain");
print json_encode(array("error" => array("code" => 7)));
break; // fallback
} // Select action according to $op value.
// We close the connection to database.
db_close($link);
?>
<?php if ($print_exec_time) { ?>
<!-- <?php echo sprintf("Backend execution time: %.4f seconds", getmicrotime() - $script_started) ?> -->
<?php } ?>
<?php
// Your RDBMS must be configured to accept connections
// via TCP/IP and authentified by password.
// Database server configuration
define('DB_TYPE', "pgsql"); // or mysql
define('DB_HOST', "localhost");
define('DB_USER', "fox");
......@@ -9,38 +7,35 @@
define('DB_PASS', "XXXXXX");
//define('DB_PORT', '5432'); // when neeeded, PG-only
define('MAGPIE_FETCH_TIME_OUT', 60);
// Magpie's default timeout is 5 seconds. Some RSS feeds,
// such as from large Trac installs, can take significantly
// longer than 5 seconds to generate. To prevent failed
// updates, increase this.
define('SELF_URL_PATH', 'http://localhost/tt-rss');
// Full URL of your tt-rss installation. You need to set this option
// correctly for tt-rss to function properly.
define('MAGPIE_CACHE_DIR', 'cache/magpie');
// Local cache directory for RSS feeds
define('SINGLE_USER_MODE', true);
// Operate in single user mode, disables all functionality related to
// multiple users.
define('CACHE_DIR', 'cache');
// Local cache directory for RSS feed content.
define('MAGPIE_CACHE_AGE', 60*30);
// How long to store cached RSS objects? In seconds.
// Defaults to 30 minutes
define('SIMPLEPIE_CACHE_IMAGES', false);
// Allow caching feed images when using SimplePie, to bypass hotlink
// prevention and such at expense of local disk space and bandwidth.
// Note that you (or your users) also have to enable image caching
// in feed editor.
define('ICONS_DIR', "icons");
define('ICONS_URL', "icons");
// Local and URL path to the directory, where feed favicons are stored.
// Unless you really know what you're doing, please keep those relative
// to tt-rss main directory.
// Please note that Apache may reserve /icons/ URL to itself so you might
// need to change this and rename icons/ directory if you install tt-rss
// into website root.
define('SINGLE_USER_MODE', true);
// Operate in single user mode, disables all functionality related to
// multiple users.
define('TMP_DIRECTORY', '/tmp');
// Directory for temporary files
define('ENABLE_UPDATE_DAEMON', false);
// This enables different mechanism for user-triggered updates designed
// for update daemon running in background on the server.
// This option suggests FEEDS_FRAME_REFRESH set to a small value
// (like 60 seconds, depending on number of users and server/bandwidth load).
define('DAEMON_SLEEP_INTERVAL', 120);
// Interval between update daemon update runs
......@@ -86,20 +81,11 @@
// Connection charset for MySQL. If you have a legacy database and/or experience
// garbage unicode characters with this option, try setting it to a blank string.
define('DEFAULT_UPDATE_METHOD', 1);
define('DEFAULT_UPDATE_METHOD', 0);
// Which feed parsing library to use as default:
// 0 - Magpie
// 1 - SimplePie
define('SIMPLEPIE_CACHE_DIR', 'cache/simplepie');
// Cache directory for RSS feeds when using SimplePie
define('SIMPLEPIE_CACHE_IMAGES', false);
// Allow caching feed images when using SimplePie, to bypass hotlink
// prevention and such at expense of local disk space and bandwidth.
// Note that you (or your users) also have to enable image caching
// in feed editor.
define('COUNTERS_MAX_AGE', 365);
// Hard limit for unread counters calculation. Try tweaking this
// parameter to speed up tt-rss when having a huge number of articles
......@@ -125,15 +111,22 @@
// Limits the amount of feeds daemon (or a cronjob) updates on one run
define('ALLOW_REMOTE_USER_AUTH', false);
// Set to 'true' if you trust your web server's REMOTE_USER
// environment variable to validate that the user is logged in. This
// option can be used to integrate tt-rss with Apache's external
// authentication modules.
// Set to 'true' if you trust your web server's REMOTE_USER
// environment variable that the user is logged in. This option can be
// used to integrate tt-rss with Apache's external authentication modules.
define('AUTO_LOGIN', false);
// Set this to true if you use ALLOW_REMOTE_USER_AUTH and you want
// to skip the login form. If set to true, users won't be able to
// set application language and settings profile.
// Set this to true if you use ALLOW_REMOTE_USER_AUTH or client SSL
// certificate authentication and you want to skip the login form.
// If set to true, users won't be able to set application language
// and settings profile.
// Otherwise users will be redirected to login form with their login
// information pre-filled.
define('AUTO_CREATE_USER', false);
// If users are authenticated by your web server, set this to true if
// You want new users to be automaticaly created in tt-rss database
// on first login
define('LOCK_DIRECTORY', 'lock');
// Directory for lockfiles, must be writable to the user you run
......@@ -173,7 +166,8 @@
// Please see http://tt-rss.org/wiki/SphinxSearch for more information.
define('SPHINX_INDEX', 'ttrss');
// Index name in Sphinx configuration
// Index name in Sphinx configuration. You can specify multiple indexes
// as a comma-separated string.
define('ENABLE_TWEET_BUTTON', false);
// Enable 'tweet this' button for articles
......@@ -183,11 +177,19 @@
// Your OAuth instance authentication information for Twitter, visit
// http://twitter.com/oauth_clients to register your instance.
define('PUBSUBHUBBUB_HUB', '');
// URL to a PubSubHubbub-compatible hub server. If defined, "Published
// articles" generated feed would automatically become PUSH-enabled.
define('PUBSUBHUBBUB_ENABLED', true);
// Enable client PubSubHubbub support in tt-rss. When disabled, tt-rss
// won't try to subscribe to PUSH feed updates.
define('ISCONFIGURED', false);
// Please set this to true if you have read everything above and
// finished setting configuration options.
define('CONFIG_VERSION', 21);
define('CONFIG_VERSION', 23);
// Expected config version. Please update this option in config.php
// if necessary (after migrating all new options from this file).
......
......@@ -4,15 +4,15 @@
require_once "sanity_check.php";
require_once "config.php";
require_once "db.php";
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
init_connection($link);
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
init_connection($link);
login_sequence($link);
$owner_uid = $_SESSION["uid"];
if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
$_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script.");
render_login_form($link);
exit;
......@@ -36,7 +36,7 @@ function confirmOP() {
}
</script>
<div class="floatingLogo"><img src="images/ttrss_logo.png"></div>
<div class="floatingLogo"><img src="images/logo_wide.png"></div>
<h1><?php echo __("Database Updater") ?></h1>
......@@ -45,7 +45,7 @@ function confirmOP() {
$result = "";
while(!feof($fp)) {
$tmp = fgetc($fp);
if($tmp == $delim) {
return $result;
}
......@@ -53,27 +53,27 @@ function confirmOP() {
}
return $result;
}
$op = $_POST["op"];
$result = db_query($link, "SELECT schema_version FROM ttrss_version");
$version = db_fetch_result($result, 0, "schema_version");
$update_files = glob("schema/versions/".DB_TYPE."/*sql");
$update_versions = array();
foreach ($update_files as $f) {
$m = array();
preg_match_all("/schema\/versions\/".DB_TYPE."\/(\d*)\.sql/", $f, $m,
PREG_PATTERN_ORDER);
if ($m[1][0]) {
$update_versions[$m[1][0]] = $f;
}
}
ksort($update_versions, SORT_NUMERIC);
$latest_version = max(array_keys($update_versions));
if ($version == $latest_version) {
......@@ -81,7 +81,7 @@ function confirmOP() {
if ($version != SCHEMA_VERSION) {
print_error(__("Could not update database"));
print "<p>" .
print "<p>" .
__("Could not find necessary schema file, need version:") .
" " . SCHEMA_VERSION . __(", found: ") . $latest_version . "</p>";
......@@ -92,35 +92,33 @@ function confirmOP() {
</form>";
}
return;
}
if (!$op) {
} else if ($version <= $latest_version && !$op) {
print_warning(__("Please backup your database before proceeding."));
print "<p>" . T_sprintf("Your Tiny Tiny RSS database needs update to the latest version (<b>%d</b> to <b>%d</b>).", $version, $latest_version) . "</p>";
/* print "<p>Available incremental updates:";
foreach (array_keys($update_versions) as $v) {
if ($v > $version) {
print " <a href='$update_versions[$v]'>$v</a>";
}
} */
print "</p>";
print "<form method='POST'>
<input type='hidden' name='op' value='do'>
<input type='submit' onclick='return confirmOP()' value='".__("Perform updates")."'>