private function parseHttpQuery($query)
    {
        /* can't use parse_str, because the minimum supported PHP version
         * is 5.3, which still has the magic_quotes_gpc option that affects its
         * result, so some users could hypothetically have that enabled */
        if (empty($query)) {
            return array();
        }

        $result = array();
        $parts = explode('&', $query);
        foreach ($parts as $p) {
            $keyval = explode('=', $p);
            $result[urldecode($keyval[0])] = urldecode($keyval[1]);
        }
        return $result;
    }