mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
- fix urls for rss and export in ie8 theme
This commit is contained in:
parent
045f63dddf
commit
b39782a246
5 changed files with 43 additions and 15 deletions
|
|
@ -31,6 +31,7 @@ $().ready(function(){
|
|||
title: "<?php mttinfo('title', false); ?>",
|
||||
lang: <?php echo Lang::instance()->makeJS() ?>,
|
||||
mttUrl: "<?php mttinfo('mtt_url'); ?>",
|
||||
homeUrl: "<?php mttinfo('url'); ?>",
|
||||
db: mytinytodoStorageAjax,
|
||||
needAuth: <?php echo need_auth() ? "true" : "false"; ?>,
|
||||
isLogged: <?php echo is_logged() ? "true" : "false"; ?>,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php header("Content-type: text/html; charset=utf-8"); ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<head><!-- ie8 theme -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php mttinfo('title'); ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php mttinfo('template_url'); ?>style.css?v=<?php mttinfo('version'); ?>" media="all" />
|
||||
|
|
@ -30,6 +30,7 @@ $().ready(function(){
|
|||
title: "<?php mttinfo('title', false); ?>",
|
||||
lang: <?php echo Lang::instance()->makeJS() ?>,
|
||||
mttUrl: "<?php mttinfo('mtt_url'); ?>",
|
||||
homeUrl: "<?php mttinfo('url'); ?>",
|
||||
db: mytinytodoStorageAjax,
|
||||
needAuth: <?php echo need_auth() ? "true" : "false"; ?>,
|
||||
isLogged: <?php echo is_logged() ? "true" : "false"; ?>,
|
||||
|
|
@ -215,7 +216,7 @@ $().ready(function(){
|
|||
<li class="mtt-need-list mtt-need-real-list mtt-menu-indicator" submenu="listexportmenucontainer"><div class="submenu-icon"></div><?php _e('list_export'); ?></li>
|
||||
<li class="mtt-menu-delimiter mtt-need-real-list"></li>
|
||||
<li class="mtt-need-list mtt-need-real-list" id="btnPublish"><div class="menu-icon"></div><?php _e('list_publish');?></li>
|
||||
<li class="mtt-need-list mtt-need-real-list" id="btnRssFeed"><div class="menu-icon"></div><?php _e('list_rssfeed');?></li>
|
||||
<li class="mtt-need-list mtt-need-real-list" id="btnRssFeed"><div class="menu-icon"></div><a href="#"><?php _e('list_rssfeed');?></a></li>
|
||||
<li class="mtt-menu-delimiter mtt-need-real-list"></li>
|
||||
<li class="mtt-need-list mtt-need-real-list sort-item" id="sortByHand"><div class="menu-icon"></div><?php _e('sortByHand');?> <span class="mtt-sort-direction"></span></li>
|
||||
<li class="mtt-need-list sort-item" id="sortByDateCreated"><div class="menu-icon"></div><?php _e('sortByDateCreated');?> <span class="mtt-sort-direction"></span></li>
|
||||
|
|
@ -229,8 +230,8 @@ $().ready(function(){
|
|||
|
||||
<div id="listexportmenucontainer" class="mtt-menu-container" style="display:none">
|
||||
<ul>
|
||||
<li class="mtt-need-list mtt-need-real-list" id="btnExportCSV"><?php _e('list_export_csv');?></li>
|
||||
<li class="mtt-need-list mtt-need-real-list" id="btnExportICAL"><?php _e('list_export_ical');?></li>
|
||||
<li class="mtt-need-list mtt-need-real-list" id="btnExportCSV"><a href="#"><?php _e('list_export_csv');?></a></li>
|
||||
<li class="mtt-need-list mtt-need-real-list" id="btnExportICAL"><a href="#"><?php _e('list_export_ical');?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -193,13 +193,23 @@ function formatDate3($format, $ay, $am, $ad, $lang)
|
|||
return strtr($format, array('Y'=>$Y, 'y'=>$y, 'F'=>$F, 'M'=>$M, 'n'=>$n, 'm'=>$m, 'd'=>$d, 'j'=>$j));
|
||||
}
|
||||
|
||||
function url_dir($url)
|
||||
function url_dir($url, $onlyPath = 1)
|
||||
{
|
||||
if(false !== $p = strpos($url, '?')) $url = substr($url,0,$p); # to avoid parse errors on strange query strings
|
||||
$p = parse_url($url, PHP_URL_PATH);
|
||||
if($p == '') return '/';
|
||||
if(substr($p,-1) == '/') return $p;
|
||||
if(false !== $pos = strrpos($p,'/')) return substr($p,0,$pos+1);
|
||||
if (false !== $p = strpos($url, '?')) {
|
||||
$url = substr($url, 0, $p); # to avoid parse errors on strange query strings
|
||||
}
|
||||
if ($onlyPath) {
|
||||
$url = parse_url($url, PHP_URL_PATH);
|
||||
}
|
||||
if ($url == '') {
|
||||
return '/';
|
||||
}
|
||||
if (substr($url, -1) == '/') {
|
||||
return $url;
|
||||
}
|
||||
if (false !== $p = strrpos($url, '/')) {
|
||||
return substr($url, 0, $p+1);
|
||||
}
|
||||
return '/';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
actions: {},
|
||||
menus: {},
|
||||
mttUrl: '',
|
||||
homeUrl: '',
|
||||
options: {
|
||||
title: '',
|
||||
openList: 0,
|
||||
|
|
@ -122,6 +123,13 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
this.db = new options.db(this);
|
||||
delete options.db;
|
||||
}
|
||||
if (options.hasOwnProperty('homeUrl')) {
|
||||
this.homeUrl = options.homeUrl;
|
||||
delete options.homeUrl;
|
||||
}
|
||||
else {
|
||||
this.homeUrl = this.mttUrl;
|
||||
}
|
||||
|
||||
jQuery.extend(this.options, options);
|
||||
|
||||
|
|
@ -2399,7 +2407,7 @@ function saveSettings(frm)
|
|||
if(json.saved) {
|
||||
flashInfo(_mtt.lang.get('settingsSaved'));
|
||||
setTimeout( function(){
|
||||
window.location.assign(_mtt.mttUrl); //window.location.reload();
|
||||
window.location.assign(_mtt.homeUrl); //window.location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
}, 'json');
|
||||
|
|
|
|||
16
src/init.php
16
src/init.php
|
|
@ -165,8 +165,10 @@ function get_unsafe_mttinfo($v)
|
|||
$_mttinfo['includes_url'] = get_unsafe_mttinfo('mtt_url'). 'includes/';
|
||||
return $_mttinfo['includes_url'];
|
||||
case 'url':
|
||||
/* homepage, directory with root index.php. Used in external links. Have to be set in config if custom port is used or wrong detection. */
|
||||
$_mttinfo['url'] = Config::getUrl('url'); // need to have a trailing slash
|
||||
/* full url to homepage: directory with root index.php or custom index file in the root. */
|
||||
/* ex: http://my.site/mytinytodo/ or https://my.site/mytinytodo/home_for_2nd_theme.php */
|
||||
/* Should not contain a query string. Have to be set in config if custom port is used or wrong detection. */
|
||||
$_mttinfo['url'] = Config::getUrl('url');
|
||||
if ($_mttinfo['url'] == '') {
|
||||
$is_https = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false;
|
||||
$_mttinfo['url'] = ($is_https ? 'https://' : 'http://'). $_SERVER['HTTP_HOST']. url_dir(getRequestUri());
|
||||
|
|
@ -182,10 +184,10 @@ function get_unsafe_mttinfo($v)
|
|||
$_mttinfo['desktop_url'] = get_unsafe_mttinfo('url'). '?desktop';
|
||||
return $_mttinfo['desktop_url'];
|
||||
case 'mtt_url':
|
||||
/* directory with ajax.php */
|
||||
/* Directory with ajax.php. No need to set if you use default directory structure. */
|
||||
$_mttinfo['mtt_url'] = Config::getUrl('mtt_url'); // need to have a trailing slash
|
||||
if ($_mttinfo['mtt_url'] == '') {
|
||||
$_mttinfo['mtt_url'] = url_dir(getRequestUri());
|
||||
$_mttinfo['mtt_url'] = url_dir( get_unsafe_mttinfo('url'), 0 );
|
||||
}
|
||||
return $_mttinfo['mtt_url'];
|
||||
case 'title':
|
||||
|
|
@ -205,6 +207,12 @@ function get_mttinfo($v)
|
|||
return htmlspecialchars( get_unsafe_mttinfo($v) );
|
||||
}
|
||||
|
||||
function reset_mttinfo($key)
|
||||
{
|
||||
global $_mttinfo;
|
||||
unset( $_mttinfo[$key] );
|
||||
}
|
||||
|
||||
function getRequestUri()
|
||||
{
|
||||
// Do not use HTTP_X_REWRITE_URL due to CVE-2018-14773
|
||||
|
|
|
|||
Loading…
Reference in a new issue