From e8f3b51ca52802f0d5a1cbaff446d61451d84e79 Mon Sep 17 00:00:00 2001 From: SJ Date: Tue, 6 Aug 2013 11:32:02 +0200 Subject: [PATCH] added mobile device detection --- webui/config.php | 4 ++++ webui/system/controller.php | 3 ++- webui/system/helper/detectmobilebrowser.php | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 webui/system/helper/detectmobilebrowser.php diff --git a/webui/config.php b/webui/config.php index 854bf550..099bac98 100644 --- a/webui/config.php +++ b/webui/config.php @@ -237,6 +237,10 @@ require_once 'config-site.php'; if(isset($_SESSION['theme']) && preg_match("/^([a-zA-Z0-9\-\_]+)$/", $_SESSION['theme'])) { $config['THEME'] = $_SESSION['theme']; } +include("/system/helper/detectmobilebrowser.php"); + +if(MOBILE_DEVICE == 1) { $config['THEME'] = 'mobile'; } + // make sure auditors are restricted in a saas environment if($config['ENABLE_SAAS'] == 1) { $config['RESTRICTED_AUDITOR'] = 1; } if(isset($_SESSION['username']) && $_SESSION['username'] == 'auditor@local') { $config['RESTRICTED_AUDITOR'] = 0; } diff --git a/webui/system/controller.php b/webui/system/controller.php index 6bb88a15..6a5b017e 100644 --- a/webui/system/controller.php +++ b/webui/system/controller.php @@ -93,7 +93,8 @@ class Controller { $file = DIR_THEME . THEME . '/templates/' . $this->template; } - + if(MOBILE_DEVICE == 1) { $file = DIR_THEME . 'mobile' . '/templates/' . $this->template; } + if(file_exists($file)){ extract($this->data); diff --git a/webui/system/helper/detectmobilebrowser.php b/webui/system/helper/detectmobilebrowser.php new file mode 100644 index 00000000..a5e8ae8a --- /dev/null +++ b/webui/system/helper/detectmobilebrowser.php @@ -0,0 +1,7 @@ +