Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
80ec8308
Commit
80ec8308
authored
Mar 11, 2015
by
Aaron Wells
Committed by
Gerrit Code Review
Mar 11, 2015
Browse files
Merge "Reducing the number of calls to Mobile_Detect->isMobile() (Bug #1427031)"
parents
7f2cbdf3
9813cbb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/init.php
View file @
80ec8308
...
...
@@ -453,19 +453,24 @@ if (defined('JSON') && !defined('NOSESSKEY')) {
json_reply
(
'global'
,
get_string
(
'invalidsesskey'
),
1
);
}
}
$mobile_detection_done
=
$SESSION
->
get
(
'mobile_detection'
);
// Device detection
if
(
get_config
(
'installed'
)
&&
get_account_preference
(
$USER
->
get
(
'id'
),
'devicedetection'
))
{
require_once
(
get_config
(
'libroot'
)
.
'mobile_detect/Mobile_Detect.php'
);
$detect
=
new
Mobile_Detect
();
$SESSION
->
set
(
'handheld_device'
,
$detect
->
isMobile
());
$SESSION
->
set
(
'mobile'
,
$detect
->
isTablet
()
?
false
:
$detect
->
isMobile
());
$SESSION
->
set
(
'tablet'
,
$detect
->
isTablet
());
}
else
{
$SESSION
->
set
(
'handheld_device'
,
false
);
$SESSION
->
set
(
'mobile'
,
false
);
$SESSION
->
set
(
'tablet'
,
false
);
if
(
!
$mobile_detection_done
)
{
if
(
get_config
(
'installed'
)
&&
get_account_preference
(
$USER
->
get
(
'id'
),
'devicedetection'
))
{
require_once
(
get_config
(
'libroot'
)
.
'mobile_detect/Mobile_Detect.php'
);
$detect
=
new
Mobile_Detect
();
$isMobile
=
$detect
->
isMobile
();
$isTablet
=
$detect
->
isTablet
();
$SESSION
->
set
(
'handheld_device'
,
$isMobile
);
$SESSION
->
set
(
'mobile'
,
$isTablet
?
false
:
$isMobile
);
$SESSION
->
set
(
'tablet'
,
$isTablet
);
}
else
{
$SESSION
->
set
(
'handheld_device'
,
false
);
$SESSION
->
set
(
'mobile'
,
false
);
$SESSION
->
set
(
'tablet'
,
false
);
}
$SESSION
->
set
(
'mobile_detection'
,
true
);
}
// Run modules bootstrap code.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment