summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-08-20 05:27:48 +0100
committerAndrew Dolgov <[email protected]>2006-08-20 05:27:48 +0100
commitb72c3ef80198f62ef8d7923512570a9520242c98 (patch)
tree31c2f4f23d2b98f4662dc2fdf6aa4754a3512543 /functions.php
parent95322e1224cd75fc39dc98e28d4ef2268c6a58b5 (diff)
implement new version checking
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php36
1 files changed, 36 insertions, 0 deletions
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>";
+ }
+ }
+ }
?>