summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend.php2
-rw-r--r--config.php-dist5
-rw-r--r--functions.php36
-rw-r--r--sanity_check.php2
4 files changed, 43 insertions, 2 deletions
diff --git a/backend.php b/backend.php
index 36fe32537..a218ff54f 100644
--- a/backend.php
+++ b/backend.php
@@ -2976,6 +2976,8 @@
} else {
+ print check_for_update($link);
+
if (!SINGLE_USER_MODE) {
$result = db_query($link, "SELECT id,email FROM ttrss_users
diff --git a/config.php-dist b/config.php-dist
index 5ce0e8c22..97e0e93ff 100644
--- a/config.php-dist
+++ b/config.php-dist
@@ -128,7 +128,10 @@
// Stop updating feeds of user who was never logged in
// in specified amount of days. 0 disables.
- define('CONFIG_VERSION', 3);
+ define('CHECK_FOR_NEW_VERSION', true);
+ // Check for new versions of tt-rss when entering preferences.
+
+ define('CONFIG_VERSION', 4);
// Expected config version. Please update this option in config.php
// if necessary (after migrating all new options from this file).
diff --git a/functions.php b/functions.php
index 5feba77f0..b62f27eaf 100644
--- a/functions.php
+++ b/functions.php
@@ -2356,4 +2356,40 @@
return $res;
}
+
+ function check_for_update($link) {
+ $releases_feed = "http://tt-rss.spb.ru/releases.rss";
+
+ if (!CHECK_FOR_NEW_VERSION || $_SESSION["access_level"] < 10) {
+ return;
+ }
+
+ error_reporting(0);
+ $rss = fetch_rss($releases_feed);
+ error_reporting (DEFAULT_ERROR_LEVEL);
+
+ if ($rss) {
+
+ $items = $rss->items;
+
+ if (!$items || !is_array($items)) $items = $rss->entries;
+ if (!$items || !is_array($items)) $items = $rss;
+
+ if (!is_array($items)) {
+ return;
+ }
+
+ $last_item = $items[0];
+
+ $last_version = trim(preg_replace("/(Milestone)|(completed)/", "", $last_item["title"]));
+ $cur_version = preg_replace("/\.99/", "", VERSION);
+
+ $release_url = $last_item["link"];
+
+ if ($cur_version != $last_version) {
+ return "<div class=\"notice\"><a target=\"_new\" href=\"$release_url\">
+ New version of Tiny-Tiny RSS is available.</a></div>";
+ }
+ }
+ }
?>
diff --git a/sanity_check.php b/sanity_check.php
index 1addd7b7e..ba738b9da 100644
--- a/sanity_check.php
+++ b/sanity_check.php
@@ -1,5 +1,5 @@
<?php
- define('EXPECTED_CONFIG_VERSION', 3);
+ define('EXPECTED_CONFIG_VERSION', 4);
if (!file_exists("config.php")) {
print "<b>Fatal Error</b>: You forgot to copy