mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
- bugfix: mytinytodo was not working when opened like 'path/index.php'
This commit is contained in:
parent
06eb452104
commit
5ad4b37c19
2 changed files with 13 additions and 4 deletions
|
|
@ -140,4 +140,13 @@ function formatDate3($format, $ay, $am, $ad, $lang)
|
|||
return strtr($format, array('Y'=>$Y, 'F'=>$F, 'M'=>$M, 'n'=>$n, 'm'=>$m, 'd'=>$d, 'j'=>$j));
|
||||
}
|
||||
|
||||
function url_dir($url)
|
||||
{
|
||||
$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);
|
||||
return '/';
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -46,13 +46,13 @@ function get_mttinfo($v)
|
|||
switch($v)
|
||||
{
|
||||
case 'template_uri':
|
||||
$_mttinfo['template_uri'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH). 'themes/'. Config::get('template') . '/';
|
||||
$_mttinfo['template_uri'] = url_dir($_SERVER['REQUEST_URI']). 'themes/'. Config::get('template') . '/';
|
||||
return $_mttinfo['template_uri'];
|
||||
case 'template_url':
|
||||
$_mttinfo['template_url'] = get_mttinfo('siteurl'). 'themes/'. Config::get('template') . '/';
|
||||
$_mttinfo['template_url'] = get_mttinfo('url'). 'themes/'. Config::get('template') . '/';
|
||||
return $_mttinfo['template_url'];
|
||||
case 'siteurl':
|
||||
$_mttinfo['siteurl'] = 'http://'.$_SERVER['HTTP_HOST'] .($_SERVER['SERVER_PORT'] != 80 ? ':'.$_SERVER['SERVER_PORT'] : ''). parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
case 'url':
|
||||
$_mttinfo['siteurl'] = 'http://'.$_SERVER['HTTP_HOST'] .($_SERVER['SERVER_PORT'] != 80 ? ':'.$_SERVER['SERVER_PORT'] : ''). url_dir($_SERVER['REQUEST_URI']);
|
||||
return $_mttinfo['siteurl'];
|
||||
case 'title':
|
||||
$_mttinfo['title'] = (Config::get('title') != '') ? htmlarray(Config::get('title')) : $lang->get('My Tiny Todolist');
|
||||
|
|
|
|||
Loading…
Reference in a new issue