* language settings for demo

This commit is contained in:
Max Pozdeev 2011-05-30 18:44:56 +04:00
parent 44f25d6c3e
commit b77ff34a1b
2 changed files with 14 additions and 1 deletions

View file

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

View file

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