Beispiel #1
0
function settings_submit()
{
    global $phpcid, $vars, $phpcdb, $phpc_user_tz, $phpc_user_lang, $phpc_prefix, $phpc_user;
    verify_token();
    // Expire 20 years in the future, give or take.
    $expiration_time = time() + 20 * 365 * 24 * 60 * 60;
    // One hour in the past
    $past_time = time() - 3600;
    if (!empty($vars["timezone"])) {
        phpc_set_cookie("{$phpc_prefix}tz", $vars['timezone'], $expiration_time);
    } else {
        phpc_set_cookie("{$phpc_prefix}tz", '', $past_time);
    }
    if (!empty($vars["language"])) {
        phpc_set_cookie("{$phpc_prefix}lang", $vars['language'], $expiration_time);
    } else {
        phpc_set_cookie("{$phpc_prefix}lang", '', $past_time);
    }
    if (is_user()) {
        $uid = $phpc_user->get_uid();
        $phpcdb->set_timezone($uid, $vars['timezone']);
        $phpcdb->set_language($uid, $vars['language']);
        $phpc_user_tz = $vars["timezone"];
        $phpc_user_lang = $vars["language"];
    }
    return message(__('Settings updated.'));
}
Beispiel #2
0
function phpc_do_logout()
{
    global $phpc_prefix;
    session_destroy();
    $past_time = time() - 3600;
    phpc_set_cookie("{$phpc_prefix}uid", "", $past_time);
    phpc_set_cookie("{$phpc_prefix}login", "", $past_time);
    phpc_set_cookie("{$phpc_prefix}login_series", "", $past_time);
}