X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/7d5fbd92062883ddd2f77167d7b91138ef17aee0..209ae3b0a164a907a0f8e53b3b82015cbab7cdbf:/SL/Request.pm diff --git a/SL/Request.pm b/SL/Request.pm index 0808bd1da..7c4fa7198 100644 --- a/SL/Request.pm +++ b/SL/Request.pm @@ -20,7 +20,7 @@ our @EXPORT_OK = qw(flatten unflatten); use Rose::Object::MakeMethods::Generic ( scalar => [ qw(applying_database_upgrades post_data) ], - 'scalar --get_set_init' => [ qw(cgi layout presenter is_ajax type) ], + 'scalar --get_set_init' => [ qw(cgi layout presenter is_ajax is_mobile type) ], ); sub init_cgi { @@ -39,6 +39,12 @@ sub init_is_ajax { return ($ENV{HTTP_X_REQUESTED_WITH} || '') eq 'XMLHttpRequest' ? 1 : 0; } +sub init_is_mobile { + # mobile clients will change their user agent when the user requests + # desktop version so user agent is the most reliable way to identify + return ($ENV{HTTP_USER_AGENT} || '') =~ /Mobi/ ? 1 : 0; +} + sub init_type { return 'html'; } @@ -308,7 +314,7 @@ sub read_cgi_input { $target->{$_} = $self->post_data->{$_} for keys %{ $self->post_data }; - } elsif (($ENV{CONTENT_TYPE} // '') eq 'application/json') { + } elsif (($ENV{CONTENT_TYPE} // '') =~ m{^application/json}i) { $self->post_data(_parse_json_formdata($content)); } else {