* add links to desktop and mobile versions to footer

This commit is contained in:
Max Pozdeev 2020-08-19 10:42:31 +03:00
parent 1808267267
commit 27307633c0
4 changed files with 40 additions and 13 deletions

View file

@ -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');

View file

@ -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');

View file

@ -8,7 +8,7 @@
<?php if(Config::get('rtl')): ?>
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>style_rtl.css?v=@VERSION" media="all" />
<?php endif; ?>
<?php if(isset($_GET['pda'])): ?>
<?php if(Config::get('mobile')): ?>
<meta name="viewport" id="viewport" content="width=device-width" />
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>pda.css?v=@VERSION" media="all" />
<?php else: ?>
@ -28,7 +28,7 @@
<script type="text/javascript">
$().ready(function(){
<?php if(isset($_GET['pda'])): ?>
<?php if(Config::get('mobile')): ?>
$('body').width(screen.width);
$(window).resize(function() {
@ -43,13 +43,13 @@ $().ready(function(){
mytinytodo.init({
needAuth: <?php echo $needAuth ? "true" : "false"; ?>,
isLogged: <?php echo ($needAuth && is_logged()) ? "true" : "false"; ?>,
showdate: <?php echo (Config::get('showdate') && !isset($_GET['pda'])) ? "true" : "false"; ?>,
singletab: <?php echo (isset($_GET['singletab']) || isset($_GET['pda'])) ? "true" : "false"; ?>,
showdate: <?php echo (Config::get('showdate') && !Config::get('mobile')) ? "true" : "false"; ?>,
singletab: <?php echo (isset($_GET['singletab']) || Config::get('mobile')) ? "true" : "false"; ?>,
duedatepickerformat: "<?php echo htmlspecialchars(Config::get('dateformat2')); ?>",
firstdayofweek: <?php echo (int) Config::get('firstdayofweek'); ?>,
autotag: <?php echo Config::get('autotag') ? "true" : "false"; ?>
<?php if(isset($_GET['list'])) echo ",openList: ". (int)$_GET['list']; ?>
<?php if(isset($_GET['pda'])) echo ", touchDevice: true"; ?>
<?php if(Config::get('mobile')) echo ", touchDevice: true"; ?>
}).loadLists(1);
});
</script>
@ -281,7 +281,12 @@ $().ready(function(){
<div id="space"></div>
</div>
<div id="footer"><div id="footer_content">Powered by <strong><a href="http://www.mytinytodo.net/">myTinyTodo</a></strong> @VERSION </div></div>
<div id="footer">
<div id="footer_content">
<span id="mobileordesktop" ><a href="<?php mttinfo('url'); ?>">Desktop</a> | <a href="<?php mttinfo('mobile_url'); ?>">Mobile</a></span>
<span>Powered by <strong><a href="http://www.mytinytodo.net/">myTinyTodo</a></strong> @VERSION</span>
</div>
</div>
</div>
</body>

View file

@ -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; }