Licensed under the GNU GPL v2 license. See file COPYRIGHT for details. */ require_once('./init.php'); $lang = Lang::instance(); if($needAuth && !is_logged()) { die("Access denied!
Disable password protection or Log in."); } if(isset($_POST['save'])) { stop_gpc($_POST); $t = array(); $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')); // Do not set invalid timezone try { $tz = trim(_post('timezone')); $testTZ = new DateTimeZone($tz); //will throw Exception on invalid timezone Config::set('timezone', $tz); } catch (Exception $e) { } Config::set('autotag', (int)_post('autotag')); Config::set('session', _post('session')); Config::set('firstdayofweek', (int)_post('firstdayofweek')); Config::set('clock', (int)_post('clock')); Config::set('dateformat', _post('dateformat')); Config::set('dateformat2', _post('dateformat2')); Config::set('dateformatshort', _post('dateformatshort')); Config::set('title', trim(_post('title'))); Config::set('showdate', (int)_post('showdate')); Config::save(); $t['saved'] = 1; jsonExit($t); } function _c($key) { return Config::get($key); } function getLangs($withContents = 0) { if (!$h = opendir(MTTPATH. 'lang')) return false; $a = array(); while(false !== ($file = readdir($h))) { if(preg_match('/(.+)\.php$/', $file, $m) && $file != 'class.default.php') { $a[$m[1]] = $m[1]; if($withContents) { $a[$m[1]] = getLangDetails(MTTPATH. 'lang'. DIRECTORY_SEPARATOR. $file, $m[1]); $a[$m[1]]['name'] = $a[$m[1]]['original_name']; $a[$m[1]]['title'] = $a[$m[1]]['language']; } } } closedir($h); return $a; } function getLangDetails($filename, $default) { $contents = file_get_contents($filename); $a = array('language'=>$default, 'original_name'=>$default); if(preg_match("|/\\*\s*myTinyTodo language pack([\s\S]+?)\\*/|", $contents, $m)) { $str = $m[1]; if(preg_match("|Language\s*:\s*(.+)|i", $str, $m)) { $a['language'] = trim($m[1]); } if(preg_match("|Original name\s*:\s*(.+)|i", $str, $m)) { $a['original_name'] = trim($m[1]); } } return $a; } function selectOptions($a, $value, $default=null) { if(!$a) return ''; $s = ''; if($default !== null && !isset($a[$value])) $value = $default; foreach($a as $k=>$v) { $s .= ''; } return $s; } /* @param array $a array of id=>array(name, optional title) @param mixed $key Key of OPTION to be selected @param mixed $default Default key if $key is not present in $a */ function selectOptionsA($a, $key, $default=null) { if(!$a) return ''; $s = ''; if($default !== null && !isset($a[$key])) $key = $default; foreach($a as $k=>$v) { $s .= ''; } return $s; } function timezoneIdentifiers() { $zones = DateTimeZone::listIdentifiers(); $a = array(); foreach($zones as $v) { $a[$v] = $v; } return $a; } header('Content-type:text/html; charset=utf-8'); ?>

:
:
:

:
/>
:

:

:
(<mytinytodo_dir>/tmp/sessions)
:
:
:
:
:
:
: