Exemple #1
0
function get_mttinfo($v)
{
    global $_mttinfo;
    if (isset($_mttinfo[$v])) {
        return $_mttinfo[$v];
    }
    switch ($v) {
        case 'template_url':
            $_mttinfo['template_url'] = get_mttinfo('mtt_url') . 'themes/' . Config::get('template') . '/';
            return $_mttinfo['template_url'];
        case 'url':
            $_mttinfo['url'] = Config::get('url');
            if ($_mttinfo['url'] == '') {
                $_mttinfo['url'] = 'http://' . $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '') . url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);
            }
            return $_mttinfo['url'];
        case 'mtt_url':
            $_mttinfo['mtt_url'] = Config::get('mtt_url');
            if ($_mttinfo['mtt_url'] == '') {
                $_mttinfo['mtt_url'] = url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);
            }
            return $_mttinfo['mtt_url'];
        case 'title':
            $_mttinfo['title'] = Config::get('title') != '' ? htmlarray(Config::get('title')) : __('My Tiny Todolist');
            return $_mttinfo['title'];
    }
}
	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!<br/> 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);