summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2007-01-27 12:32:59 +0100
committerAndrew Dolgov <[email protected]>2007-01-27 12:32:59 +0100
commitd9fa39f1d444fbd5a909aabe19dfc50aa8601131 (patch)
treec9e84bbd32cee9f3cdae05b210f41b451e763ddd /functions.php
parentef16ae378238fa868d282da5c4f77d8556534af4 (diff)
add new version indicator on main chrome
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/functions.php b/functions.php
index 5f3978ff9..6169f93a8 100644
--- a/functions.php
+++ b/functions.php
@@ -2133,6 +2133,18 @@
print "<param key=\"daemon_is_running\" value=\"".
sprintf("%d", file_is_locked("update_daemon.lock")) . "\"/>";
}
+ if (CHECK_FOR_NEW_VERSION && $_SESSION["access_level"] >= 10) {
+
+ if ($_SESSION["last_version_check"] + 600 < time()) {
+ $new_version_details = check_for_update($link);
+
+ print "<param key=\"new_version_available\" value=\"".
+ sprintf("%d", $new_version_details != ""). "\"/>";
+
+ $_SESSION["last_version_check"] = time();
+ }
+ }
+
print "</runtime-info>";
}
@@ -2595,7 +2607,7 @@
return array($tmp, $headlines_count);
}
- function check_for_update($link) {
+ function check_for_update($link, $brief_fmt = true) {
$releases_feed = "http://tt-rss.spb.ru/releases.rss";
if (!CHECK_FOR_NEW_VERSION || $_SESSION["access_level"] < 10) {
@@ -2625,9 +2637,16 @@
$content = sanitize_rss($latest_item["description"]);
if (version_compare(VERSION, $latest_version) == -1) {
- return "<div class=\"notice\"><a href=\"javascript:showBlockElement('milestoneDetails')\">
- New version of Tiny-Tiny RSS ($latest_version) is available (click for details)</a>
- <div id=\"milestoneDetails\">$content</div></div>";
+ if ($brief_fmt) {
+ return "<div class=\"notice\"><a href=\"javascript:showBlockElement('milestoneDetails')\">
+ New version of Tiny-Tiny RSS ($latest_version) is available (click for details)</a>
+ <div id=\"milestoneDetails\">$content</div></div>";
+ } else {
+ return "New version of <a target='_new'
+ href='http://tt-rss.spb.ru/'>Tiny-Tiny RSS</a> ($latest_version) is available:
+ <div>$content</div>";
+ }
+
}
}
}