mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* language settings for demo
This commit is contained in:
parent
44f25d6c3e
commit
b77ff34a1b
2 changed files with 14 additions and 1 deletions
|
|
@ -40,6 +40,11 @@ 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('lang/'. $_COOKIE['lang']. '.php')) {
|
||||
Config::set('lang', $_COOKIE['lang']);
|
||||
}
|
||||
|
||||
require_once(MTTPATH. 'lang/class.default.php');
|
||||
require_once(MTTPATH. 'lang/'.Config::get('lang').'.php');
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/*
|
||||
This file is part of myTinyTodo.
|
||||
(C) Copyright 2009-2010 Max Pozdeev <maxpozdeev@gmail.com>
|
||||
(C) Copyright 2009-2011 Max Pozdeev <maxpozdeev@gmail.com>
|
||||
Licensed under the GNU GPL v3 license. See file COPYRIGHT for details.
|
||||
*/
|
||||
|
||||
|
|
@ -22,6 +22,14 @@ if(isset($_POST['save']))
|
|||
$langs = getLangs();
|
||||
Config::$params['lang']['options'] = array_keys($langs);
|
||||
Config::set('lang', _post('lang'));
|
||||
|
||||
// in Demo mode we can set only language by cookies
|
||||
if(defined('MTTDEMO')) {
|
||||
setcookie('lang', Config::get('lang'), 0, url_dir(Config::get('url')=='' ? $_SERVER['REQUEST_URI'] : Config::get('url')));
|
||||
$t['saved'] = 1;
|
||||
jsonExit($t);
|
||||
}
|
||||
|
||||
if(isset($_POST['password']) && $_POST['password'] != '') Config::set('password', $_POST['password']);
|
||||
elseif(!_post('allowpassword')) Config::set('password', '');
|
||||
Config::set('smartsyntax', (int)_post('smartsyntax'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue