updated to the current pikotools api from branch api2021
This commit is contained in:
@@ -272,7 +272,6 @@ return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool App::Init()
|
||||
{
|
||||
postgresql_connector.set_conn_param(config.db_database, config.db_user, config.db_pass);
|
||||
@@ -283,7 +282,6 @@ bool App::Init()
|
||||
model_connector.set_flat_connector(json_connector);
|
||||
model_connector.set_db_connector(postgresql_connector);
|
||||
model_connector.set_logger(log);
|
||||
//model_connector.set_doc_connector(doc_html_connector);
|
||||
|
||||
// temporary
|
||||
if( config.space.to_bool(L"do_migration_to_winix_fullmorm", false) )
|
||||
@@ -295,30 +293,6 @@ bool App::Init()
|
||||
log << log1 << "Migrations complete, now remove do_migration_to_winix_fullmorm from the config" << logend;
|
||||
std::exit(0);
|
||||
}
|
||||
/////////////
|
||||
|
||||
morm::Finder<User> finder(model_connector);
|
||||
|
||||
User user = finder.
|
||||
select().
|
||||
where().
|
||||
eq(L"id", 1).
|
||||
get();
|
||||
|
||||
|
||||
log << log1 << user << logend;
|
||||
|
||||
|
||||
|
||||
std::exit(0);
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
db_conn.SetConnParam(config.db_database, config.db_user, config.db_pass);
|
||||
db_conn.WaitForConnection();
|
||||
@@ -956,12 +930,12 @@ void App::ReadEnvHTTPVariables()
|
||||
{
|
||||
char * env = *e;
|
||||
|
||||
if( PT::IsSubStringNoCasep("HTTP_", env) )
|
||||
if( PT::is_substr_nc("HTTP_", env) )
|
||||
{
|
||||
env += http_prefix_len;
|
||||
|
||||
// cookies we have in a different table
|
||||
if( !PT::IsSubStringNoCasep("COOKIE=", env) )
|
||||
if( !PT::is_substr_nc("COOKIE=", env) )
|
||||
{
|
||||
if( SaveEnvHTTPVariable(env) )
|
||||
{
|
||||
@@ -991,7 +965,7 @@ bool App::SaveEnvHTTPVariable(const char * env)
|
||||
|
||||
for( ; env[i] != 0 && env[i] != '=' && i < Request::INPUT_HEADER_NAME_MAX_LENGTH ; ++i)
|
||||
{
|
||||
header_name[i] = PT::ToLower(env[i]);
|
||||
header_name[i] = PT::to_lower(env[i]);
|
||||
}
|
||||
|
||||
header_name[i] = 0;
|
||||
@@ -1039,7 +1013,7 @@ void App::ReadEnvRemoteIP()
|
||||
{
|
||||
http_header_name = L"HTTP_";
|
||||
http_header_name += config.proxy_ip_header;
|
||||
PT::ToUpper(http_header_name);
|
||||
PT::to_upper_emplace(http_header_name);
|
||||
|
||||
PT::WideToUTF8(http_header_name, http_header_8bit);
|
||||
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
|
||||
@@ -1065,16 +1039,16 @@ void App::CheckRequestMethod()
|
||||
|
||||
if( !cur.request->env_request_method.empty() )
|
||||
{
|
||||
if( PT::ToLower(cur.request->env_request_method[0]) == 'g' )
|
||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'g' )
|
||||
cur.request->method = Request::get;
|
||||
else
|
||||
if( PT::ToLower(cur.request->env_request_method[0]) == 'p' )
|
||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'p' )
|
||||
cur.request->method = Request::post;
|
||||
else
|
||||
if( PT::ToLower(cur.request->env_request_method[0]) == 'h' )
|
||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'h' )
|
||||
cur.request->method = Request::head;
|
||||
else
|
||||
if( PT::ToLower(cur.request->env_request_method[0]) == 'd' )
|
||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'd' )
|
||||
cur.request->method = Request::delete_;
|
||||
}
|
||||
}
|
||||
@@ -1090,7 +1064,7 @@ void App::CheckSSL()
|
||||
if( config.assume_connection_is_through_ssl )
|
||||
cur.request->using_ssl = true;
|
||||
else
|
||||
if( PT::EqualNoCase(cur.request->env_https.c_str(), L"on") )
|
||||
if( PT::is_equal_nc(cur.request->env_https.c_str(), L"on") )
|
||||
cur.request->using_ssl = true;
|
||||
}
|
||||
|
||||
@@ -1173,13 +1147,13 @@ void App::ReadPostVars()
|
||||
|
||||
if( cur.request->method == Request::post || cur.request->method == Request::delete_ )
|
||||
{
|
||||
if( PT::IsSubStringNoCase(L"multipart/form-data", cur.request->env_content_type.c_str()) )
|
||||
if( PT::is_substr_nc(L"multipart/form-data", cur.request->env_content_type.c_str()) )
|
||||
{
|
||||
log << log3 << "App: post content type: multipart/form-data" << logend;
|
||||
post_multi_parser.Parse(fcgi_request.in, cur.request->post_tab, cur.request->post_file_tab);
|
||||
}
|
||||
else
|
||||
if( PT::IsSubStringNoCase(L"application/json", cur.request->env_content_type.c_str()) )
|
||||
if( PT::is_substr_nc(L"application/json", cur.request->env_content_type.c_str()) )
|
||||
{
|
||||
log << log3 << "App: post content type: application/json" << logend;
|
||||
ReadPostJson();
|
||||
|
@@ -331,7 +331,7 @@ void CorrectUrlOnlyAllowedChar(std::wstring & url)
|
||||
{
|
||||
CorrectUrlDots(url);
|
||||
CorrectUrlChars(url);
|
||||
PT::ToLower(url);
|
||||
PT::to_lower_emplace(url);
|
||||
Trim(url, '_');
|
||||
|
||||
if( url.empty() || url == L"." )
|
||||
@@ -1219,31 +1219,31 @@ int SelectFileType(const wchar_t * file_name)
|
||||
|
||||
// as an image we're using only those types which can be rendered
|
||||
// by a web browser
|
||||
if( PT::EqualNoCase(ext, L"jpg") ||
|
||||
PT::EqualNoCase(ext, L"jpeg") ||
|
||||
PT::EqualNoCase(ext, L"jpe") ||
|
||||
PT::EqualNoCase(ext, L"pic") ||
|
||||
PT::EqualNoCase(ext, L"tga") ||
|
||||
PT::EqualNoCase(ext, L"gif") ||
|
||||
PT::EqualNoCase(ext, L"bmp") ||
|
||||
PT::EqualNoCase(ext, L"png") )
|
||||
if( PT::is_equal_nc(ext, L"jpg") ||
|
||||
PT::is_equal_nc(ext, L"jpeg") ||
|
||||
PT::is_equal_nc(ext, L"jpe") ||
|
||||
PT::is_equal_nc(ext, L"pic") ||
|
||||
PT::is_equal_nc(ext, L"tga") ||
|
||||
PT::is_equal_nc(ext, L"gif") ||
|
||||
PT::is_equal_nc(ext, L"bmp") ||
|
||||
PT::is_equal_nc(ext, L"png") )
|
||||
return WINIX_ITEM_FILETYPE_IMAGE;
|
||||
|
||||
if( PT::EqualNoCase(ext, L"pdf") ||
|
||||
PT::EqualNoCase(ext, L"doc") ||
|
||||
PT::EqualNoCase(ext, L"xls") ||
|
||||
PT::EqualNoCase(ext, L"txt") ||
|
||||
PT::EqualNoCase(ext, L"ods") ||
|
||||
PT::EqualNoCase(ext, L"odt") )
|
||||
if( PT::is_equal_nc(ext, L"pdf") ||
|
||||
PT::is_equal_nc(ext, L"doc") ||
|
||||
PT::is_equal_nc(ext, L"xls") ||
|
||||
PT::is_equal_nc(ext, L"txt") ||
|
||||
PT::is_equal_nc(ext, L"ods") ||
|
||||
PT::is_equal_nc(ext, L"odt") )
|
||||
return WINIX_ITEM_FILETYPE_DOCUMENT;
|
||||
|
||||
if( PT::EqualNoCase(ext, L"avi") ||
|
||||
PT::EqualNoCase(ext, L"mp4") ||
|
||||
PT::EqualNoCase(ext, L"flv") ||
|
||||
PT::EqualNoCase(ext, L"mpg") ||
|
||||
PT::EqualNoCase(ext, L"mpeg") ||
|
||||
PT::EqualNoCase(ext, L"mkv") ||
|
||||
PT::EqualNoCase(ext, L"wmv") )
|
||||
if( PT::is_equal_nc(ext, L"avi") ||
|
||||
PT::is_equal_nc(ext, L"mp4") ||
|
||||
PT::is_equal_nc(ext, L"flv") ||
|
||||
PT::is_equal_nc(ext, L"mpg") ||
|
||||
PT::is_equal_nc(ext, L"mpeg") ||
|
||||
PT::is_equal_nc(ext, L"mkv") ||
|
||||
PT::is_equal_nc(ext, L"wmv") )
|
||||
return WINIX_ITEM_FILETYPE_VIDEO;
|
||||
|
||||
return WINIX_ITEM_FILETYPE_UNKNOWN;
|
||||
|
@@ -420,7 +420,7 @@ size_t i = 0;
|
||||
|
||||
while( i < buf.size() )
|
||||
{
|
||||
if( PT::IsSubString(look_for.c_str(), buf.c_str() + i) )
|
||||
if( PT::is_substr(look_for.c_str(), buf.c_str() + i) )
|
||||
{
|
||||
buf.erase(i, look_for.size());
|
||||
buf.insert(i, replace);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* Copyright (c) 2008-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -382,7 +382,7 @@ void PostMultiParser::ReadContent()
|
||||
|
||||
log << log2 << "PMP: content size: " << content_len << " bytes" << logend;
|
||||
|
||||
if( !PT::IsSubStringNoCase("pass", name.c_str()) )
|
||||
if( !PT::is_substr_nc("pass", name.c_str()) )
|
||||
LogFirst(content, config->log_post_value_size);
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ protected:
|
||||
{
|
||||
log << log2 << "Method POST, name: \"" << name << "\"";
|
||||
|
||||
if( log_value_size > 0 && !PT::IsSubStringNoCase(L"pass", name.c_str()) )
|
||||
if( log_value_size > 0 && !PT::is_substr_nc(L"pass", name.c_str()) )
|
||||
{
|
||||
log << ", value: ";
|
||||
|
||||
|
Reference in New Issue
Block a user