示例#1
0
文件: func.php 项目: arpad9/bygmarket
function fn_twg_api_customer_logout()
{
    // copied from common/auth.php - logout mode
    $auth = $_SESSION['auth'];
    fn_save_cart_content($_SESSION['cart'], $auth['user_id']);
    if (!empty($auth['user_id'])) {
        // Log user logout
        fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false));
    }
    unset($_SESSION['auth']);
    fn_clear_cart($_SESSION['cart'], false, true);
    fn_delete_session_data(fn_get_area_name() . '_user_id', fn_get_area_name() . '_password');
    return true;
}
示例#2
0
        return array(CONTROLLER_STATUS_REDIRECT, fn_url());
    }
    $stored_user_login = fn_restore_post_data('user_login');
    if (!empty($stored_user_login)) {
        Registry::get('view')->assign('stored_user_login', $stored_user_login);
    }
    if (AREA != 'A') {
        fn_add_breadcrumb(__('sign_in'));
    }
    Registry::get('view')->assign('view_mode', 'simple');
} elseif ($mode == 'password_change' && AREA == 'A') {
    if (defined('AJAX_REQUEST') && empty($auth)) {
        exit;
    }
    if (empty($auth['user_id'])) {
        return array(CONTROLLER_STATUS_REDIRECT, fn_url());
    }
    $profile_id = 0;
    $user_data = fn_get_user_info($auth['user_id'], true, $profile_id);
    Registry::get('view')->assign('user_data', $user_data);
    Registry::get('view')->assign('view_mode', 'simple');
} elseif ($mode == 'change_login') {
    $auth = $_SESSION['auth'];
    if (!empty($auth['user_id'])) {
        fn_log_user_logout($auth);
    }
    unset($_SESSION['cart']['user_data']);
    fn_login_user();
    fn_delete_session_data(AREA . '_user_id', AREA . '_password');
    return array(CONTROLLER_STATUS_OK, 'checkout.checkout');
}
示例#3
0
 }
 if ($_REQUEST['user_data']['email'] !== $_REQUEST['user_data']['email2']) {
     fn_set_notification('W', __('warning'), __('error_validator_password', array('[field2]' => __('email'), '[field]' => __('validate_email'))));
     $is_valid_user_data = false;
 }
 fn_restore_processed_user_password($_REQUEST['user_data'], $_POST['user_data']);
 $res = fn_update_user($auth['user_id'], $_REQUEST['user_data'], $auth, !empty($_REQUEST['ship_to_another']), true);
 if ($res) {
     list($user_id, $profile_id) = $res;
     // Cleanup user info stored in cart
     if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['user_data'])) {
         $_SESSION['cart']['user_data'] = fn_array_merge($_SESSION['cart']['user_data'], $_REQUEST['user_data']);
     }
     // Delete anonymous authentication
     if ($cu_id = fn_get_session_data('cu_id') && !empty($auth['user_id'])) {
         fn_delete_session_data('cu_id');
     }
     Session::regenerateId();
     if (!empty($_REQUEST['return_url'])) {
         return array(CONTROLLER_STATUS_OK, $_REQUEST['return_url']);
     }
 } else {
     fn_save_post_data('user_data');
     fn_delete_notification('changes_saved');
 }
 if (!empty($user_id) && !$is_update) {
     $redirect_url = "profiles.success_add";
 } else {
     $redirect_url = "profiles." . (!empty($user_id) ? "update" : "add") . "?";
     if (Registry::get('settings.General.user_multiple_profiles') == 'Y') {
         $redirect_url .= "profile_id={$profile_id}&";
示例#4
0
/**
 * @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
}
示例#5
0
/**
 * @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);
}
示例#6
0
/**
 * Tryes to find company id in session
 *
 * @return int Company id if stored in session, 0 otherwise
 */
function fn_init_company_id_find_in_session()
{
    $session_company_id = intval(fn_get_session_data('company_id'));
    if ($session_company_id && !fn_get_available_company_ids($session_company_id)) {
        fn_delete_session_data('company_id');
        $session_company_id = 0;
    }
    return $session_company_id;
}