Move langs to /content/lang/ folder

This commit is contained in:
Max Pozdeev 2020-09-18 23:02:45 +03:00
parent 658ec2fbc6
commit 83ac15e582
42 changed files with 10 additions and 6 deletions

View file

@ -63,10 +63,10 @@ replaceVer('./init.php', $ver);
unlink('./tmp/sessions/empty');
# save only 2 languages
$dh = opendir('./includes/lang/') or die("Cant opendir lang\n");
$dh = opendir('./content/lang/') or die("Cant opendir lang\n");
while (false !== ($f = readdir($dh))) {
if (!in_array($f, ['.', '..', '.htaccess', 'en.json', 'ru.json'])) {
unlink('./includes/lang/'. $f);
unlink('./content/lang/'. $f);
}
}
closedir($dh);

2
src/content/index.php Normal file
View file

@ -0,0 +1,2 @@
<?php
//empty

1
src/includes/.htaccess Normal file
View file

@ -0,0 +1 @@
Options -Indexes

View file

@ -9,7 +9,7 @@ class Lang
protected static $instance;
protected $code = 'en';
protected $default = 'en';
protected $langDir = MTTINC. 'lang/';
protected $langDir = MTTLANG;
protected $strings;
public static function instance()

View file

@ -1 +0,0 @@
Place for jQuery UI

View file

@ -14,6 +14,8 @@ if (version_compare(PHP_VERSION, '5.4.0') < 0) {
if(!defined('MTTPATH')) define('MTTPATH', dirname(__FILE__) .'/');
if(!defined('MTTINC')) define('MTTINC', MTTPATH. 'includes/');
if(!defined('MTTCONTENT')) define('MTTCONTENT', MTTPATH. 'content/');
if(!defined('MTTLANG')) define('MTTLANG', MTTCONTENT. 'lang/');
require_once(MTTINC. 'common.php');
require_once(MTTPATH. 'db/config.php');
@ -54,7 +56,7 @@ else {
$db->prefix = Config::get('prefix');
//User can override language setting by cookies
if(isset($_COOKIE['lang']) && preg_match("/^[a-z-]+$/i", $_COOKIE['lang']) && file_exists(MTTPATH. 'lang/'. $_COOKIE['lang']. '.php')) {
if(isset($_COOKIE['lang']) && preg_match("/^[a-z-]+$/i", $_COOKIE['lang']) && file_exists(MTTLANG. $_COOKIE['lang']. '.php')) {
Config::set('lang', $_COOKIE['lang']);
}

View file

@ -195,7 +195,7 @@ header('Content-type:text/html; charset=utf-8');
<select name="lang"><?php echo selectOptionsA(getLangs(), _c('lang')); ?></select>
<?php if ($oldLangs) { ?>
<br><br>
<b>Notice!</b> You can use old language files after downloading in the new format and copying to the <i>/includes/lang/</i> folder.<br>
<b>Notice!</b> You can use old language files after downloading in the new format and copying to the <i>/content/lang/</i> folder.<br>
<select id="mtt_old_langs"><?php echo selectOptionsA( $oldLangs, _c('lang'), 'en'); ?></select>
<a id="mtt_old_langs_link" href="<?php mttinfo('mtt_url')?>mytinytodo_lang.php?jsonfile">Download json file</a>
<script type="text/javascript">