Commit 22236f83 authored by Sebastian Reichel's avatar Sebastian Reichel

Imported Upstream version 1.5.7

parent 12dd1939
......@@ -3,7 +3,7 @@
#*
.idea/*
config.php
icons/*
feed-icons/*
cache/*/*
lock/*
tags
......
......@@ -121,10 +121,16 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
var menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
label: __("Mark as read"),
onClick: function() {
catchupFeed(this.getParent().row_id);
}}));
menu.addChild(new dijit.MenuItem({
label: __("Edit feed"),
onClick: function() {
editFeed(this.getParent().row_id);
editFeed(this.getParent().row_id, false);
}}));
menu.addChild(new dijit.MenuItem({
......@@ -137,6 +143,20 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
tnode._menu = menu;
}
if (id.match("CAT:") && bare_id > 0) {
var menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
label: __("Mark as read"),
onClick: function() {
catchupFeed(this.getParent().row_id, true);
}}));
menu.bindDomNode(tnode.domNode);
tnode._menu = menu;
}
//tnode.labelNode.innerHTML = args.label;
return tnode;
},
......@@ -175,7 +195,7 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
if (treeNode) {
treeNode = treeNode[0];
if (!is_cat) this._expandNode(treeNode);
this._selectNode(treeNode);
this.set("selectedNodes", [treeNode]);
}
},
setFeedIcon: function(feed, is_cat, src) {
......
......@@ -10,6 +10,8 @@
define('API_STATUS_OK', 0);
define('API_STATUS_ERR', 1);
chdir("..");
if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT) {
ob_start("ob_gzhandler");
}
......@@ -78,8 +80,8 @@
case "login":
$login = db_escape_string($_REQUEST["user"]);
$password = db_escape_string($_REQUEST["password"]);
$password_base64 = db_escape_string(base64_decode($_REQUEST["password"]));
$password = $_REQUEST["password"];
$password_base64 = base64_decode($_REQUEST["password"]);
if (SINGLE_USER_MODE) $login = "admin";
......@@ -154,8 +156,6 @@
$limit = (int) db_escape_string($_REQUEST["limit"]);
$offset = (int) db_escape_string($_REQUEST["offset"]);
chdir(".."); // so feed_has_icon() would work properly for relative ICONS_DIR
$feeds = api_get_feeds($link, $cat_id, $unread_only, $limit, $offset);
print api_wrap_reply(API_STATUS_OK, $seq, $feeds);
......@@ -207,7 +207,7 @@
break;
case "updateArticle":
$article_ids = split(",", db_escape_string($_REQUEST["article_ids"]));
$article_ids = array_filter(explode(",", db_escape_string($_REQUEST["article_ids"])), is_numeric);
$mode = (int) db_escape_string($_REQUEST["mode"]);
$field_raw = (int)db_escape_string($_REQUEST["field"]);
......@@ -274,7 +274,7 @@
case "getArticle":
$article_id = db_escape_string($_REQUEST["article_id"]);
$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,
marked,unread,published,
......
......@@ -59,10 +59,15 @@
authenticate_user($link, "admin", null);
}
if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" &&
$op != "rss" && $op != "getUnread" && $op != "getProfiles" && $op != "share" &&
$op != "fbexport" && $op != "logout" && $op != "pubsub") {
$public_calls = array("globalUpdateFeeds", "rss", "getUnread", "getProfiles", "share",
"fbexport", "logout", "pubsub");
if (array_search($op, $public_calls) !== false) {
handle_public_request($link, $op);
return;
} else if (!($_SESSION["uid"] && validate_session($link))) {
if ($op == 'pref-feeds' && $_REQUEST['subop'] == 'add') {
header("Content-Type: text/html");
login_sequence($link);
......@@ -431,11 +436,6 @@
module_pref_pub_items($link);
break; // pref-pub-items
case "globalUpdateFeeds":
// Update all feeds needing a update.
update_daemon_common($link, 0, true, true);
break; // globalUpdateFeeds
case "pref-feed-browser":
module_pref_feed_browser($link);
break; // pref-feed-browser
......@@ -444,63 +444,6 @@
module_pref_instances($link);
break; // pref-instances
case "rss":
$feed = db_escape_string($_REQUEST["id"]);
$key = db_escape_string($_REQUEST["key"]);
$is_cat = $_REQUEST["is_cat"] != false;
$limit = (int)db_escape_string($_REQUEST["limit"]);
$search = db_escape_string($_REQUEST["q"]);
$match_on = db_escape_string($_REQUEST["m"]);
$search_mode = db_escape_string($_REQUEST["smode"]);
$view_mode = db_escape_string($_REQUEST["view-mode"]);
if (SINGLE_USER_MODE) {
authenticate_user($link, "admin", null);
}
$owner_id = false;
if ($key) {
$result = db_query($link, "SELECT owner_uid FROM
ttrss_access_keys WHERE access_key = '$key' AND feed_id = '$feed'");
if (db_num_rows($result) == 1)
$owner_id = db_fetch_result($result, 0, "owner_uid");
}
if ($owner_id) {
$_SESSION['uid'] = $owner_id;
generate_syndicated_feed($link, 0, $feed, $is_cat, $limit,
$search, $search_mode, $match_on, $view_mode);
} else {
header('HTTP/1.1 403 Forbidden');
}
break; // rss
case "getUnread":
$login = db_escape_string($_REQUEST["login"]);
$fresh = $_REQUEST["fresh"] == "1";
$result = db_query($link, "SELECT id FROM ttrss_users WHERE login = '$login'");
if (db_num_rows($result) == 1) {
$uid = db_fetch_result($result, 0, "id");
print getGlobalUnread($link, $uid);
if ($fresh) {
print ";";
print getFeedArticles($link, -3, false, true, $uid);
}
} else {
print "-1;User not found";
}
break; // getUnread
case "digestTest":
print_r(prepare_headlines_digest($link, $_SESSION["uid"]));
break; // digestTest
......@@ -515,149 +458,6 @@
"<img src='images/indicator_tiny.gif'>";
break; // loading
case "getProfiles":
$login = db_escape_string($_REQUEST["login"]);
$password = db_escape_string($_REQUEST["password"]);
if (authenticate_user($link, $login, $password)) {
$result = db_query($link, "SELECT * FROM ttrss_settings_profiles
WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY title");
print "<select style='width: 100%' name='profile'>";
print "<option value='0'>" . __("Default profile") . "</option>";
while ($line = db_fetch_assoc($result)) {
$id = $line["id"];
$title = $line["title"];
print "<option value='$id'>$title</option>";
}
print "</select>";
$_SESSION = array();
}
break; // getprofiles
case "pubsub":
$mode = db_escape_string($_REQUEST['hub_mode']);
$feed_id = (int) db_escape_string($_REQUEST['id']);
$feed_url = db_escape_string($_REQUEST['hub_topic']);
if (!PUBSUBHUBBUB_ENABLED) {
header('HTTP/1.0 404 Not Found');
echo "404 Not found";
return;
}
// TODO: implement hub_verifytoken checking
$result = db_query($link, "SELECT feed_url FROM ttrss_feeds
WHERE id = '$feed_id'");
if (db_num_rows($result) != 0) {
$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);
db_query($link, "UPDATE ttrss_feeds SET
last_update_started = '1970-01-01',
last_updated = '1970-01-01' WHERE id = '$feed_id' AND
owner_uid = ".$_SESSION["uid"]);
}
} else {
header('HTTP/1.0 404 Not Found');
echo "404 Not found";
}
} else {
header('HTTP/1.0 404 Not Found');
echo "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
case "share":
$uuid = db_escape_string($_REQUEST["key"]);
$result = db_query($link, "SELECT ref_id, owner_uid FROM ttrss_user_entries WHERE
uuid = '$uuid'");
if (db_num_rows($result) != 0) {
header("Content-Type: text/html");
$id = db_fetch_result($result, 0, "ref_id");
$owner_uid = db_fetch_result($result, 0, "owner_uid");
$_SESSION["uid"] = $owner_uid;
$article = format_article($link, $id, false, true);
$_SESSION["uid"] = "";
print_r($article['content']);
} else {
print "Article not found.";
}
break;
default:
header("Content-Type: text/plain");
print json_encode(array("error" => array("code" => 7)));
......
......@@ -3,9 +3,22 @@ div.cdmHeader img, div.cdmHeader input, div.cdmFooter img {
}
div.cdmHeader {
display : table;
}
div.cdmHeader > * {
display : table-cell;
padding : 5px;
}
div.cdmHeader > div {
white-space : nowrap;
}
div.cdmHeader > span {
width : 100%;
}
div.cdmHeader span.updated {
color : gray;
font-weight : normal;
......
......@@ -7,9 +7,11 @@
define('DB_PASS', "XXXXXX");
//define('DB_PORT', '5432'); // when neeeded, PG-only
define('SELF_URL_PATH', 'http://local.host/tt-rss');
// Full URL of your tt-rss installation. You need to set this option
// correctly for tt-rss to function properly.
define('SELF_URL_PATH', 'http://yourserver/tt-rss/');
// Full URL of your tt-rss installation. This should be set to the
// location of tt-rss directory, e.g. http://yourserver/tt-rss/
// You need to set this option correctly otherwise several features
// including PUSH, bookmarklets and browser integration will not work properly.
define('SINGLE_USER_MODE', true);
// Operate in single user mode, disables all functionality related to
......@@ -24,14 +26,11 @@
// Note that you (or your users) also have to enable image caching
// in feed editor.
define('ICONS_DIR', "icons");
define('ICONS_URL', "icons");
define('ICONS_DIR', "feed-icons");
define('ICONS_URL', "feed-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