From e91c35c5344a018804b2f76527c90bc8d3c34f88 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 03 Feb 2016 07:59:31 -0500
Subject: [PATCH] Fix background color on selected and focused addressbook

---
 program/lib/Roundcube/rcube.php |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index 3b17d99..6193715 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -1277,11 +1277,18 @@
 
         // write error to local log file
         if (($level & 1) || !empty($arg_arr['fatal'])) {
+            $post_query = '';
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-                $post_query = '?_task='.urlencode($_POST['_task']).'&_action='.urlencode($_POST['_action']);
-            }
-            else {
-                $post_query = '';
+                foreach (array('_task', '_action') as $arg) {
+                    if ($_POST[$arg] && !$_GET[$arg]) {
+                        $post_query[$arg] = $_POST[$arg];
+                    }
+                }
+
+                if (!empty($post_query)) {
+                    $post_query = (strpos($_SERVER['REQUEST_URI'], '?') != false ? '&' : '?')
+                        . http_build_query($post_query, '', '&');
+                }
             }
 
             $log_entry = sprintf("%s Error: %s%s (%s %s)",
@@ -1493,6 +1500,7 @@
                 $host = preg_replace('/:[0-9]+$/', '', $host);
                 if ($host && preg_match('/\.[a-z]+$/i', $host)) {
                     $domain_part = $host;
+                    break;
                 }
             }
         }

--
Gitblit v1.9.1