Commit 303409a1 authored by Hugh Davenport's avatar Hugh Davenport
Browse files

Add option to disable device detection



Bug #1052060

Change-Id: I5a8fe3cf136bb0c3e76e50a2b3bc48179c675b6a
Signed-off-by: default avatarHugh Davenport <hugh@catalyst.net.nz>
parent 3303e3b1
......@@ -352,10 +352,12 @@ if (defined('JSON') && !defined('NOSESSKEY')) {
// Device detection
require_once(get_config('libroot') . 'mobile_detect/Mobile_Detect.php');
$detect = new Mobile_Detect();
$SESSION->set('handheld_device', ($detect->isMobile() || $detect->isTablet()));
$SESSION->set('mobile', $detect->isMobile());
$SESSION->set('tablet', $detect->isTablet());
if (!get_account_preference($USER->get('id'), 'disabledevicedetection')) {
$detect = new Mobile_Detect();
$SESSION->set('handheld_device', ($detect->isMobile() || $detect->isTablet()));
$SESSION->set('mobile', $detect->isMobile());
$SESSION->set('tablet', $detect->isTablet());
}
/*
* Initializes our performance info early.
......
......@@ -214,6 +214,7 @@ function expected_account_preferences() {
'mobileuploadtoken' => '',
'theme' => '',
'resizeonuploaduserdefault' => 1,
'disabledevicedetection' => 0,
);
}
......@@ -376,6 +377,15 @@ function general_account_prefs_form_elements($prefs) {
);
}
if (get_config('userscandisabledevicedetection')) {
$elements['disabledevicedetection'] = array(
'type' => 'checkbox',
'title' => get_string('disabledevicedetection', 'account'),
'description' => get_string('disabledevicedetectiondescription', 'accont'),
'defaultvalue' => $prefs->disabledevicedetection,
);
}
return $elements;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment