From 27211afe92ab90a89d1879a31a8543cdf2b6aab6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 23 Aug 2012 20:23:19 +0400 Subject: implement experimental web-based updater --- classes/pref/prefs.php | 53 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) (limited to 'classes/pref/prefs.php') diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index ff8a17cdb..e30a82575 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -2,7 +2,7 @@ class Pref_Prefs extends Handler_Protected { function csrf_ignore($method) { - $csrf_ignored = array("index"); + $csrf_ignored = array("index", "updateself"); return array_search($method, $csrf_ignored) !== false; } @@ -489,11 +489,60 @@ class Pref_Prefs extends Handler_Protected { print ''; # inner pane print ''; # border container - print ""; print ""; #pane + + + if (($_SESSION["access_level"] >= 10 || SINGLE_USER_MODE) && CHECK_FOR_NEW_VERSION) { + print "
"; + + if ($_SESSION["pref_last_version_check"] + 86400 + rand(-1000, 1000) < time()) { + $_SESSION["version_data"] = @check_for_update($this->link); + $_SESSION["pref_last_version_check"] = time(); + } + + if (is_array($_SESSION["version_data"])) { + $version = $_SESSION["version_data"]["version"]; + print_notice(T_sprintf("New version of Tiny Tiny RSS is available (%s).", "$version")); + + print "

"; + + } else { + print_notice(__("You are currently using latest version of Tiny Tiny RSS. Update not required.")); + } + + print "
"; #pane + } + print ""; #container } + + function updateSelf() { + print "
"; + + print "
".__("Do not close this dialog until updating is finished. Backup your tt-rss directory before continuing.")."
"; + + print "
";
+		print __("Ready to update.")."\n";
+		print "
"; + + print "
"; + print ""; + print ""; + print "
"; + print "
"; + } + + function performUpdate() { + if (($_SESSION["access_level"] >= 10 || SINGLE_USER_MODE) && CHECK_FOR_NEW_VERSION) { + include "update_self.php"; + update_self($this->link, true); + } + } + } ?> -- cgit v1.2.3