@ -112,8 +112,12 @@ bool ssl = false;
}
// !! IMPROVE ME
// !! mozna zrobic jakas obsluge kiedy nie mozemy sie redirectnac, np gdy wystapil blad
// !! moze zwracac jakas wartosc?
/*
postfix will not be UrlEncoded
*/
void System : : RedirectTo ( const Item & item , const wchar_t * postfix )
{
PutUrlProto ( config - > use_ssl , cur - > request - > redirect_to ) ;
@ -137,6 +141,9 @@ void System::RedirectTo(const Item & item, const wchar_t * postfix)
/*
postfix will not be UrlEncoded
*/
void System : : RedirectTo ( long item_id , const wchar_t * postfix )
{
PutUrlProto ( config - > use_ssl , cur - > request - > redirect_to ) ;
@ -174,12 +181,16 @@ void System::RedirectTo(long item_id, const wchar_t * postfix)
}
void System : : RedirectTo ( const std : : wstring & url )
/*
url will not be UrlEncoded
*/
void System : : RedirectTo ( const wchar_t * url )
{
PutUrlProto ( config - > use_ssl , cur - > request - > redirect_to ) ;
cur - > request - > redirect_to + = config - > base_url ;
if ( ! url . empty ( ) & & url [ 0 ] = = ' / ' )
if ( url [ 0 ] = = ' / ' )
{
// absolute path
cur - > request - > redirect_to + = url ;
@ -201,6 +212,19 @@ void System::RedirectTo(const std::wstring & url)
}
/*
url will not be UrlEncoded
*/
void System : : RedirectTo ( const std : : wstring & url )
{
RedirectTo ( url . c_str ( ) ) ;
}
/*
params will be UrlEncoded
*/
void System : : AddParams ( const ParamTab & param_tab , std : : wstring & str , bool clear_str )
{
if ( clear_str )
@ -209,19 +233,22 @@ void System::AddParams(const ParamTab & param_tab, std::wstring & str, bool clea
for ( size_t i = 0 ; i < param_tab . size ( ) ; + + i )
{
str + = ' / ' ;
str + = param_tab [ i ] . name ;
UrlEncode( param_tab [ i ] . name , str , false ) ;
if ( ! param_tab [ i ] . value . empty ( ) )
{
str + = ' : ' ;
str + = param_tab [ i ] . value ;
UrlEncode( param_tab [ i ] . value , str , false ) ;
}
}
}
void System : : RedirectWithFunctionAndParamsTo ( const std : : wstring & url )
/*
url will not be UrlEncoded
params will be UrlEncoded
*/
void System : : RedirectWithFunctionAndParamsTo ( const wchar_t * url )
{
RedirectTo ( url ) ;
@ -229,12 +256,21 @@ void System::RedirectWithFunctionAndParamsTo(const std::wstring & url)
return ;
cur - > request - > redirect_to + = ' / ' ;
cur - > request - > redirect_to + = cur - > request - > function - > fun . url ;
cur - > request - > redirect_to + = cur - > request - > function - > fun . url ;
AddParams ( cur - > request - > param_tab , cur - > request - > redirect_to , false ) ;
}
/*
url will not be UrlEncoded
params will be UrlEncoded
*/
void System : : RedirectWithFunctionAndParamsTo ( const std : : wstring & url )
{
RedirectWithFunctionAndParamsTo ( url . c_str ( ) ) ;
}
void System : : RedirectToLastDir ( )
{
if ( ! cur - > request - > dir_tab . empty ( ) )