X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FRequest.pm;h=7c4fa71989c882e1cac5f79c69330d112cc7d632;hb=991369b17d679e2855f4d5086d0b9769dc2ae1aa;hp=c33b6b3e514dc5619b0c2af63ce6924a48b21f05;hpb=bfe30464bc372533f08d61d07633c6942bfd3dbd;p=kivitendo-erp.git diff --git a/SL/Request.pm b/SL/Request.pm index c33b6b3e5..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'; }