summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-04-20 15:21:00 +0400
committerAndrew Dolgov <[email protected]>2011-04-20 15:21:00 +0400
commitae5f7bb11a7698a84c9352436c144286f7c81630 (patch)
treefbf541a0009cd8462d5137b04ffcea0113df37bc /modules
parentcfc0647184933b042b9929ede09f52e7d3f3318f (diff)
implement fetching and exporting of shared feeds
Diffstat (limited to 'modules')
-rw-r--r--modules/backend-rpc.php32
-rw-r--r--modules/popup-dialog.php2
-rw-r--r--modules/pref-instances.php16
3 files changed, 14 insertions, 36 deletions
diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php
index 2ff9a6312..75ce6886a 100644
--- a/modules/backend-rpc.php
+++ b/modules/backend-rpc.php
@@ -834,38 +834,6 @@
return;
}
- if ($subop == "fbExport") {
-
- // TODO: change to _POST
- $access_key = db_escape_string($_REQUEST["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, 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_connected = NOW()
- WHERE id = '$instance_id'");
-
- print json_encode(array("feeds" => $feeds));
- } else {
- print json_encode(array("error" => array("code" => 6)));
- }
- return;
- }
-
if ($subop == "genHash") {
$hash = sha1(uniqid(rand(), true));
diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php
index f5a30a06e..6cb60eef4 100644
--- a/modules/popup-dialog.php
+++ b/modules/popup-dialog.php
@@ -1023,6 +1023,8 @@
style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\"
value=\"$access_key\">";
+ print "<p class='insensitive'>" . __("Use one access key for both linked instances.");
+
print "</div>";
print "<div class=\"dlgButtons\">
diff --git a/modules/pref-instances.php b/modules/pref-instances.php
index 45df2eb39..d3510c287 100644
--- a/modules/pref-instances.php
+++ b/modules/pref-instances.php
@@ -24,8 +24,9 @@
if (db_num_rows($result) == 0) {
db_query($link, "INSERT INTO ttrss_linked_instances
- (access_url, access_key, last_connected) VALUES
- ('$access_url', '$access_key', '1970-01-01')");
+ (access_url, access_key, last_connected, last_status_in, last_status_out)
+ VALUES
+ ('$access_url', '$access_key', '1970-01-01', -1, -1)");
}
@@ -74,6 +75,8 @@
style=\"width: 20em\" name=\"access_key\" id=\"instance_edit_key\"
value=\"$access_key\">";
+ print "<p class='insensitive'>" . __("Use one access key for both linked instances.");
+
print "</div>";
print "<div class=\"dlgButtons\">
@@ -131,7 +134,10 @@
print "</div>"; #toolbar
- $result = db_query($link, "SELECT * FROM ttrss_linked_instances
+ $result = db_query($link, "SELECT *,
+ (SELECT COUNT(*) FROM ttrss_linked_feeds
+ WHERE instance_id = ttrss_linked_instances.id) AS num_feeds
+ FROM ttrss_linked_instances
ORDER BY $sort");
print "<p class=\"insensitive\" style='margin-left : 1em;'>" . __("You can connect other instances of Tiny Tiny RSS to this one to share Popular feeds. Link to this instance of Tiny Tiny RSS by using this URL:");
@@ -144,7 +150,8 @@
<td align='center' width=\"5%\">&nbsp;</td>
<td width=''><a href=\"#\" onclick=\"updateInstanceList('access_url')\">".__('Instance URL')."</a></td>
<td width='20%'><a href=\"#\" onclick=\"updateInstanceList('access_key')\">".__('Access key')."</a></td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('last_connected')\">".__('Last connected')."</a></td>
+ <td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_connected')\">".__('Last connected')."</a></td>
+ <td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">".__('Stored feeds')."</a></td>
</tr>";
$lnum = 0;
@@ -170,6 +177,7 @@
print "<td $onclick>" . htmlspecialchars($line['access_url']) . "</td>";
print "<td $onclick>" . htmlspecialchars($access_key) . "</td>";
print "<td $onclick>" . htmlspecialchars($line['last_connected']) . "</td>";
+ print "<td $onclick>" . htmlspecialchars($line['num_feeds']) . "</td>";
print "</tr>";