Commit f53db3b4 authored by Sebastian Reichel's avatar Sebastian Reichel

Imported Upstream version 1.6.2+dfsg

parent 84e55a62
......@@ -10,23 +10,19 @@ Licensed under GNU GPL version 2
Copyright (c) 2005-2010 Andrew Dolgov (unless explicitly stated otherwise).
Requirements
============
## Requirements
* Compatible web browser (http://tt-rss.org/wiki/CompatibleBrowsers)
* Web server, for example Apache
* PHP (with support for mbstring functions)
* PostgreSQL (tested on 8.3) or MySQL (InnoDB and version 4.1+ required)
* Compatible web browser (http://tt-rss.org/wiki/CompatibleBrowsers)
* Web server, for example Apache
* PHP (with support for mbstring functions)
* PostgreSQL (tested on 8.3) or MySQL (InnoDB and version 4.1+ required)
Installation Notes
==================
## Installation Notes
http://tt-rss.org/wiki/InstallationNotes
http://tt-rss.org/wiki/InstallationNotes
See also
========
* FAQ: http://tt-rss.org/wiki/FrequentlyAskedQuestions
* Forum: http://tt-rss.org/forum
* Wiki: http://tt-rss.org/wiki/WikiStart
## See also
* FAQ: http://tt-rss.org/wiki/FrequentlyAskedQuestions
* Forum: http://tt-rss.org/forum
* Wiki: http://tt-rss.org/wiki/WikiStart
......@@ -3,10 +3,10 @@
require_once "../config.php";
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . PATH_SEPARATOR .
set_include_path(dirname(__FILE__) . PATH_SEPARATOR .
dirname(dirname(__FILE__)) . PATH_SEPARATOR .
dirname(dirname(__FILE__)) . "/include" );
dirname(dirname(__FILE__)) . "/include" . PATH_SEPARATOR .
get_include_path());
chdir("..");
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
/* remove ill effects of magic quotes */
......
......@@ -280,7 +280,7 @@ class API extends Handler {
$article_id = join(",", array_filter(explode(",", db_escape_string($_REQUEST["article_id"])), is_numeric));
$query = "SELECT id,title,link,content,feed_id,comments,int_id,
$query = "SELECT id,title,link,content,cached_content,feed_id,comments,int_id,
marked,unread,published,
".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
author
......@@ -309,7 +309,7 @@ class API extends Handler {
"comments" => $line["comments"],
"author" => $line["author"],
"updated" => strtotime($line["updated"]),
"content" => $line["content"],
"content" => $line["cached_content"] != "" ? $line["cached_content"] : $line["content"],
"feed_id" => $line["feed_id"],
"attachments" => $attachments
);
......
......@@ -50,6 +50,8 @@ class Dlg extends Handler_Protected {
$opml->opml_import($_SESSION["uid"]);
db_query($this->link, "COMMIT");
print "</ul>";
print "</div>";
......@@ -531,9 +533,11 @@ class Dlg extends Handler_Protected {
print "<content><![CDATA[";
print __("Match:"). "&nbsp;" .
"<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\">&nbsp;Any&nbsp;";
print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\">&nbsp;All&nbsp;";
print "&nbsp;tags.";
"<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\" id=\"tag_mode_any\">";
print "<label for=\"tag_mode_any\">".__("Any")."</label>";
print "&nbsp;";
print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\" id=\"tag_mode_all\">";
print "<label for=\"tag_mode_all\">".__("All tags.")."</input>";
print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">";
$result = db_query($this->link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = ".$_SESSION['uid']."
......
......@@ -158,16 +158,20 @@ class Feeds extends Handler_Protected {
// Update the feed if required with some basic flood control
$result = db_query($this->link,
"SELECT cache_images,".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
"SELECT cache_images,cache_content,".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
FROM ttrss_feeds WHERE id = '$feed'");
if (db_num_rows($result) != 0) {
$last_updated = strtotime(db_fetch_result($result, 0, "last_updated"));
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
$cache_content = sql_bool_to_bool(db_fetch_result($result, 0, "cache_content"));
if (!$cache_images && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) {
if (!$cache_images && !$cache_content && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) {
include "rssfuncs.php";
update_rss_feed($this->link, $feed, true, true);
} else {
db_query($this->link, "UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
WHERE id = '$feed'");
}
}
}
......@@ -234,6 +238,7 @@ class Feeds extends Handler_Protected {
$feed_title = $qfh_ret[1];
$feed_site_url = $qfh_ret[2];
$last_error = $qfh_ret[3];
$cache_content = true;
$vgroup_last_feed = $vgr_last_feed;
......@@ -627,6 +632,10 @@ class Feeds extends Handler_Protected {
$feed_site_url = $line["site_url"];
if ($cache_content && $line["cached_content"] != "") {
$line["content_preview"] =& $line["cached_content"];
}
$article_content = sanitize($this->link, $line["content_preview"],
false, false, $feed_site_url);
......
<?php
class Filter {
protected $link;
function __construct($link) {
$this->link = $link;
}
function filter_article($article) {
return $article;
}
}
?>
<?php
class Filter_RedditImgur {
function filter_article($article) {
if (strpos($article["link"], "reddit.com/r/") !== FALSE) {
if (strpos($article["content"], "i.imgur.com") !== FALSE) {
$doc = new DOMDocument();
@$doc->loadHTML($article["content"]);
if ($doc) {
$xpath = new DOMXPath($doc);
$entries = $xpath->query('(//a[@href]|//img[@src])');
foreach ($entries as $entry) {
if ($entry->hasAttribute("href")) {
if (preg_match("/\.(jpg|jpeg|gif|png)$/i", $entry->getAttribute("href"))) {
$img = $doc->createElement('img');
$img->setAttribute("src", $entry->getAttribute("href"));
$entry->parentNode->replaceChild($img, $entry);
}
}
// remove tiny thumbnails
if ($entry->hasAttribute("src")) {
if ($entry->parentNode && $entry->parentNode->parentNode) {
$entry->parentNode->parentNode->removeChild($entry->parentNode);
}
}
}
$node = $doc->getElementsByTagName('body')->item(0);
if ($node) {
$article["content"] = $doc->saveXML($node, LIBXML_NOEMPTYTAG);
}
}
}
}
return $article;
}
}
?>
......@@ -377,6 +377,10 @@ class Handler_Public extends Handler {
}
function sharepopup() {
if (SINGLE_USER_MODE) {
login_sequence($this->link);
}
header('Content-Type: text/html; charset=utf-8');
print "<html>
<head>
......@@ -542,6 +546,10 @@ class Handler_Public extends Handler {
}
function subscribe() {
if (SINGLE_USER_MODE) {
login_sequence($this->link);
}
if ($_SESSION["uid"]) {
$feed_url = db_escape_string(trim($_REQUEST["feed_url"]));
......
......@@ -388,6 +388,9 @@ class Opml extends Handler_Protected {
if ($root_node) {
$cat_title = db_escape_string($root_node->attributes->getNamedItem('text')->nodeValue);
if (!$cat_title)
$cat_title = db_escape_string($root_node->attributes->getNamedItem('title')->nodeValue);
if (!in_array($cat_title, array("tt-rss-filters", "tt-rss-labels", "tt-rss-prefs"))) {
$cat_id = get_feed_category($this->link, $cat_title, $parent_id);
db_query($this->link, "BEGIN");
......@@ -416,6 +419,10 @@ class Opml extends Handler_Protected {
if ($node->hasAttributes() && strtolower($node->tagName) == "outline") {
$attrs = $node->attributes;
$node_cat_title = db_escape_string($attrs->getNamedItem('text')->nodeValue);
if (!$node_cat_title)
$node_cat_title = db_escape_string($attrs->getNamedItem('title')->nodeValue);
$node_feed_url = db_escape_string($attrs->getNamedItem('xmlUrl')->nodeValue);
if ($node_cat_title && !$node_feed_url) {
......
......@@ -653,6 +653,19 @@ class Pref_Feeds extends Handler_Protected {
$checked>&nbsp;<label for=\"cache_images\">".
__('Cache images locally')."</label>";
$cache_content = sql_bool_to_bool(db_fetch_result($result, 0, "cache_content"));
if ($cache_content) {
$checked = "checked=\"1\"";
} else {
$checked = "";
}
print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"cache_content\"
name=\"cache_content\"
$checked>&nbsp;<label for=\"cache_content\">".
__('Cache content locally')."</label>";
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
if ($mark_unread_on_update) {
......@@ -914,6 +927,8 @@ class Pref_Feeds extends Handler_Protected {
db_escape_string($_POST["include_in_digest"]));
$cache_images = checkbox_to_sql_bool(
db_escape_string($_POST["cache_images"]));
$cache_content = checkbox_to_sql_bool(
db_escape_string($_POST["cache_content"]));
$update_method = (int) db_escape_string($_POST["update_method"]);
$always_display_enclosures = checkbox_to_sql_bool(
......@@ -938,8 +953,6 @@ class Pref_Feeds extends Handler_Protected {
$category_qpart_nocomma = "";
}
$cache_images_qpart = "cache_images = $cache_images,";
if (!$batch) {
$result = db_query($this->link, "UPDATE ttrss_feeds SET
......@@ -951,7 +964,8 @@ class Pref_Feeds extends Handler_Protected {
auth_pass = '$auth_pass',
private = $private,
rtl_content = $rtl_content,
$cache_images_qpart
cache_images = $cache_images,
cache_content = $cache_content,
include_in_digest = $include_in_digest,
always_display_enclosures = $always_display_enclosures,
mark_unread_on_update = $mark_unread_on_update,
......@@ -1023,6 +1037,10 @@ class Pref_Feeds extends Handler_Protected {
$qpart = "cache_images = $cache_images";
break;
case "cache_content":
$qpart = "cache_content = $cache_content";
break;
case "rtl_content":
$qpart = "rtl_content = $rtl_content";
break;
......
......@@ -139,7 +139,7 @@ class Pref_Filters extends Handler_Protected {
$folder = array();
$folder['id'] = $line["action_id"];
$folder['name'] = $line["action_name"];
$folder['name'] = __($line["action_name"]);
$folder['items'] = array();
$action_id = $line["action_id"];
}
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
require_once "functions.php";
require_once "sessions.php";
......@@ -125,6 +125,7 @@ function confirmOP() {
foreach (array_keys($update_versions) as $v) {
if ($v == $version + 1) {
print "<p>".T_sprintf("Updating to version %d...", $v)."</p>";
db_query($link, "BEGIN");
$fp = fopen($update_versions[$v], "r");
if ($fp) {
while (!feof($fp)) {
......@@ -136,6 +137,7 @@ function confirmOP() {
}
}
fclose($fp);
db_query($link, "COMMIT");
print "<p>".__("Checking version... ");
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
require_once "functions.php";
require_once "sessions.php";
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
require_once "functions.php";
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
require_once "config.php";
......
<?php
define('EXPECTED_CONFIG_VERSION', 26);
define('SCHEMA_VERSION', 98);
define('SCHEMA_VERSION', 99);
$fetch_last_error = false;
function __autoload($class) {
$class_file = str_replace("_", "/", strtolower(basename($class)));
$file = dirname(__FILE__)."/../plugins/$class_file.php";
if (file_exists($file)) {
require $file;
return;
}
$file = dirname(__FILE__)."/../classes/$class_file.php";
if (file_exists($file)) {
require $file;
}
}
mb_internal_encoding("UTF-8");
......@@ -70,14 +78,11 @@
$lang = _TRANSLATION_OVERRIDE_DEFAULT;
}
if ($_COOKIE["ttrss_lang"] && $_COOKIE["ttrss_lang"] != "auto") {
$lang = $_COOKIE["ttrss_lang"];
}
/* In login action of mobile version */
if ($_POST["language"] && defined('MOBILE_VERSION')) {
$lang = $_POST["language"];
$_COOKIE["ttrss_lang"] = $lang;
} else {
$lang = $_SESSION["language"];
}
if ($lang) {
......@@ -735,90 +740,14 @@
/* bump login timestamp */
db_query($link, "UPDATE ttrss_users SET last_login = NOW() WHERE id = " .
$_SESSION["uid"]);
if ($_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
setcookie("ttrss_lang", $_SESSION["language"],
time() + SESSION_COOKIE_LIFETIME);
}
}
}
}
/* function login_sequence($link, $mobile = false) {
$_SESSION["prefs_cache"] = array();
if (!SINGLE_USER_MODE) {
$login_action = $_POST["login_action"];
# try to authenticate user if called from login form
if ($login_action == "do_login") {
$login = db_escape_string($_POST["login"]);
$password = $_POST["password"];
$remember_me = $_POST["remember_me"];
if (authenticate_user($link, $login, $password)) {
$_POST["password"] = "";
$_SESSION["language"] = $_POST["language"];
$_SESSION["ref_schema_version"] = get_schema_version($link, true);
$_SESSION["bw_limit"] = !!$_POST["bw_limit"];
if ($_POST["profile"]) {
$profile = db_escape_string($_POST["profile"]);
$result = db_query($link, "SELECT id FROM ttrss_settings_profiles
WHERE id = '$profile' AND owner_uid = " . $_SESSION["uid"]);
if (db_num_rows($result) != 0) {
$_SESSION["profile"] = $profile;
$_SESSION["prefs_cache"] = array();
}
}
if ($_REQUEST['return']) {
header("Location: " . $_REQUEST['return']);
} else {
header("Location: " . $_SERVER["REQUEST_URI"]);
}
exit;
return;
} else {
$_SESSION["login_error_msg"] = __("Incorrect username or password");
}
}
if (!$_SESSION["uid"] || !validate_session($link)) {
if (AUTH_AUTO_LOGIN && authenticate_user($link, null, null)) {
$_SESSION["ref_schema_version"] = get_schema_version($link, true);
} else {
authenticate_user($link, null, null, true);
render_login_form($link, $mobile);
exit;
}
} else {
// bump login timestamp
db_query($link, "UPDATE ttrss_users SET last_login = NOW() WHERE id = " .
$_SESSION["uid"]);
if ($_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
setcookie("ttrss_lang", $_SESSION["language"],
time() + SESSION_COOKIE_LIFETIME);
}
// try to remove possible duplicates from feed counter cache
// ccache_cleanup($link, $_SESSION["uid"]);
if ($_SESSION["uid"] && $_SESSION["language"] && SESSION_COOKIE_LIFETIME > 0) {
setcookie("ttrss_lang", $_SESSION["language"],
time() + SESSION_COOKIE_LIFETIME);
}
} else {
return authenticate_user($link, "admin", null);
}
} */
}
function truncate_string($str, $max_len, $suffix = '&hellip;') {
if (mb_strlen($str, "utf-8") > $max_len - 3) {
......@@ -2446,7 +2375,7 @@
}
}
$content_query_part = "content as content_preview,";
$content_query_part = "content as content_preview, cached_content, ";
if (is_numeric($feed)) {
......@@ -3190,15 +3119,17 @@
//if (!$zoom_mode) { print "<article id='$id'><![CDATA["; };
$result = db_query($link, "SELECT rtl_content, always_display_enclosures FROM ttrss_feeds
$result = db_query($link, "SELECT rtl_content, always_display_enclosures, cache_content FROM ttrss_feeds
WHERE id = '$feed_id' AND owner_uid = $owner_uid");
if (db_num_rows($result) == 1) {
$rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
$always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures"));
$cache_content = sql_bool_to_bool(db_fetch_result($result, 0, "cache_content"));
} else {
$rtl_content = false;
$always_display_enclosures = false;
$cache_content = false;
}
if ($rtl_content) {
......@@ -3225,7 +3156,8 @@
tag_cache,
author,
orig_feed_id,
note
note,
cached_content
FROM ttrss_entries,ttrss_user_entries
WHERE id = '$id' AND ref_id = id AND owner_uid = $owner_uid");
......@@ -3423,6 +3355,10 @@
}
}
if ($cache_content && $line["cached_content"] != "") {
$line["content"] =& $line["cached_content"];
}
$article_content = sanitize($link, $line["content"], false, $owner_uid,
$feed_site_url);
......@@ -3470,7 +3406,11 @@
}
function get_self_url_prefix() {
return SELF_URL_PATH;
if (strrpos(SELF_URL_PATH, "/") === strlen(SELF_URL_PATH)-1) {
return substr(SELF_URL_PATH, 0, strlen(SELF_URL_PATH)-1);
} else {
return SELF_URL_PATH;
}
}
function opml_publish_url($link){
......@@ -4539,6 +4479,11 @@
}
if ($show_content) {
if ($line["cached_content"] != "") {
$line["content_preview"] =& $line["cached_content"];
}
if ($sanitize_content) {
$headline_row["content"] = sanitize($link,
$line["content_preview"], false, false, $line["site_url"]);
......
<?php # This file has been generated at: Mon Nov 12 14:25:49 MSK 2012
<?php # This file has been generated at: Thu Nov 22 16:05:39 MSK 2012
__("Title");
__("Title or Content");
......
This diff is collapsed.
<?php
define('VERSION', "1.6.1");
define('VERSION', "1.6.2");
?>
......@@ -5,8 +5,8 @@
exit;
}
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) ."/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
require_once "functions.php";
require_once "sessions.php";
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
define('DISABLE_SESSIONS', true);
......
This diff is collapsed.
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . PATH_SEPARATOR .
set_include_path(dirname(__FILE__) . PATH_SEPARATOR .
dirname(dirname(__FILE__)) . PATH_SEPARATOR .
dirname(dirname(__FILE__)) . "/include" );
dirname(dirname(__FILE__)) . "/include" . PATH_SEPARATOR .
get_include_path());
require_once "config.php";
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . PATH_SEPARATOR .
set_include_path(dirname(__FILE__) . PATH_SEPARATOR .
dirname(dirname(__FILE__)) . PATH_SEPARATOR .
dirname(dirname(__FILE__)) . "/include" );
dirname(dirname(__FILE__)) . "/include" . PATH_SEPARATOR .
get_include_path());
require_once "functions.php";
require_once "sessions.php";
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
function __autoload($class) {
$file = "classes/".strtolower(basename($class)).".php";
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
require_once "functions.php";
require_once "sessions.php";
......@@ -26,7 +26,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Tiny Tiny RSS : Preferences</title>
<title>Tiny Tiny RSS : <?php echo __("Preferences") ?></title>
<link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
<link rel="stylesheet" type="text/css" href="tt-rss.css?<?php echo $dt_add ?>"/>
......
<?php
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
/* remove ill effects of magic quotes */
......
......@@ -4,8 +4,8 @@
// 1) templates/register_notice.txt - displayed above the registration form
// 2) register_expire_do.php - contains user expiration queries when necessary
set_include_path(get_include_path() . PATH_SEPARATOR .
dirname(__FILE__) . "/include");
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
get_include_path());
require_once 'lib/phpmailer/class.phpmailer.php';
......