From 77a3e1233fff8061de3a5c307531d9a4bc7d6dad Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 27 Feb 2013 16:51:06 +0400 Subject: rpc/getAllCounters: include virtual counters when last_article_id is supplied and unchanged --- classes/rpc.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'classes') diff --git a/classes/rpc.php b/classes/rpc.php index 46c8b0d85..18df21b16 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -247,6 +247,8 @@ class RPC extends Handler_Protected { if ($last_article_id != getLastArticleId($this->link)) { $reply['counters'] = getAllCounters($this->link); + } else { + $reply['counters'] = getVirtCounters($this->link); } $reply['runtime-info'] = make_runtime_info($this->link); -- cgit v1.2.3-54-g00ecf From 0a7b15207e71acfd219196ff3301f6730f77320f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 27 Feb 2013 16:57:26 +0400 Subject: remove previous counter hacks; force request counters when there's no unread stuff left in current feed (e.g. finished reading) --- classes/rpc.php | 2 -- js/feedlist.js | 2 +- js/viewfeed.js | 6 ++++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'classes') diff --git a/classes/rpc.php b/classes/rpc.php index 18df21b16..46c8b0d85 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -247,8 +247,6 @@ class RPC extends Handler_Protected { if ($last_article_id != getLastArticleId($this->link)) { $reply['counters'] = getAllCounters($this->link); - } else { - $reply['counters'] = getVirtCounters($this->link); } $reply['runtime-info'] = make_runtime_info($this->link); diff --git a/js/feedlist.js b/js/feedlist.js index a9ee19c06..b2aadab62 100644 --- a/js/feedlist.js +++ b/js/feedlist.js @@ -234,7 +234,7 @@ function request_counters(force) { var query = "?op=rpc&method=getAllCounters&seq=" + next_seq(); - if (!force && Math.random() >= 0.5) + if (!force) query = query + "&last_article_id=" + getInitParam("last_article_id"); console.log(query); diff --git a/js/viewfeed.js b/js/viewfeed.js index 1cdfdba3f..2f1ba24e0 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -325,7 +325,8 @@ function article_callback2(transport, id) { Element.show(dijit.byId("net-alert").domNode); } - request_counters(); + var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length + request_counters(unread_in_buffer == 0); headlines_scroll_handler($("headlines-frame")); @@ -1550,7 +1551,8 @@ function cdmClicked(event, id) { openArticleInNewWindow(id); } - request_counters(); + var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length + request_counters(unread_in_buffer == 0); } catch (e) { exception_error("cdmClicked"); -- cgit v1.2.3-54-g00ecf From fa9e88c367fb3d6c771aa1788f133087f49696bc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 27 Feb 2013 22:16:58 +0400 Subject: replace getmicrotime() wrapper with microtime(true) --- classes/feeds.php | 4 ++-- include/functions.php | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'classes') diff --git a/classes/feeds.php b/classes/feeds.php index de001d568..886470e90 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -152,7 +152,7 @@ class Feeds extends Handler_Protected { $reply = array(); - $timing_info = getmicrotime(); + $timing_info = microtime(true); $topmost_article_ids = array(); @@ -750,7 +750,7 @@ class Feeds extends Handler_Protected { } function view() { - $timing_info = getmicrotime(); + $timing_info = microtime(true); $reply = array(); diff --git a/include/functions.php b/include/functions.php index 688bff76c..979a28761 100644 --- a/include/functions.php +++ b/include/functions.php @@ -478,11 +478,6 @@ print ""; } - function getmicrotime() { - list($usec, $sec) = explode(" ",microtime()); - return ((float)$usec + (float)$sec); - } - function print_radio($id, $default, $true_is, $values, $attributes = "") { foreach ($values as $v) { @@ -3065,7 +3060,7 @@ } function print_checkpoint($n, $s) { - $ts = getmicrotime(); + $ts = microtime(true); echo sprintf("", $ts - $s); return $ts; } -- cgit v1.2.3-54-g00ecf From c2e4e8fe91c31f76a493033117594c4460025755 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 27 Feb 2013 22:58:43 +0400 Subject: hotkey help: fix actions bound to multiple sequences not displayed correctly --- classes/backend.php | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'classes') diff --git a/classes/backend.php b/classes/backend.php index 0b6e6bd30..d9a7a9fec 100644 --- a/classes/backend.php +++ b/classes/backend.php @@ -23,16 +23,10 @@ class Backend extends Handler { $imap = get_hotkeys_map($this->link); $omap = array(); - // :( - $tinycharmap = array( - "(9)" => "{TAB}", - "(191)" => "?"); - foreach ($imap[1] as $sequence => $action) { - if (!isset($omap[$action])) { - $omap[$action] = isset($tinycharmap[$sequence]) ? $tinycharmap[$sequence] : - $sequence; - } + if (!isset($omap[$action])) $omap[$action] = array(); + + array_push($omap[$action], $sequence); } print "
    "; @@ -44,18 +38,21 @@ class Backend extends Handler { print "
  • " . $section . "

  • "; foreach ($hotkeys as $action => $description) { - if (strpos($omap[$action], "|") !== FALSE) { - $omap[$action] = substr($omap[$action], - strpos($omap[$action], "|")+1, - strlen($omap[$action])); - } - print "
  • "; - print "" . $omap[$action] . ""; - print $description; - print "
  • "; - } + foreach ($omap[$action] as $sequence) { + if (strpos($sequence, "|") !== FALSE) { + $sequence = substr($sequence, + strpos($sequence, "|")+1, + strlen($sequence)); + } + + print "
  • "; + print "$sequence"; + print $description; + print "
  • "; + } + } } print "
"; -- cgit v1.2.3-54-g00ecf From f4c02a157a51c44c9772e609fcf0e360db42d060 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 28 Feb 2013 09:13:00 +0400 Subject: fix warning when saving plugins with 0 plugins enabled (closes #542) --- classes/pref/prefs.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index eb84bde99..810b1e164 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -824,7 +824,10 @@ class Pref_Prefs extends Handler_Protected { } function setplugins() { - $plugins = join(",", $_REQUEST["plugins"]); + if (is_array($_REQUEST["plugins"])) + $plugins = join(",", $_REQUEST["plugins"]); + else + $plugins = ""; set_pref($this->link, "_ENABLED_PLUGINS", $plugins); } -- cgit v1.2.3-54-g00ecf From 350e3944d49ad26802e27e64057212d88c4d0bf9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 28 Feb 2013 09:17:17 +0400 Subject: fix uploadicon() returning wrong content-type (closes #543) --- classes/pref/feeds.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'classes') diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index da8d68ba1..2ed7b1b24 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -437,6 +437,8 @@ class Pref_Feeds extends Handler_Protected { } function uploadicon() { + header("Content-type: text/html"); + $icon_file = $_FILES['icon_file']['tmp_name']; $feed_id = db_escape_string($_REQUEST["feed_id"]); -- cgit v1.2.3-54-g00ecf