/** * @param array $auth */ function fn_user_logout($auth) { // Regenerate session_id for security reasons fn_save_cart_content($_SESSION['cart'], $auth['user_id']); Session::regenerateId(); fn_init_user(); $auth = $_SESSION['auth']; if (!empty($auth['user_id'])) { fn_log_user_logout($auth); } unset($_SESSION['auth']); fn_clear_cart($_SESSION['cart'], false, true); fn_delete_session_data(AREA . '_user_id', AREA . '_password'); unset($_SESSION['product_notifications']); fn_login_user(); // need to fill $_SESSION['auth'] array for anonymous user }
if (!empty($cart['chosen_shipping'])) { $cart['calculate_shipping'] = true; } return array(CONTROLLER_STATUS_OK); } if ($mode == 'add_profile') { if (fn_image_verification('use_for_register', $_REQUEST) == false) { fn_save_post_data('user_data'); return array(CONTROLLER_STATUS_REDIRECT, "checkout.checkout?login_type=register"); } if (list($user_id, $profile_id) = fn_update_user(0, $_REQUEST['user_data'], $auth, false, true)) { $profile_fields = fn_get_profile_fields('O'); db_query("UPDATE ?:user_session_products SET user_id = ?s WHERE session_id = ?s AND type = ?s AND user_type = ?s", $user_id, Session::getId(), 'C', 'U'); // db_query("DELETE FROM ?:user_session_products WHERE session_id = ?s AND type = ?s AND user_type = ?s", Session::getId(), 'C', 'U'); // fn_save_cart_content($cart, $user_id); fn_init_user(); $step = 'step_two'; if (empty($profile_fields['B']) && empty($profile_fields['S'])) { $step = 'step_three'; } $suffix = '?edit_step=' . $step; } else { fn_save_post_data('user_data'); $suffix = '?login_type=register'; } return array(CONTROLLER_STATUS_OK, "checkout.checkout" . $suffix); } if ($mode == 'customer_info') { if (Registry::get('runtime.action') != '') { $_action = '.' . Registry::get('runtime.action'); }
/** * @param array $auth */ function fn_user_logout($auth) { // Regenerate session_id for security reasons fn_save_cart_content(Tygh::$app['session']['cart'], $auth['user_id']); Tygh::$app['session']->regenerateID(); fn_init_user(); $auth = Tygh::$app['session']['auth']; if (!empty($auth['user_id'])) { fn_log_user_logout($auth); } unset(Tygh::$app['session']['auth']); fn_clear_cart(Tygh::$app['session']['cart'], false, true); fn_delete_session_data(AREA . '_user_id', AREA . '_password'); unset(Tygh::$app['session']['product_notifications']); fn_login_user(); // need to fill Tygh::$app['session']['auth'] array for anonymous user /** * Allows to perform any actions after user logout. * * @param array $auth Auth data from session */ fn_set_hook('user_logout_after', $auth); }