Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details. */ require_once('./init.php'); $lang = Lang::instance(); if ( !is_logged() ) { die("Access denied!
Disable password protection or Log in."); } if(isset($_POST['save'])) { check_token(); $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')=='' ? getRequestUri() : Config::getUrl('url'))); $t['saved'] = 1; jsonExit($t); } if (isset($_POST['password']) && $_POST['password'] != '') Config::set('password', passwordHash($_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('markup', (int)_post('markdown') == 0 ? 'v1' : 'markdown'); Config::set('firstdayofweek', (int)_post('firstdayofweek')); Config::set('clock', (int)_post('clock')); Config::set('dateformat', removeNewLines(_post('dateformat')) ); Config::set('dateformat2', removeNewLines(_post('dateformat2')) ); Config::set('dateformatshort', removeNewLines(_post('dateformatshort')) ); Config::set('title', removeNewLines(trim(_post('title'))) ); Config::set('showdate', (int)_post('showdate')); Config::set('appearance', removeNewLines(trim(_post('appearance'))) ); Config::save(); $t['saved'] = 1; jsonExit($t); } function _c($key) { return Config::get($key); } function getLangs($withContents = 0) { $langDir = Lang::instance()->langDir(); if ( ! $h = opendir($langDir) ) { return false; } $a = array(); while ( false !== ($file = readdir($h)) ) { if ( preg_match('/(.+)\.json$/', $file, $m) ) { $jsonText = file_get_contents($langDir. $file); if (false === $jsonText) { die("false "); continue; } $a[$m[1]] = $m[1]; $j = json_decode($jsonText, true); if ( isset($j['_header']['language']) && isset($j['_header']['original_name']) ) { $a[$m[1]]= [ 'name' => $j['_header']['original_name'], 'title' => $j['_header']['language'] ]; } } } closedir($h); 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) { if (!is_array($v)) { $v = array('name' => $k); } $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'); ?>

"; $j = json_encode($j, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_INVALID_UTF8_SUBSTITUTE); ?>
config.json
:
:
:


:
/>
:

:

:

:
:
:
:
:
:
:

: