remove auto-detect of mobile theme

This commit is contained in:
Max Pozdeev 2020-10-19 22:58:37 +03:00
parent 4569a05a50
commit b76b370d1c
3 changed files with 6 additions and 15 deletions

View file

@ -10,7 +10,7 @@ $config['db'] = '';
$config['mysql.host'] = "localhost";
$config['mysql.db'] = "mytinytodo";
$config['mysql.user'] = "user";
$config['mysql.password'] = "";
$config['mysql.password'] = "";
# Tables prefix
$config['prefix'] = "mtt_";
@ -19,7 +19,7 @@ $config['prefix'] = "mtt_";
# 'url' - URL where index.php is called from (ex.: http://site.com/todo.php)
# 'mtt_url' - directory URL where mytinytodo is installed (with trailing slash) (ex.: http://site.com/lib/mytinytodo/)
$config['url'] = '';
$config['mtt_url'] = '';
$config['mtt_url'] = '';
# Language pack
$config['lang'] = "en";
@ -54,7 +54,4 @@ $config['dateformatshort'] = 'j M';
# Show task date in list
$config['showdate'] = 0;
# Autodetect mobile devices and switch theme
$config['detectmobile'] = 1;
?>
?>

View file

@ -112,7 +112,6 @@ class Config
'dateformatshort' => array('default'=>'j M', 'type'=>'s'),
'template' => array('default'=>'default', 'type'=>'s'),
'showdate' => array('default'=>0, 'type'=>'i'),
'detectmobile' => array('default'=>1, 'type'=>'i')
);
public static $config;

View file

@ -29,13 +29,8 @@ if (!is_int(Config::get('firstdayofweek')) || Config::get('firstdayofweek')<0 ||
Config::set('firstdayofweek', 1);
}
if ( !isset($_GET['mobile']) && !isset($_GET['pda']) && !isset($_GET['desktop']) && Config::get('detectmobile') ) {
if (is_mobile()) {
Config::set('mobile', 1);
}
}
//TODO: if we have a desktop or mobile theme request we have to save it in cookies and redirect (if auto-detect mobiles is on)
else if ( isset($_GET['desktop']) ) { //more priority than mobile
if ( isset($_GET['desktop']) ) { //more priority than mobile
Config::set('mobile', 0);
}
else if ( isset($_GET['mobile']) || isset($_GET['pda']) ) {
@ -71,6 +66,6 @@ function is_mobile()
function getDesktopUrl($escape = true)
{
$url = (Config::get('detectmobile') && is_mobile()) ? get_unsafe_mttinfo('desktop_url') : get_unsafe_mttinfo('url');
$url = is_mobile() ? get_unsafe_mttinfo('desktop_url') : get_unsafe_mttinfo('url');
return $escape ? htmlspecialchars($url) : $url;
}