From b76b370d1c6ef3b530de5cc6344af241d53eb109 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Mon, 19 Oct 2020 22:58:37 +0300 Subject: [PATCH] remove auto-detect of mobile theme --- src/db/config.php.default | 9 +++------ src/includes/common.php | 1 - src/index.php | 11 +++-------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/db/config.php.default b/src/db/config.php.default index ddd5399..21b38ee 100644 --- a/src/db/config.php.default +++ b/src/db/config.php.default @@ -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; - -?> \ No newline at end of file +?> diff --git a/src/includes/common.php b/src/includes/common.php index d2309f1..67384bb 100644 --- a/src/includes/common.php +++ b/src/includes/common.php @@ -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; diff --git a/src/index.php b/src/index.php index e6d9ee2..57bf90f 100644 --- a/src/index.php +++ b/src/index.php @@ -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; } \ No newline at end of file