78 lines
1.2 KiB
C++
Executable File
78 lines
1.2 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2011-2012, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "templates.h"
|
|
#include "functions/functions.h"
|
|
|
|
|
|
|
|
namespace TemplatesFunctions
|
|
{
|
|
|
|
|
|
void login_path(Info & i)
|
|
{
|
|
if( config->use_ssl )
|
|
i.out << config->url_ssl_proto;
|
|
else
|
|
i.out << config->url_proto;
|
|
|
|
if( !cur->request->subdomain.empty() )
|
|
i.out << cur->request->subdomain << '.';
|
|
|
|
i.out << config->base_url;
|
|
|
|
if( system->HasReadExecAccessToPath(cur->request->dir_tab) )
|
|
{
|
|
dir(i);
|
|
|
|
if( cur->request->is_item && system->HasReadAccess(cur->request->item) )
|
|
i.out << cur->request->item.url << '/';
|
|
}
|
|
else
|
|
{
|
|
i.out << '/';
|
|
}
|
|
}
|
|
|
|
|
|
void login_cannot_login(Info & i)
|
|
{
|
|
i.res = functions->fun_login.CannotLoginFromCurrentIP();
|
|
}
|
|
|
|
|
|
void login_when_available_login(Info & i)
|
|
{
|
|
if( cur->session->ip_ban &&
|
|
cur->session->ip_ban->expires != 0 )
|
|
{
|
|
PT::Date date(cur->session->ip_ban->expires);
|
|
i.out << date << " UTC";
|
|
}
|
|
else
|
|
{
|
|
i.out << locale.Get(L"unknown");
|
|
}
|
|
}
|
|
|
|
|
|
void login_should_use_captcha(Info & i)
|
|
{
|
|
i.res = functions->fun_login.ShouldUseCaptchaForCurrentIP();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace TemplatesFunctions
|
|
|
|
|