<?php $lang=TGET('lang'); $return_path=TGET('return_path'); $countrycode=TGET('countrycode'); $lang_req=language_requested(); $cc_req=get_user_countrycode(); if (!$return_path) $return_path=$_SERVER['HTTP_REFERER']; $return_path_info=parseURL($return_path); if ($lang) { $return_path_info['path']=str_replace("/".$lang_req."/","/".$lang."/",$return_path_info['path']); set_user_language($lang); if (strpos($return_path_info['path'],"/".$lang."/")===false) $return_path_info['path']=dirname_ending_with_slash($return_path_info['path']).$lang.'/'.basename($return_path_info['path']); } if ($countrycode) { $return_path_info['path']=str_replace("/".$cc_req."/","/".$countrycode."/",$return_path_info['path']); set_user_countrycode($countrycode); if (strpos($return_path_info['path'],"/".$countrycode."/")===false) $return_path_info['path']=dirname_ending_with_slash($return_path_info['path']).$countrycode.'/'.basename($return_path_info['path']); } $url=rewrite_fix_path($return_path_info['path']) .($return_path_info['query']?'?'.$return_path_info['query']:'') .($return_path_info['fragment']?'#'.$return_path_info['fragment']:''); if (!$url) $url="./"; redirect($url); ?>