From 27307633c08e3e4f6ec87605176f0b6ee4c15753 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Wed, 19 Aug 2020 10:42:31 +0300 Subject: [PATCH] * add links to desktop and mobile versions to footer --- src/index.php | 14 +++++++++++--- src/init.php | 21 +++++++++++++++++---- src/themes/default/index.php | 17 +++++++++++------ src/themes/default/style.css | 1 + 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/index.php b/src/index.php index a53aa78..954ef05 100644 --- a/src/index.php +++ b/src/index.php @@ -9,11 +9,19 @@ require_once('./init.php'); $lang = Lang::instance(); -if($lang->rtl()) Config::set('rtl', 1); +if ($lang->rtl()) { + Config::set('rtl', 1); +} -if(!is_int(Config::get('firstdayofweek')) || Config::get('firstdayofweek')<0 || Config::get('firstdayofweek')>6) Config::set('firstdayofweek', 1); +if (!is_int(Config::get('firstdayofweek')) || Config::get('firstdayofweek')<0 || Config::get('firstdayofweek')>6) { + Config::set('firstdayofweek', 1); +} -define('TEMPLATEPATH', MTTPATH. 'themes/'.Config::get('template').'/'); +if (isset($_GET['pda'])) { + Config::set('mobile', 1); +} + +define('TEMPLATEPATH', MTTPATH. 'themes/'. Config::get('template'). '/'); require(TEMPLATEPATH. 'index.php'); diff --git a/src/init.php b/src/init.php index 98ded63..d3d5d8e 100644 --- a/src/init.php +++ b/src/init.php @@ -139,7 +139,9 @@ function mttinfo($v) function get_mttinfo($v) { global $_mttinfo; - if(isset($_mttinfo[$v])) return $_mttinfo[$v]; + if (isset($_mttinfo[$v])) { + return $_mttinfo[$v]; + } switch($v) { case 'template_url': @@ -147,13 +149,24 @@ function get_mttinfo($v) return $_mttinfo['template_url']; case 'url': $_mttinfo['url'] = Config::get('url'); - if($_mttinfo['url'] == '') - $_mttinfo['url'] = 'http://'.$_SERVER['HTTP_HOST'] .($_SERVER['SERVER_PORT'] != 80 ? ':'.$_SERVER['SERVER_PORT'] : ''). + if ($_mttinfo['url'] == '') { + $proto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != '' && $_SERVER['HTTPS'] != 'off') ? 'https://' : 'http://'; + $defport = $proto == 'https://' ? 443 : 80; + $_mttinfo['url'] = $proto. $_SERVER['HTTP_HOST']. ($_SERVER['SERVER_PORT'] != $defport ? ':'.$_SERVER['SERVER_PORT'] : ''). url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']); + } return $_mttinfo['url']; + case 'mobile_url': + $_mttinfo['mobile_url'] = Config::get('mobile_url'); + if ($_mttinfo['mobile_url'] == '') { + $_mttinfo['mobile_url'] = get_mttinfo('url'). '?pda'; + } + return $_mttinfo['mobile_url']; case 'mtt_url': $_mttinfo['mtt_url'] = Config::get('mtt_url'); - if($_mttinfo['mtt_url'] == '') $_mttinfo['mtt_url'] = url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']); + if ($_mttinfo['mtt_url'] == '') { + $_mttinfo['mtt_url'] = url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']); + } return $_mttinfo['mtt_url']; case 'title': $_mttinfo['title'] = (Config::get('title') != '') ? htmlarray(Config::get('title')) : __('My Tiny Todolist'); diff --git a/src/themes/default/index.php b/src/themes/default/index.php index 0796d21..6d85983 100644 --- a/src/themes/default/index.php +++ b/src/themes/default/index.php @@ -8,7 +8,7 @@ - + @@ -28,7 +28,7 @@ @@ -281,7 +281,12 @@ $().ready(function(){
- + diff --git a/src/themes/default/style.css b/src/themes/default/style.css index 566a207..6e26bed 100644 --- a/src/themes/default/style.css +++ b/src/themes/default/style.css @@ -24,6 +24,7 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; } #footer { height:30px; margin-top:-30px; } #footer_content { background-color:#b5d5ff; padding:5px; font-size:0.8em; } #footer_content a { color:#000000; } +#mobileordesktop { float:right; } #bar { border-bottom:1px solid #b5d5ff; padding-bottom:5px; height:15px; } .bar-menu { float:right; }