]> git.wh0rd.org - tt-rss.git/blobdiff - include/functions2.php
set smallish timeout on update check, exclude update checking on initial load
[tt-rss.git] / include / functions2.php
index ed22a0623b9564401ee54294f9eb8ecd043b370c..1c2ffb9369329532ad8c0571fd98e039f9f6f5f4 100644 (file)
@@ -64,8 +64,6 @@
                                "toggle_publ" => __("Toggle published"),
                                "toggle_unread" => __("Toggle unread"),
                                "edit_tags" => __("Edit tags"),
-                               "dismiss_selected" => __("Dismiss selected"),
-                               "dismiss_read" => __("Dismiss read"),
                                "open_in_new_window" => __("Open in new window"),
                                "catchup_below" => __("Mark below as read"),
                                "catchup_above" => __("Mark above as read"),
                                "*s" => "toggle_publ",
                                "u" => "toggle_unread",
                                "*t" => "edit_tags",
-                               "*d" => "dismiss_selected",
-                               "*x" => "dismiss_read",
                                "o" => "open_in_new_window",
                                "c p" => "catchup_below",
                                "c n" => "catchup_above",
 
        function check_for_update() {
                if (defined("GIT_VERSION_TIMESTAMP")) {
-                       $content = @fetch_file_contents("http://tt-rss.org/version.json");
+                       $content = @fetch_file_contents(array("url" => "http://tt-rss.org/version.json", "timeout" => 5));
 
                        if ($content) {
                                $content = json_decode($content, true);
                return "";
        }
 
-       function make_runtime_info() {
+       function make_runtime_info($disable_update_check = false) {
                $data = array();
 
                $result = db_query("SELECT MAX(id) AS mid, COUNT(*) AS nf FROM
                $data['reload_on_ts_change'] = !defined('_NO_RELOAD_ON_TS_CHANGE');
 
 
-               if (CHECK_FOR_UPDATES && $_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) {
+               if (CHECK_FOR_UPDATES && !$disable_update_check && $_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) {
                        $update_result = @check_for_update();
 
                        $data["update_result"] = $update_result;
         * @return string Absolute URL
         */
        function rewrite_relative_url($url, $rel_url) {
-               if (strpos($rel_url, ":") !== false) {
-                       return $rel_url;
-               } else if (strpos($rel_url, "://") !== false) {
+               if (strpos($rel_url, "://") !== false) {
                        return $rel_url;
                } else if (strpos($rel_url, "//") === 0) {
                        # protocol-relative URL (rare but they exist)
                        return $rel_url;
-               } else if (strpos($rel_url, "/") === 0)
-               {
+               } else if (preg_match("/^[a-z]+:/i", $rel_url)) {
+                       # magnet:, feed:, etc
+                       return $rel_url;
+               } else if (strpos($rel_url, "/") === 0) {
                        $parts = parse_url($url);
                        $parts['path'] = $rel_url;