namespace PT renamed to pt
This commit is contained in:
parent
d66a36cf21
commit
e48a28a5c8
|
@ -815,7 +815,7 @@ void App::Make()
|
||||||
|
|
||||||
if( cur.session->ip_ban && cur.session->ip_ban->IsIPBanned() )
|
if( cur.session->ip_ban && cur.session->ip_ban->IsIPBanned() )
|
||||||
{
|
{
|
||||||
PT::Date date(cur.session->ip_ban->expires);
|
pt::Date date(cur.session->ip_ban->expires);
|
||||||
|
|
||||||
// IMPROVE ME there is no slog now
|
// IMPROVE ME there is no slog now
|
||||||
//slog << logerror << T("this_ip_is_banned_until") << ' ' << date << " UTC" << logend;
|
//slog << logerror << T("this_ip_is_banned_until") << ' ' << date << " UTC" << logend;
|
||||||
|
@ -878,7 +878,7 @@ void App::LogEnvironmentHTTPVariables()
|
||||||
{
|
{
|
||||||
if( cur.request->headers_in.is_object() )
|
if( cur.request->headers_in.is_object() )
|
||||||
{
|
{
|
||||||
PT::Space::ObjectType::iterator i = cur.request->headers_in.value.value_object.begin();
|
pt::Space::ObjectType::iterator i = cur.request->headers_in.value.value_object.begin();
|
||||||
|
|
||||||
for( ; i != cur.request->headers_in.value.value_object.end() ; ++i)
|
for( ; i != cur.request->headers_in.value.value_object.end() ; ++i)
|
||||||
{
|
{
|
||||||
|
@ -934,7 +934,7 @@ void App::SetEnv(const char * name, std::wstring & env)
|
||||||
|
|
||||||
if( v )
|
if( v )
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(v, env);
|
pt::UTF8ToWide(v, env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,12 +967,12 @@ void App::ReadEnvHTTPVariables()
|
||||||
{
|
{
|
||||||
char * env = *e;
|
char * env = *e;
|
||||||
|
|
||||||
if( PT::is_substr_nc("HTTP_", env) )
|
if( pt::is_substr_nc("HTTP_", env) )
|
||||||
{
|
{
|
||||||
env += http_prefix_len;
|
env += http_prefix_len;
|
||||||
|
|
||||||
// cookies we have in a different table
|
// cookies we have in a different table
|
||||||
if( !PT::is_substr_nc("COOKIE=", env) )
|
if( !pt::is_substr_nc("COOKIE=", env) )
|
||||||
{
|
{
|
||||||
if( SaveEnvHTTPVariable(env) )
|
if( SaveEnvHTTPVariable(env) )
|
||||||
{
|
{
|
||||||
|
@ -1002,7 +1002,7 @@ bool App::SaveEnvHTTPVariable(const char * env)
|
||||||
|
|
||||||
for( ; env[i] != 0 && env[i] != '=' && i < Request::INPUT_HEADER_NAME_MAX_LENGTH ; ++i)
|
for( ; env[i] != 0 && env[i] != '=' && i < Request::INPUT_HEADER_NAME_MAX_LENGTH ; ++i)
|
||||||
{
|
{
|
||||||
header_name[i] = PT::to_lower(env[i]);
|
header_name[i] = pt::to_lower(env[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
header_name[i] = 0;
|
header_name[i] = 0;
|
||||||
|
@ -1031,8 +1031,8 @@ bool App::SaveEnvHTTPVariable(const char * env)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PT::UTF8ToWide(header_name, http_header_name);
|
pt::UTF8ToWide(header_name, http_header_name);
|
||||||
PT::UTF8ToWide(header_value, http_header_value);
|
pt::UTF8ToWide(header_value, http_header_value);
|
||||||
|
|
||||||
cur.request->headers_in.add(http_header_name, http_header_value);
|
cur.request->headers_in.add(http_header_name, http_header_value);
|
||||||
http_header_name.clear();
|
http_header_name.clear();
|
||||||
|
@ -1050,9 +1050,9 @@ void App::ReadEnvRemoteIP()
|
||||||
{
|
{
|
||||||
http_header_name = L"HTTP_";
|
http_header_name = L"HTTP_";
|
||||||
http_header_name += config.proxy_ip_header;
|
http_header_name += config.proxy_ip_header;
|
||||||
PT::to_upper_emplace(http_header_name);
|
pt::to_upper_emplace(http_header_name);
|
||||||
|
|
||||||
PT::WideToUTF8(http_header_name, http_header_8bit);
|
pt::WideToUTF8(http_header_name, http_header_8bit);
|
||||||
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
|
v = FCGX_GetParam(http_header_8bit.c_str(), fcgi_request.envp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1063,7 +1063,7 @@ void App::ReadEnvRemoteIP()
|
||||||
if( v )
|
if( v )
|
||||||
{
|
{
|
||||||
cur.request->ip = (int)inet_addr(v);
|
cur.request->ip = (int)inet_addr(v);
|
||||||
PT::UTF8ToWide(v, cur.request->ip_str);
|
pt::UTF8ToWide(v, cur.request->ip_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,16 +1076,16 @@ void App::CheckRequestMethod()
|
||||||
|
|
||||||
if( !cur.request->env_request_method.empty() )
|
if( !cur.request->env_request_method.empty() )
|
||||||
{
|
{
|
||||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'g' )
|
if( pt::to_lower(cur.request->env_request_method[0]) == 'g' )
|
||||||
cur.request->method = Request::get;
|
cur.request->method = Request::get;
|
||||||
else
|
else
|
||||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'p' )
|
if( pt::to_lower(cur.request->env_request_method[0]) == 'p' )
|
||||||
cur.request->method = Request::post;
|
cur.request->method = Request::post;
|
||||||
else
|
else
|
||||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'h' )
|
if( pt::to_lower(cur.request->env_request_method[0]) == 'h' )
|
||||||
cur.request->method = Request::head;
|
cur.request->method = Request::head;
|
||||||
else
|
else
|
||||||
if( PT::to_lower(cur.request->env_request_method[0]) == 'd' )
|
if( pt::to_lower(cur.request->env_request_method[0]) == 'd' )
|
||||||
cur.request->method = Request::delete_;
|
cur.request->method = Request::delete_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1101,7 +1101,7 @@ void App::CheckSSL()
|
||||||
if( config.assume_connection_is_through_ssl )
|
if( config.assume_connection_is_through_ssl )
|
||||||
cur.request->using_ssl = true;
|
cur.request->using_ssl = true;
|
||||||
else
|
else
|
||||||
if( PT::is_equal_nc(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;
|
cur.request->using_ssl = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ void App::ReadPostJson()
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// IMPROVE ME
|
// IMPROVE ME
|
||||||
// we can read to PT::TextBuffer and make a PT::JSONToSpaceParser::Parse(PT::TextBuffer &) method
|
// we can read to pt::TextBuffer and make a pt::JSONToSpaceParser::Parse(pt::TextBuffer &) method
|
||||||
read_len = FCGX_GetStr(buffer, buffer_len, fcgi_request.in);
|
read_len = FCGX_GetStr(buffer, buffer_len, fcgi_request.in);
|
||||||
|
|
||||||
if( read_len > 0 )
|
if( read_len > 0 )
|
||||||
|
@ -1155,14 +1155,14 @@ void App::ReadPostJson()
|
||||||
|
|
||||||
if( !post_buffer.empty() )
|
if( !post_buffer.empty() )
|
||||||
{
|
{
|
||||||
PT::SpaceParser::Status status = space_parser.ParseJSON(post_buffer.c_str());
|
pt::SpaceParser::Status status = space_parser.ParseJSON(post_buffer.c_str());
|
||||||
post_buffer.clear();
|
post_buffer.clear();
|
||||||
|
|
||||||
if( status != PT::SpaceParser::ok )
|
if( status != pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
log << log1 << "App: cannot parse the input stream as an JSON object";
|
log << log1 << "App: cannot parse the input stream as an JSON object";
|
||||||
|
|
||||||
if( status == PT::SpaceParser::syntax_error )
|
if( status == pt::SpaceParser::syntax_error )
|
||||||
log << ", syntax error in line: " << space_parser.get_last_parsed_line() << logend;
|
log << ", syntax error in line: " << space_parser.get_last_parsed_line() << logend;
|
||||||
|
|
||||||
cur.request->post_in.clear();
|
cur.request->post_in.clear();
|
||||||
|
@ -1184,13 +1184,13 @@ void App::ReadPostVars()
|
||||||
|
|
||||||
if( cur.request->method == Request::post || cur.request->method == Request::delete_ )
|
if( cur.request->method == Request::post || cur.request->method == Request::delete_ )
|
||||||
{
|
{
|
||||||
if( PT::is_substr_nc(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;
|
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);
|
post_multi_parser.Parse(fcgi_request.in, cur.request->post_tab, cur.request->post_file_tab);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( PT::is_substr_nc(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;
|
log << log3 << "App: post content type: application/json" << logend;
|
||||||
ReadPostJson();
|
ReadPostJson();
|
||||||
|
@ -1246,7 +1246,7 @@ void App::PrepareSessionCookie()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PT::Date expires = cur.request->start_time + config.session_remember_max_idle;
|
pt::Date expires = cur.request->start_time + config.session_remember_max_idle;
|
||||||
cur.request->AddCookie(config.http_session_id_name, cookie_id_string, expires);
|
cur.request->AddCookie(config.http_session_id_name, cookie_id_string, expires);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1277,7 +1277,7 @@ return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool App::AddHeader(const wchar_t * name, const PT::WTextStream & value)
|
bool App::AddHeader(const wchar_t * name, const pt::WTextStream & value)
|
||||||
{
|
{
|
||||||
if( !cur.request->out_headers.has_key(name) )
|
if( !cur.request->out_headers.has_key(name) )
|
||||||
{
|
{
|
||||||
|
@ -1289,7 +1289,7 @@ return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool App::AddHeader(const std::wstring & name, const PT::WTextStream & value)
|
bool App::AddHeader(const std::wstring & name, const pt::WTextStream & value)
|
||||||
{
|
{
|
||||||
if( !cur.request->out_headers.has_key(name) )
|
if( !cur.request->out_headers.has_key(name) )
|
||||||
{
|
{
|
||||||
|
@ -1301,7 +1301,7 @@ return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool App::PrepareHeadersStaticCreateResource(PT::WTextStream & out_path)
|
bool App::PrepareHeadersStaticCreateResource(pt::WTextStream & out_path)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
Item * dir = system.dirs.GetDir(system.mounts.pmount->dir_id);
|
Item * dir = system.dirs.GetDir(system.mounts.pmount->dir_id);
|
||||||
|
@ -1348,7 +1348,7 @@ void App::PrepareHeadersStatic()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PT::WTextStream path;
|
pt::WTextStream path;
|
||||||
path << config.static_dirs[index] << L"/";
|
path << config.static_dirs[index] << L"/";
|
||||||
|
|
||||||
if( !PrepareHeadersStaticCreateResource(path) )
|
if( !PrepareHeadersStaticCreateResource(path) )
|
||||||
|
@ -1470,7 +1470,7 @@ void App::PrepareHeadersNormal(Header header, size_t output_size)
|
||||||
|
|
||||||
if( output_size != static_cast<size_t>(-1) )
|
if( output_size != static_cast<size_t>(-1) )
|
||||||
{
|
{
|
||||||
PT::WTextStream buf;
|
pt::WTextStream buf;
|
||||||
buf << output_size;
|
buf << output_size;
|
||||||
AddHeader(L"Content-Length", buf);
|
AddHeader(L"Content-Length", buf);
|
||||||
}
|
}
|
||||||
|
@ -1483,8 +1483,8 @@ void App::PrepareHeadersNormal(Header header, size_t output_size)
|
||||||
// and if compression is enabled the client's browser will not be able to decompress the stream
|
// and if compression is enabled the client's browser will not be able to decompress the stream
|
||||||
void App::SendHeaders()
|
void App::SendHeaders()
|
||||||
{
|
{
|
||||||
PT::Space::ObjectType::iterator i;
|
pt::Space::ObjectType::iterator i;
|
||||||
PT::Space & headers = cur.request->out_headers;
|
pt::Space & headers = cur.request->out_headers;
|
||||||
|
|
||||||
if( headers.is_object() )
|
if( headers.is_object() )
|
||||||
{
|
{
|
||||||
|
@ -1494,8 +1494,8 @@ void App::SendHeaders()
|
||||||
{
|
{
|
||||||
if( i->second->is_wstr() )
|
if( i->second->is_wstr() )
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(i->first, aheader_name);
|
pt::WideToUTF8(i->first, aheader_name);
|
||||||
PT::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
pt::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
||||||
|
|
||||||
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
||||||
FCGX_PutS(": ", fcgi_request.out);
|
FCGX_PutS(": ", fcgi_request.out);
|
||||||
|
@ -1517,8 +1517,8 @@ void App::SendHeaders()
|
||||||
|
|
||||||
void App::SendCookies()
|
void App::SendCookies()
|
||||||
{
|
{
|
||||||
PT::Space::ObjectType::iterator i;
|
pt::Space::ObjectType::iterator i;
|
||||||
PT::Space & cookies = cur.request->out_cookies;
|
pt::Space & cookies = cur.request->out_cookies;
|
||||||
|
|
||||||
if( cookies.is_object() )
|
if( cookies.is_object() )
|
||||||
{
|
{
|
||||||
|
@ -1528,8 +1528,8 @@ void App::SendCookies()
|
||||||
{
|
{
|
||||||
if( i->second->is_wstr() )
|
if( i->second->is_wstr() )
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(i->first, aheader_name);
|
pt::WideToUTF8(i->first, aheader_name);
|
||||||
PT::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
pt::WideToUTF8(*i->second->get_wstr(), aheader_value);
|
||||||
|
|
||||||
FCGX_PutS("Set-Cookie: ", fcgi_request.out);
|
FCGX_PutS("Set-Cookie: ", fcgi_request.out);
|
||||||
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
FCGX_PutS(aheader_name.c_str(), fcgi_request.out);
|
||||||
|
@ -1582,7 +1582,7 @@ void App::PrepareHeaders(bool compressing, int compress_encoding, Header header,
|
||||||
|
|
||||||
void App::PrepareStandardJSONFields()
|
void App::PrepareStandardJSONFields()
|
||||||
{
|
{
|
||||||
PT::Space & info = cur.request->info;
|
pt::Space & info = cur.request->info;
|
||||||
|
|
||||||
if( !info.has_key(L"status") )
|
if( !info.has_key(L"status") )
|
||||||
{
|
{
|
||||||
|
@ -1788,7 +1788,7 @@ size_t output_size = 0;
|
||||||
|
|
||||||
SelectCompression(source->length(), compressing, compress_encoding);
|
SelectCompression(source->length(), compressing, compress_encoding);
|
||||||
|
|
||||||
PT::WideToUTF8(*source, output_8bit);
|
pt::WideToUTF8(*source, output_8bit);
|
||||||
|
|
||||||
// !! IMPROVE ME add to log the binary stream as well
|
// !! IMPROVE ME add to log the binary stream as well
|
||||||
if( config.log_server_answer )
|
if( config.log_server_answer )
|
||||||
|
@ -2270,7 +2270,7 @@ int sig;
|
||||||
app->synchro.was_stop_signal = true;
|
app->synchro.was_stop_signal = true;
|
||||||
FCGX_ShutdownPending();
|
FCGX_ShutdownPending();
|
||||||
|
|
||||||
PT::WideToUTF8(app->config.fcgi_socket, app->socket_to_send_on_exit);
|
pt::WideToUTF8(app->config.fcgi_socket, app->socket_to_send_on_exit);
|
||||||
app->Unlock();
|
app->Unlock();
|
||||||
|
|
||||||
app->SendEmptyFastCGIPacket();
|
app->SendEmptyFastCGIPacket();
|
||||||
|
|
|
@ -143,7 +143,7 @@ private:
|
||||||
|
|
||||||
PostParser post_parser;
|
PostParser post_parser;
|
||||||
PostMultiParser post_multi_parser;
|
PostMultiParser post_multi_parser;
|
||||||
PT::SpaceParser space_parser;
|
pt::SpaceParser space_parser;
|
||||||
std::string post_buffer;
|
std::string post_buffer;
|
||||||
|
|
||||||
CookieParser cookie_parser;
|
CookieParser cookie_parser;
|
||||||
|
@ -181,7 +181,7 @@ private:
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
// log_buffer for the main thread
|
// log_buffer for the main thread
|
||||||
PT::WTextStream log_buffer;
|
pt::WTextStream log_buffer;
|
||||||
|
|
||||||
// logger only for App object
|
// logger only for App object
|
||||||
Log log;
|
Log log;
|
||||||
|
@ -238,9 +238,9 @@ private:
|
||||||
void SendCookies();
|
void SendCookies();
|
||||||
bool AddHeader(const wchar_t * name, const wchar_t * value);
|
bool AddHeader(const wchar_t * name, const wchar_t * value);
|
||||||
bool AddHeader(const std::wstring & name, const std::wstring & value);
|
bool AddHeader(const std::wstring & name, const std::wstring & value);
|
||||||
bool AddHeader(const wchar_t * name, const PT::WTextStream & value);
|
bool AddHeader(const wchar_t * name, const pt::WTextStream & value);
|
||||||
bool AddHeader(const std::wstring & name, const PT::WTextStream & value);
|
bool AddHeader(const std::wstring & name, const pt::WTextStream & value);
|
||||||
bool PrepareHeadersStaticCreateResource(PT::WTextStream & out_path);
|
bool PrepareHeadersStaticCreateResource(pt::WTextStream & out_path);
|
||||||
void PrepareHeadersStatic();
|
void PrepareHeadersStatic();
|
||||||
void PrepareHeaderContentType();
|
void PrepareHeaderContentType();
|
||||||
void PrepareHeadersForbidden();
|
void PrepareHeadersForbidden();
|
||||||
|
|
|
@ -54,13 +54,13 @@ BaseThread::~BaseThread()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BaseThread::set_main_log_buffer(PT::WTextStream * log_buffer)
|
void BaseThread::set_main_log_buffer(pt::WTextStream * log_buffer)
|
||||||
{
|
{
|
||||||
main_log.SetLogBuffer(log_buffer);
|
main_log.SetLogBuffer(log_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BaseThread::set_main_file_log(PT::FileLog * file_log)
|
void BaseThread::set_main_file_log(pt::FileLog * file_log)
|
||||||
{
|
{
|
||||||
main_log.SetFileLog(file_log);
|
main_log.SetFileLog(file_log);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ public:
|
||||||
BaseThread();
|
BaseThread();
|
||||||
virtual ~BaseThread();
|
virtual ~BaseThread();
|
||||||
|
|
||||||
void set_main_log_buffer(PT::WTextStream * log_buffer);
|
void set_main_log_buffer(pt::WTextStream * log_buffer);
|
||||||
void set_main_file_log(PT::FileLog * file_log);
|
void set_main_file_log(pt::FileLog * file_log);
|
||||||
|
|
||||||
|
|
||||||
// work mode
|
// work mode
|
||||||
|
|
|
@ -55,7 +55,7 @@ void Config::SetFileLog(FileLog * file_log)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Config::SetLogBuffer(PT::WTextStream * log_buffer)
|
void Config::SetLogBuffer(pt::WTextStream * log_buffer)
|
||||||
{
|
{
|
||||||
log.SetLogBuffer(log_buffer);
|
log.SetLogBuffer(log_buffer);
|
||||||
}
|
}
|
||||||
|
@ -66,22 +66,22 @@ void Config::ShowError()
|
||||||
|
|
||||||
switch( parser.status )
|
switch( parser.status )
|
||||||
{
|
{
|
||||||
case PT::SpaceParser::no_space:
|
case pt::SpaceParser::no_space:
|
||||||
log << log2 << "Config: space not set" << logend;
|
log << log2 << "Config: space not set" << logend;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PT::SpaceParser::ok:
|
case pt::SpaceParser::ok:
|
||||||
log << log2 << "Config: syntax ok" << logend;
|
log << log2 << "Config: syntax ok" << logend;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PT::SpaceParser::cant_open_file:
|
case pt::SpaceParser::cant_open_file:
|
||||||
if( errors_to_stdout )
|
if( errors_to_stdout )
|
||||||
std::wcout << L"Config: I cannot open a config file: " << config_file << std::endl;
|
std::wcout << L"Config: I cannot open a config file: " << config_file << std::endl;
|
||||||
|
|
||||||
log << log1 << "Config: cant open a config file: " << config_file << logend;
|
log << log1 << "Config: cant open a config file: " << config_file << logend;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PT::SpaceParser::syntax_error:
|
case pt::SpaceParser::syntax_error:
|
||||||
if( errors_to_stdout )
|
if( errors_to_stdout )
|
||||||
std::wcout << "Config: syntax error, line: " << parser.get_last_parsed_line() << std::endl;
|
std::wcout << "Config: syntax error, line: " << parser.get_last_parsed_line() << std::endl;
|
||||||
|
|
||||||
|
@ -108,9 +108,9 @@ bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
|
||||||
log << log2 << "Config: reading a config file" << logend;
|
log << log2 << "Config: reading a config file" << logend;
|
||||||
|
|
||||||
parser.SetSpace(space);
|
parser.SetSpace(space);
|
||||||
PT::SpaceParser::Status status = parser.ParseSpaceFile(config_file);
|
pt::SpaceParser::Status status = parser.ParseSpaceFile(config_file);
|
||||||
|
|
||||||
if( status == PT::SpaceParser::ok )
|
if( status == pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
AssignValues(stdout_is_closed);
|
AssignValues(stdout_is_closed);
|
||||||
SetAdditionalVariables();
|
SetAdditionalVariables();
|
||||||
|
|
|
@ -817,16 +817,16 @@ public:
|
||||||
//void Print(std::wostream & out);
|
//void Print(std::wostream & out);
|
||||||
|
|
||||||
// raw access to the config
|
// raw access to the config
|
||||||
PT::Space space;
|
pt::Space space;
|
||||||
|
|
||||||
|
|
||||||
void SetFileLog(FileLog * file_log);
|
void SetFileLog(FileLog * file_log);
|
||||||
void SetLogBuffer(PT::WTextStream * log_buffer);
|
void SetLogBuffer(pt::WTextStream * log_buffer);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
PT::SpaceParser parser;
|
pt::SpaceParser parser;
|
||||||
bool errors_to_stdout;
|
bool errors_to_stdout;
|
||||||
Log log;
|
Log log;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ bool Crypt::HashBin(int hash, const char * in, size_t inlen, std::string & out)
|
||||||
|
|
||||||
run.Clear();
|
run.Clear();
|
||||||
run.set_dependency(this);
|
run.set_dependency(this);
|
||||||
PT::WideToUTF8(config->opensll_path, command);
|
pt::WideToUTF8(config->opensll_path, command);
|
||||||
run.Cmd(command);
|
run.Cmd(command);
|
||||||
run.Par("dgst");
|
run.Par("dgst");
|
||||||
run.Par("-binary");
|
run.Par("-binary");
|
||||||
|
@ -119,7 +119,7 @@ bool Crypt::HashBin(int hash, const std::string & in, std::string & out)
|
||||||
|
|
||||||
bool Crypt::HashBin(int hash, const wchar_t * in, size_t inlen, std::string & out)
|
bool Crypt::HashBin(int hash, const wchar_t * in, size_t inlen, std::string & out)
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(in, inlen, bufina);
|
pt::WideToUTF8(in, inlen, bufina);
|
||||||
int res = HashBin(hash, bufina.c_str(), bufina.size(), out);
|
int res = HashBin(hash, bufina.c_str(), bufina.size(), out);
|
||||||
bufina.clear();
|
bufina.clear();
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ bool Crypt::RSA(bool encrypt, const char * keypath, const char * in, size_t inle
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
run.Clear();
|
run.Clear();
|
||||||
PT::WideToUTF8(config->opensll_path, command);
|
pt::WideToUTF8(config->opensll_path, command);
|
||||||
run.Cmd(command);
|
run.Cmd(command);
|
||||||
|
|
||||||
run.Par("rsautl");
|
run.Par("rsautl");
|
||||||
|
@ -243,7 +243,7 @@ bool Crypt::RSA(bool encrypt, const std::string & keypath, const std::string & i
|
||||||
|
|
||||||
bool Crypt::RSA(bool encrypt, const wchar_t * keypath, const char * in, size_t inlen, std::string & out)
|
bool Crypt::RSA(bool encrypt, const wchar_t * keypath, const char * in, size_t inlen, std::string & out)
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(keypath, keypatha);
|
pt::WideToUTF8(keypath, keypatha);
|
||||||
return RSA(encrypt, keypatha.c_str(), in, inlen, out);
|
return RSA(encrypt, keypatha.c_str(), in, inlen, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ bool Crypt::PassCrypt(const std::wstring & path_to_rsa_private_key, User & user)
|
||||||
|
|
||||||
if( !path_to_rsa_private_key.empty() )
|
if( !path_to_rsa_private_key.empty() )
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(user.password, passa);
|
pt::WideToUTF8(user.password, passa);
|
||||||
|
|
||||||
if( RSA(true, path_to_rsa_private_key, passa, user.pass_encrypted) )
|
if( RSA(true, path_to_rsa_private_key, passa, user.pass_encrypted) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,7 @@ void FileLog::set_synchro(Synchro * synchro)
|
||||||
|
|
||||||
void FileLog::init(const std::wstring & log_file, bool log_stdout, int log_level, bool save_each_line, size_t log_time_zone_id)
|
void FileLog::init(const std::wstring & log_file, bool log_stdout, int log_level, bool save_each_line, size_t log_time_zone_id)
|
||||||
{
|
{
|
||||||
PT::FileLog::init(log_file, log_stdout, log_level, save_each_line);
|
pt::FileLog::init(log_file, log_stdout, log_level, save_each_line);
|
||||||
this->log_time_zone_id = log_time_zone_id;
|
this->log_time_zone_id = log_time_zone_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ bool FileLog::should_save_each_line()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::Date FileLog::get_local_date(const PT::Date & date)
|
pt::Date FileLog::get_local_date(const pt::Date & date)
|
||||||
{
|
{
|
||||||
if( time_zones )
|
if( time_zones )
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ PT::Date FileLog::get_local_date(const PT::Date & date)
|
||||||
|
|
||||||
if( tz )
|
if( tz )
|
||||||
{
|
{
|
||||||
PT::Date local_date = tz->ToLocal(date);
|
pt::Date local_date = tz->ToLocal(date);
|
||||||
return local_date;
|
return local_date;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace Winix
|
||||||
class TimeZones;
|
class TimeZones;
|
||||||
|
|
||||||
|
|
||||||
class FileLog : public PT::FileLog
|
class FileLog : public pt::FileLog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -58,14 +58,14 @@ public:
|
||||||
|
|
||||||
void set_synchro(Synchro * synchro);
|
void set_synchro(Synchro * synchro);
|
||||||
|
|
||||||
// using PT::FileLog::init to suppress clang warning:
|
// using pt::FileLog::init to suppress clang warning:
|
||||||
// warning: 'Winix::FileLog::init' hides overloaded virtual function [-Woverloaded-virtual]
|
// warning: 'Winix::FileLog::init' hides overloaded virtual function [-Woverloaded-virtual]
|
||||||
using PT::FileLog::init;
|
using pt::FileLog::init;
|
||||||
|
|
||||||
void init(const std::wstring & log_file, bool log_stdout, int log_level, bool save_each_line, size_t log_time_zone_id);
|
void init(const std::wstring & log_file, bool log_stdout, int log_level, bool save_each_line, size_t log_time_zone_id);
|
||||||
|
|
||||||
void set_time_zones(TimeZones * time_zones);
|
void set_time_zones(TimeZones * time_zones);
|
||||||
PT::Date get_local_date(const PT::Date & date);
|
pt::Date get_local_date(const pt::Date & date);
|
||||||
|
|
||||||
int get_log_level();
|
int get_log_level();
|
||||||
bool should_save_each_line();
|
bool should_save_each_line();
|
||||||
|
|
|
@ -143,7 +143,7 @@ void HttpSimpleParser::ReadName()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( getchar_returns_utf8_chars )
|
if( getchar_returns_utf8_chars )
|
||||||
PT::UTF8ToWide(utf8_token, last_name);
|
pt::UTF8ToWide(utf8_token, last_name);
|
||||||
|
|
||||||
if( last_c == '=' )
|
if( last_c == '=' )
|
||||||
last_c = GetChar();
|
last_c = GetChar();
|
||||||
|
@ -173,7 +173,7 @@ void HttpSimpleParser::ReadQuotedValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( getchar_returns_utf8_chars )
|
if( getchar_returns_utf8_chars )
|
||||||
PT::UTF8ToWide(utf8_token, last_value);
|
pt::UTF8ToWide(utf8_token, last_value);
|
||||||
|
|
||||||
if( last_c == '"' )
|
if( last_c == '"' )
|
||||||
last_c = GetChar();
|
last_c = GetChar();
|
||||||
|
@ -204,7 +204,7 @@ void HttpSimpleParser::ReadNormalValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( getchar_returns_utf8_chars )
|
if( getchar_returns_utf8_chars )
|
||||||
PT::UTF8ToWide(utf8_token, last_value);
|
pt::UTF8ToWide(utf8_token, last_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ bool end;
|
||||||
|
|
||||||
void Image::Add(const std::wstring & in, TextStream<std::string> & out)
|
void Image::Add(const std::wstring & in, TextStream<std::string> & out)
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(in, add_tempa);
|
pt::WideToUTF8(in, add_tempa);
|
||||||
out << add_tempa;
|
out << add_tempa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ bool Image::CreateInputFileName()
|
||||||
|
|
||||||
if( system->MakeFilePath(file_work, src_path, thumb) )
|
if( system->MakeFilePath(file_work, src_path, thumb) )
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(src_path, input_file_name);
|
pt::WideToUTF8(src_path, input_file_name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -404,7 +404,7 @@ void Image::CreateTmpFileName()
|
||||||
{
|
{
|
||||||
stream_tmp_path.Clear();
|
stream_tmp_path.Clear();
|
||||||
stream_tmp_path << config->upload_dir << L"/tmp/image_" << std::time(0);
|
stream_tmp_path << config->upload_dir << L"/tmp/image_" << std::time(0);
|
||||||
PT::WideToUTF8(stream_tmp_path.Str(), tmp_file_name);
|
pt::WideToUTF8(stream_tmp_path.Str(), tmp_file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -612,8 +612,8 @@ void Image::CreateImage()
|
||||||
|
|
||||||
void Image::CreateThumbnail()
|
void Image::CreateThumbnail()
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(item_work.source, sourcea);
|
pt::WideToUTF8(item_work.source, sourcea);
|
||||||
PT::WideToUTF8(item_work.dst, dsta);
|
pt::WideToUTF8(item_work.dst, dsta);
|
||||||
|
|
||||||
MagickWandGenesis();
|
MagickWandGenesis();
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ void IPBanContainer::PrintTab()
|
||||||
{
|
{
|
||||||
log << log4 << i << ": ip: " << ipban_tab[i].ip << ", flags: " << ipban_tab[i].flags << ", last_used: ";
|
log << log4 << i << ": ip: " << ipban_tab[i].ip << ", flags: " << ipban_tab[i].flags << ", last_used: ";
|
||||||
|
|
||||||
PT::Date date(ipban_tab[i].last_used);
|
pt::Date date(ipban_tab[i].last_used);
|
||||||
log << date << ", expires: ";
|
log << date << ", expires: ";
|
||||||
|
|
||||||
date = ipban_tab[i].expires;
|
date = ipban_tab[i].expires;
|
||||||
|
@ -168,7 +168,7 @@ void IPBanContainer::PrintTab2()
|
||||||
|
|
||||||
log << log4 << i << ": ip: " << ipban.ip << ", flags: " << ipban.flags << ", last_used: ";
|
log << log4 << i << ": ip: " << ipban.ip << ", flags: " << ipban.flags << ", last_used: ";
|
||||||
|
|
||||||
PT::Date date(ipban.last_used);
|
pt::Date date(ipban.last_used);
|
||||||
log << date << ", expires: ";
|
log << date << ", expires: ";
|
||||||
|
|
||||||
date = ipban.expires;
|
date = ipban.expires;
|
||||||
|
|
|
@ -60,7 +60,7 @@ void Job::CheckPriority(int & priority) const
|
||||||
|
|
||||||
|
|
||||||
// first thread (objects locked)
|
// first thread (objects locked)
|
||||||
void Job::Add(PT::Space & job, int priority)
|
void Job::Add(pt::Space & job, int priority)
|
||||||
{
|
{
|
||||||
CheckPriority(priority);
|
CheckPriority(priority);
|
||||||
jobs_queue_tab[priority].push(job);
|
jobs_queue_tab[priority].push(job);
|
||||||
|
@ -150,7 +150,7 @@ bool is_empty;
|
||||||
Lock();
|
Lock();
|
||||||
// references will not be invalidated after insertion to jobs_queue
|
// references will not be invalidated after insertion to jobs_queue
|
||||||
// (jobs_queue is std::queue and it uses std::deque by default)
|
// (jobs_queue is std::queue and it uses std::deque by default)
|
||||||
PT::Space & job = jobs_queue.front();
|
pt::Space & job = jobs_queue.front();
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
DoJob(job);
|
DoJob(job);
|
||||||
|
@ -165,7 +165,7 @@ bool is_empty;
|
||||||
|
|
||||||
|
|
||||||
// second thread (objects not locked)
|
// second thread (objects not locked)
|
||||||
void Job::DoJob(PT::Space & job)
|
void Job::DoJob(pt::Space & job)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ void Job::DoJob(PT::Space & job)
|
||||||
|
|
||||||
|
|
||||||
// second thread (objects not locked)
|
// second thread (objects not locked)
|
||||||
void Job::DoWinixJob(PT::Space & job)
|
void Job::DoWinixJob(pt::Space & job)
|
||||||
{
|
{
|
||||||
//log << log1 << "standard winix job: " << job.Text(L"type") << logend;
|
//log << log1 << "standard winix job: " << job.Text(L"type") << logend;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
add a new job to the queue
|
add a new job to the queue
|
||||||
priority: 0-31 (0 - the lowest priority, 31 - the highest priority)
|
priority: 0-31 (0 - the lowest priority, 31 - the highest priority)
|
||||||
*/
|
*/
|
||||||
void Add(PT::Space & job, int priority = 0);
|
void Add(pt::Space & job, int priority = 0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::queue<PT::Space> JobsQueue;
|
typedef std::queue<pt::Space> JobsQueue;
|
||||||
typedef std::vector<JobsQueue> JobsQueueTab;
|
typedef std::vector<JobsQueue> JobsQueueTab;
|
||||||
JobsQueueTab jobs_queue_tab;
|
JobsQueueTab jobs_queue_tab;
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ private:
|
||||||
bool SignalReceived();
|
bool SignalReceived();
|
||||||
void Do();
|
void Do();
|
||||||
void DoQueue(JobsQueue & jobs_queue);
|
void DoQueue(JobsQueue & jobs_queue);
|
||||||
void DoJob(PT::Space & job);
|
void DoJob(pt::Space & job);
|
||||||
void DoWinixJob(PT::Space & job);
|
void DoWinixJob(pt::Space & job);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,8 @@ struct LastItem
|
||||||
long session_id;
|
long session_id;
|
||||||
|
|
||||||
// start logging and end logging
|
// start logging and end logging
|
||||||
PT::Date start;
|
pt::Date start;
|
||||||
PT::Date end;
|
pt::Date end;
|
||||||
|
|
||||||
|
|
||||||
LastItem();
|
LastItem();
|
||||||
|
|
|
@ -72,7 +72,7 @@ void Log::SetMaxRequests(int max_requests)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Log::PrintDate(const PT::Date & date)
|
void Log::PrintDate(const pt::Date & date)
|
||||||
{
|
{
|
||||||
FileLog * winix_file_log = dynamic_cast<FileLog*>(file_log);
|
FileLog * winix_file_log = dynamic_cast<FileLog*>(file_log);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void Log::PrintDate(const PT::Date & date)
|
||||||
|
|
||||||
Log & Log::operator<<(const void * s)
|
Log & Log::operator<<(const void * s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ Log & Log::operator<<(const void * s)
|
||||||
|
|
||||||
Log & Log::operator<<(const char * s)
|
Log & Log::operator<<(const char * s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ Log & Log::operator<<(const char * s)
|
||||||
|
|
||||||
Log & Log::operator<<(const std::string & s)
|
Log & Log::operator<<(const std::string & s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ Log & Log::operator<<(const std::string & s)
|
||||||
|
|
||||||
Log & Log::operator<<(const std::string * s)
|
Log & Log::operator<<(const std::string * s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ Log & Log::operator<<(const std::string * s)
|
||||||
|
|
||||||
Log & Log::operator<<(const wchar_t * s)
|
Log & Log::operator<<(const wchar_t * s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ Log & Log::operator<<(const wchar_t * s)
|
||||||
|
|
||||||
Log & Log::operator<<(const std::wstring & s)
|
Log & Log::operator<<(const std::wstring & s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ Log & Log::operator<<(const std::wstring & s)
|
||||||
|
|
||||||
Log & Log::operator<<(const std::wstring * s)
|
Log & Log::operator<<(const std::wstring * s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ Log & Log::operator<<(const std::wstring * s)
|
||||||
|
|
||||||
Log & Log::operator<<(int s)
|
Log & Log::operator<<(int s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ Log & Log::operator<<(int s)
|
||||||
|
|
||||||
Log & Log::operator<<(long s)
|
Log & Log::operator<<(long s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,21 +162,21 @@ Log & Log::operator<<(long s)
|
||||||
|
|
||||||
Log & Log::operator<<(char s)
|
Log & Log::operator<<(char s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(wchar_t s)
|
Log & Log::operator<<(wchar_t s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(size_t s)
|
Log & Log::operator<<(size_t s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,30 +184,30 @@ Log & Log::operator<<(size_t s)
|
||||||
|
|
||||||
Log & Log::operator<<(double s)
|
Log & Log::operator<<(double s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const PT::Space & s)
|
Log & Log::operator<<(const pt::Space & s)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(s);
|
pt::Log::operator<<(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const PT::Date & date)
|
Log & Log::operator<<(const pt::Date & date)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(date);
|
pt::Log::operator<<(date);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(morm::Model & model)
|
Log & Log::operator<<(morm::Model & model)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(model);
|
pt::Log::operator<<(model);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,27 +217,27 @@ Log & Log::operator<<(LogManipulators m)
|
||||||
switch(m)
|
switch(m)
|
||||||
{
|
{
|
||||||
case LogManipulators::log1:
|
case LogManipulators::log1:
|
||||||
PT::Log::operator<<(PT::Log::log1);
|
pt::Log::operator<<(pt::Log::log1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LogManipulators::log2:
|
case LogManipulators::log2:
|
||||||
PT::Log::operator<<(PT::Log::log2);
|
pt::Log::operator<<(pt::Log::log2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LogManipulators::log3:
|
case LogManipulators::log3:
|
||||||
PT::Log::operator<<(PT::Log::log3);
|
pt::Log::operator<<(pt::Log::log3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LogManipulators::log4:
|
case LogManipulators::log4:
|
||||||
PT::Log::operator<<(PT::Log::log4);
|
pt::Log::operator<<(pt::Log::log4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LogManipulators::logend:
|
case LogManipulators::logend:
|
||||||
PT::Log::operator<<(PT::Log::logend);
|
pt::Log::operator<<(pt::Log::logend);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LogManipulators::logsave:
|
case LogManipulators::logsave:
|
||||||
PT::Log::operator<<(PT::Log::logsave);
|
pt::Log::operator<<(pt::Log::logsave);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LogManipulators::logendrequest:
|
case LogManipulators::logendrequest:
|
||||||
|
@ -274,27 +274,27 @@ return *this;
|
||||||
|
|
||||||
Log & Log::LogString(const std::string & value, size_t max_size)
|
Log & Log::LogString(const std::string & value, size_t max_size)
|
||||||
{
|
{
|
||||||
PT::Log::LogString(value, max_size);
|
pt::Log::LogString(value, max_size);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Log & Log::LogString(const std::wstring & value, size_t max_size)
|
Log & Log::LogString(const std::wstring & value, size_t max_size)
|
||||||
{
|
{
|
||||||
PT::Log::LogString(value, max_size);
|
pt::Log::LogString(value, max_size);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Log & Log::LogBinary(const char * blob, size_t blob_len)
|
Log & Log::LogBinary(const char * blob, size_t blob_len)
|
||||||
{
|
{
|
||||||
PT::Log::LogBinary(blob, blob_len);
|
pt::Log::LogBinary(blob, blob_len);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log & Log::LogBinary(const std::string & blob)
|
Log & Log::LogBinary(const std::string & blob)
|
||||||
{
|
{
|
||||||
PT::Log::LogBinary(blob);
|
pt::Log::LogBinary(blob);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace Winix
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Log : public PT::Log
|
class Log : public pt::Log
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -75,15 +75,15 @@ public:
|
||||||
virtual Log & operator<<(wchar_t s);
|
virtual Log & operator<<(wchar_t s);
|
||||||
virtual Log & operator<<(size_t s);
|
virtual Log & operator<<(size_t s);
|
||||||
virtual Log & operator<<(double s);
|
virtual Log & operator<<(double s);
|
||||||
virtual Log & operator<<(const PT::Space & space);
|
virtual Log & operator<<(const pt::Space & space);
|
||||||
virtual Log & operator<<(LogManipulators m);
|
virtual Log & operator<<(LogManipulators m);
|
||||||
virtual Log & operator<<(const PT::Date & date);
|
virtual Log & operator<<(const pt::Date & date);
|
||||||
virtual Log & operator<<(morm::Model & model);
|
virtual Log & operator<<(morm::Model & model);
|
||||||
|
|
||||||
virtual void PrintDate(const PT::Date & date);
|
virtual void PrintDate(const pt::Date & date);
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
Log & operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
Log & operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
||||||
|
|
||||||
|
|
||||||
virtual Log & LogString(const std::string & value, size_t max_size);
|
virtual Log & LogString(const std::string & value, size_t max_size);
|
||||||
|
@ -112,9 +112,9 @@ private:
|
||||||
|
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
Log & Log::operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
Log & Log::operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
||||||
{
|
{
|
||||||
PT::Log::operator<<(buf);
|
pt::Log::operator<<(buf);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace misc_private
|
||||||
0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028,
|
0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028,
|
||||||
0x2029, 0x202F, 0x205F, 0x3000 };
|
0x2029, 0x202F, 0x205F, 0x3000 };
|
||||||
|
|
||||||
PT::WTextStream tmp_qencode;
|
pt::WTextStream tmp_qencode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ void CorrectUrlOnlyAllowedChar(std::wstring & url)
|
||||||
{
|
{
|
||||||
CorrectUrlDots(url);
|
CorrectUrlDots(url);
|
||||||
CorrectUrlChars(url);
|
CorrectUrlChars(url);
|
||||||
PT::to_lower_emplace(url);
|
pt::to_lower_emplace(url);
|
||||||
Trim(url, '_');
|
Trim(url, '_');
|
||||||
|
|
||||||
if( url.empty() || url == L"." )
|
if( url.empty() || url == L"." )
|
||||||
|
@ -408,7 +408,7 @@ static wchar_t buffer[100];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const wchar_t * DateToStr(const PT::Date & d)
|
const wchar_t * DateToStr(const pt::Date & d)
|
||||||
{
|
{
|
||||||
return DateToStr(d.year, d.month, d.day, d.hour, d.min, d.sec);
|
return DateToStr(d.year, d.month, d.day, d.hour, d.min, d.sec);
|
||||||
}
|
}
|
||||||
|
@ -416,14 +416,14 @@ const wchar_t * DateToStr(const PT::Date & d)
|
||||||
|
|
||||||
const wchar_t * DateToStr(time_t t)
|
const wchar_t * DateToStr(time_t t)
|
||||||
{
|
{
|
||||||
PT::Date date = t;
|
pt::Date date = t;
|
||||||
|
|
||||||
return DateToStr(date);
|
return DateToStr(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const wchar_t * DateToStrWithoutHours(const PT::Date & d)
|
const wchar_t * DateToStrWithoutHours(const pt::Date & d)
|
||||||
{
|
{
|
||||||
return DateToStr(d.year, d.month, d.day);
|
return DateToStr(d.year, d.month, d.day);
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ const wchar_t * DateToStrWithoutHours(const PT::Date & d)
|
||||||
|
|
||||||
const wchar_t * DateToStrWithoutHours(time_t t)
|
const wchar_t * DateToStrWithoutHours(time_t t)
|
||||||
{
|
{
|
||||||
PT::Date date = t;
|
pt::Date date = t;
|
||||||
|
|
||||||
return DateToStrWithoutHours(date);
|
return DateToStrWithoutHours(date);
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ return buffer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char * DateToStrCookie(const PT::Date & d)
|
const char * DateToStrCookie(const pt::Date & d)
|
||||||
{
|
{
|
||||||
return DateToStrCookie(d.year, d.month, d.day, d.hour, d.min, d.sec);
|
return DateToStrCookie(d.year, d.month, d.day, d.hour, d.min, d.sec);
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ const char * DateToStrCookie(const PT::Date & d)
|
||||||
|
|
||||||
const char * DateToStrCookie(time_t t)
|
const char * DateToStrCookie(time_t t)
|
||||||
{
|
{
|
||||||
PT::Date date = t;
|
pt::Date date = t;
|
||||||
|
|
||||||
return DateToStrCookie(date);
|
return DateToStrCookie(date);
|
||||||
}
|
}
|
||||||
|
@ -493,9 +493,9 @@ return buffer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::WTextStream IPToStr(unsigned int ip)
|
pt::WTextStream IPToStr(unsigned int ip)
|
||||||
{
|
{
|
||||||
PT::WTextStream buf;
|
pt::WTextStream buf;
|
||||||
|
|
||||||
for(int i=0 ; i<4 ; ++i, ip >>= 8)
|
for(int i=0 ; i<4 ; ++i, ip >>= 8)
|
||||||
{
|
{
|
||||||
|
@ -509,7 +509,7 @@ return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PT::WTextStream IPToStr(int ip)
|
pt::WTextStream IPToStr(int ip)
|
||||||
{
|
{
|
||||||
return IPToStr(static_cast<unsigned int>(ip));
|
return IPToStr(static_cast<unsigned int>(ip));
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1148,7 @@ std::ifstream get_file_content;
|
||||||
/*
|
/*
|
||||||
* we don't report any errors when converting from UTF8 to wide characters here
|
* we don't report any errors when converting from UTF8 to wide characters here
|
||||||
*/
|
*/
|
||||||
PT::UTF8ToWide(get_file_content, content);
|
pt::UTF8ToWide(get_file_content, content);
|
||||||
get_file_content.close();
|
get_file_content.close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1219,31 +1219,31 @@ int SelectFileType(const wchar_t * file_name)
|
||||||
|
|
||||||
// as an image we're using only those types which can be rendered
|
// as an image we're using only those types which can be rendered
|
||||||
// by a web browser
|
// by a web browser
|
||||||
if( PT::is_equal_nc(ext, L"jpg") ||
|
if( pt::is_equal_nc(ext, L"jpg") ||
|
||||||
PT::is_equal_nc(ext, L"jpeg") ||
|
pt::is_equal_nc(ext, L"jpeg") ||
|
||||||
PT::is_equal_nc(ext, L"jpe") ||
|
pt::is_equal_nc(ext, L"jpe") ||
|
||||||
PT::is_equal_nc(ext, L"pic") ||
|
pt::is_equal_nc(ext, L"pic") ||
|
||||||
PT::is_equal_nc(ext, L"tga") ||
|
pt::is_equal_nc(ext, L"tga") ||
|
||||||
PT::is_equal_nc(ext, L"gif") ||
|
pt::is_equal_nc(ext, L"gif") ||
|
||||||
PT::is_equal_nc(ext, L"bmp") ||
|
pt::is_equal_nc(ext, L"bmp") ||
|
||||||
PT::is_equal_nc(ext, L"png") )
|
pt::is_equal_nc(ext, L"png") )
|
||||||
return WINIX_ITEM_FILETYPE_IMAGE;
|
return WINIX_ITEM_FILETYPE_IMAGE;
|
||||||
|
|
||||||
if( PT::is_equal_nc(ext, L"pdf") ||
|
if( pt::is_equal_nc(ext, L"pdf") ||
|
||||||
PT::is_equal_nc(ext, L"doc") ||
|
pt::is_equal_nc(ext, L"doc") ||
|
||||||
PT::is_equal_nc(ext, L"xls") ||
|
pt::is_equal_nc(ext, L"xls") ||
|
||||||
PT::is_equal_nc(ext, L"txt") ||
|
pt::is_equal_nc(ext, L"txt") ||
|
||||||
PT::is_equal_nc(ext, L"ods") ||
|
pt::is_equal_nc(ext, L"ods") ||
|
||||||
PT::is_equal_nc(ext, L"odt") )
|
pt::is_equal_nc(ext, L"odt") )
|
||||||
return WINIX_ITEM_FILETYPE_DOCUMENT;
|
return WINIX_ITEM_FILETYPE_DOCUMENT;
|
||||||
|
|
||||||
if( PT::is_equal_nc(ext, L"avi") ||
|
if( pt::is_equal_nc(ext, L"avi") ||
|
||||||
PT::is_equal_nc(ext, L"mp4") ||
|
pt::is_equal_nc(ext, L"mp4") ||
|
||||||
PT::is_equal_nc(ext, L"flv") ||
|
pt::is_equal_nc(ext, L"flv") ||
|
||||||
PT::is_equal_nc(ext, L"mpg") ||
|
pt::is_equal_nc(ext, L"mpg") ||
|
||||||
PT::is_equal_nc(ext, L"mpeg") ||
|
pt::is_equal_nc(ext, L"mpeg") ||
|
||||||
PT::is_equal_nc(ext, L"mkv") ||
|
pt::is_equal_nc(ext, L"mkv") ||
|
||||||
PT::is_equal_nc(ext, L"wmv") )
|
pt::is_equal_nc(ext, L"wmv") )
|
||||||
return WINIX_ITEM_FILETYPE_VIDEO;
|
return WINIX_ITEM_FILETYPE_VIDEO;
|
||||||
|
|
||||||
return WINIX_ITEM_FILETYPE_UNKNOWN;
|
return WINIX_ITEM_FILETYPE_UNKNOWN;
|
||||||
|
@ -1280,7 +1280,7 @@ void UrlEncode(const wchar_t * in, std::string & out, bool clear_out)
|
||||||
{
|
{
|
||||||
static std::string ain;
|
static std::string ain;
|
||||||
|
|
||||||
PT::WideToUTF8(in, ain);
|
pt::WideToUTF8(in, ain);
|
||||||
|
|
||||||
if( clear_out )
|
if( clear_out )
|
||||||
out.clear();
|
out.clear();
|
||||||
|
@ -1301,7 +1301,7 @@ void UrlEncode(const wchar_t * in, std::wstring & out, bool clear_out)
|
||||||
{
|
{
|
||||||
static std::string ain;
|
static std::string ain;
|
||||||
|
|
||||||
PT::WideToUTF8(in, ain);
|
pt::WideToUTF8(in, ain);
|
||||||
|
|
||||||
if( clear_out )
|
if( clear_out )
|
||||||
out.clear();
|
out.clear();
|
||||||
|
@ -1372,7 +1372,7 @@ int c1, c2;
|
||||||
|
|
||||||
url_utf8[index] = 0;
|
url_utf8[index] = 0;
|
||||||
|
|
||||||
return PT::UTF8ToWide(url_utf8, out, false);
|
return pt::UTF8ToWide(url_utf8, out, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1418,7 +1418,7 @@ void RemovePostFileTmp(PostFileTab & post_file_tab)
|
||||||
|
|
||||||
bool WideToUTF8(const wchar_t * wide_string, char * utf8, size_t utf8_size)
|
bool WideToUTF8(const wchar_t * wide_string, char * utf8, size_t utf8_size)
|
||||||
{
|
{
|
||||||
bool res = PT::WideToUTF8(wide_string, utf8, utf8_size);
|
bool res = pt::WideToUTF8(wide_string, utf8, utf8_size);
|
||||||
|
|
||||||
if( !res )
|
if( !res )
|
||||||
{
|
{
|
||||||
|
|
|
@ -238,13 +238,13 @@ void CorrectUrlOnlyAllowedChar(std::wstring & url);
|
||||||
|
|
||||||
const wchar_t * DateToStr(int year, int month, int day);
|
const wchar_t * DateToStr(int year, int month, int day);
|
||||||
const wchar_t * DateToStr(int year, int month, int day, int hour, int min, int sec);
|
const wchar_t * DateToStr(int year, int month, int day, int hour, int min, int sec);
|
||||||
const wchar_t * DateToStr(const PT::Date & d);
|
const wchar_t * DateToStr(const pt::Date & d);
|
||||||
const wchar_t * DateToStr(time_t t);
|
const wchar_t * DateToStr(time_t t);
|
||||||
const wchar_t * DateToStrWithoutHours(const PT::Date & d);
|
const wchar_t * DateToStrWithoutHours(const pt::Date & d);
|
||||||
const wchar_t * DateToStrWithoutHours(time_t t);
|
const wchar_t * DateToStrWithoutHours(time_t t);
|
||||||
|
|
||||||
const char * DateToStrCookie(int year, int month, int day, int hour, int min, int sec);
|
const char * DateToStrCookie(int year, int month, int day, int hour, int min, int sec);
|
||||||
const char * DateToStrCookie(const PT::Date & d);
|
const char * DateToStrCookie(const pt::Date & d);
|
||||||
const char * DateToStrCookie(time_t t);
|
const char * DateToStrCookie(time_t t);
|
||||||
|
|
||||||
// depracated
|
// depracated
|
||||||
|
@ -253,8 +253,8 @@ const wchar_t * IpToStr(unsigned int ip_);
|
||||||
|
|
||||||
// in a new code we can use WTextStream in such a way
|
// in a new code we can use WTextStream in such a way
|
||||||
// DateToStr() etc can use it too
|
// DateToStr() etc can use it too
|
||||||
PT::WTextStream IPToStr(unsigned int ip);
|
pt::WTextStream IPToStr(unsigned int ip);
|
||||||
PT::WTextStream IPToStr(int ip);
|
pt::WTextStream IPToStr(int ip);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ size_t i = 0;
|
||||||
|
|
||||||
while( i < buf.size() )
|
while( i < buf.size() )
|
||||||
{
|
{
|
||||||
if( PT::is_substr(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.erase(i, look_for.size());
|
||||||
buf.insert(i, replace);
|
buf.insert(i, replace);
|
||||||
|
@ -681,7 +681,7 @@ int SelectFileType(const std::wstring & file_name);
|
||||||
// thread safe
|
// thread safe
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
void UrlEncode(char c,
|
void UrlEncode(char c,
|
||||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||||
bool clear_out = true)
|
bool clear_out = true)
|
||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
|
@ -713,7 +713,7 @@ size_t buflen = sizeof(buffer)/sizeof(char);
|
||||||
// thread safe
|
// thread safe
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
void UrlEncode(const char * in,
|
void UrlEncode(const char * in,
|
||||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||||
bool clear_out = true)
|
bool clear_out = true)
|
||||||
{
|
{
|
||||||
if( clear_out )
|
if( clear_out )
|
||||||
|
@ -727,7 +727,7 @@ void UrlEncode(const char * in,
|
||||||
// thread safe
|
// thread safe
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
void UrlEncode(const std::string & in,
|
void UrlEncode(const std::string & in,
|
||||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||||
bool clear_out = true)
|
bool clear_out = true)
|
||||||
{
|
{
|
||||||
UrlEncode(in.c_str(), out, clear_out);
|
UrlEncode(in.c_str(), out, clear_out);
|
||||||
|
@ -738,12 +738,12 @@ void UrlEncode(const std::string & in,
|
||||||
// not thread safe
|
// not thread safe
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
void UrlEncode(const wchar_t * in,
|
void UrlEncode(const wchar_t * in,
|
||||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||||
bool clear_out = true)
|
bool clear_out = true)
|
||||||
{
|
{
|
||||||
static std::string ain;
|
static std::string ain;
|
||||||
|
|
||||||
PT::WideToUTF8(in, ain);
|
pt::WideToUTF8(in, ain);
|
||||||
|
|
||||||
if( clear_out )
|
if( clear_out )
|
||||||
out.clear();
|
out.clear();
|
||||||
|
@ -756,7 +756,7 @@ static std::string ain;
|
||||||
// not thread safe
|
// not thread safe
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
void UrlEncode(const std::wstring & in,
|
void UrlEncode(const std::wstring & in,
|
||||||
PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||||
bool clear_out = true)
|
bool clear_out = true)
|
||||||
{
|
{
|
||||||
UrlEncode(in.c_str(), out, clear_out);
|
UrlEncode(in.c_str(), out, clear_out);
|
||||||
|
@ -768,14 +768,14 @@ void UrlEncode(const std::wstring & in,
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void UrlEncode(char c, StringType & out, bool clear_out = true)
|
void UrlEncode(char c, StringType & out, bool clear_out = true)
|
||||||
{
|
{
|
||||||
static PT::TextStream tmp;
|
static pt::TextStream tmp;
|
||||||
|
|
||||||
UrlEncode(c, tmp);
|
UrlEncode(c, tmp);
|
||||||
tmp.to_string(out, clear_out);
|
tmp.to_string(out, clear_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// !! IMROVE ME we need some UrlEncode methods with PT::TextBuffer instead of std::string
|
// !! IMROVE ME we need some UrlEncode methods with pt::TextBuffer instead of std::string
|
||||||
|
|
||||||
|
|
||||||
void UrlEncode(const char * in, std::string & out, bool clear_out = true);
|
void UrlEncode(const char * in, std::string & out, bool clear_out = true);
|
||||||
|
@ -802,7 +802,7 @@ bool UrlDecode(const std::string & url, std::wstring & out, bool clear_out = tr
|
||||||
|
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
void QEncodeAddChar(char_type c, PT::TextStreamBase<char_type, stack_size, heap_block_size> & out)
|
void QEncodeAddChar(char_type c, pt::TextStreamBase<char_type, stack_size, heap_block_size> & out)
|
||||||
{
|
{
|
||||||
if( (c>='A' && c<='Z') ||
|
if( (c>='A' && c<='Z') ||
|
||||||
(c>='a' && c<='z') ||
|
(c>='a' && c<='z') ||
|
||||||
|
@ -817,7 +817,7 @@ void QEncodeAddChar(char_type c, PT::TextStreamBase<char_type, stack_size, heap_
|
||||||
|
|
||||||
size_t len1 = sizeof(buf1) / sizeof(char);
|
size_t len1 = sizeof(buf1) / sizeof(char);
|
||||||
size_t len2 = sizeof(buf2) / sizeof(char);
|
size_t len2 = sizeof(buf2) / sizeof(char);
|
||||||
size_t len = PT::IntToUTF8(int(c), buf1, len1);
|
size_t len = pt::IntToUTF8(int(c), buf1, len1);
|
||||||
|
|
||||||
for(size_t i=0 ; i<len ; ++i)
|
for(size_t i=0 ; i<len ; ++i)
|
||||||
{
|
{
|
||||||
|
@ -850,7 +850,7 @@ void QEncodeAddChar(char_type c, PT::TextStreamBase<char_type, stack_size, heap_
|
||||||
charset, encoding, encoded-text, and delimiters."
|
charset, encoding, encoded-text, and delimiters."
|
||||||
*/
|
*/
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
void QEncode(const wchar_t * in, PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
void QEncode(const wchar_t * in, pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||||
bool clear = true)
|
bool clear = true)
|
||||||
{
|
{
|
||||||
if( clear )
|
if( clear )
|
||||||
|
@ -866,7 +866,7 @@ void QEncode(const wchar_t * in, PT::TextStreamBase<char_type, stack_size, heap_
|
||||||
|
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
void QEncode(const std::wstring & in, PT::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
void QEncode(const std::wstring & in, pt::TextStreamBase<char_type, stack_size, heap_block_size> & out,
|
||||||
bool clear = true)
|
bool clear = true)
|
||||||
{
|
{
|
||||||
if( clear )
|
if( clear )
|
||||||
|
@ -984,7 +984,7 @@ void JSONescape(Stream & out, const StringType & str)
|
||||||
* converting from a wide string to an UTF-8 string
|
* converting from a wide string to an UTF-8 string
|
||||||
* and puts a log if the conversion fails
|
* and puts a log if the conversion fails
|
||||||
*
|
*
|
||||||
* it uses PT::WideToUTF8()
|
* it uses pt::WideToUTF8()
|
||||||
*/
|
*/
|
||||||
bool WideToUTF8(const wchar_t * wide_string, char * utf8, size_t utf8_size);
|
bool WideToUTF8(const wchar_t * wide_string, char * utf8, size_t utf8_size);
|
||||||
bool WideToUTF8(const std::wstring & wide_string, char * utf8, size_t utf8_size);
|
bool WideToUTF8(const std::wstring & wide_string, char * utf8, size_t utf8_size);
|
||||||
|
|
|
@ -382,14 +382,14 @@ void PostMultiParser::ReadContent()
|
||||||
|
|
||||||
log << log2 << "PMP: content size: " << content_len << " bytes" << logend;
|
log << log2 << "PMP: content size: " << content_len << " bytes" << logend;
|
||||||
|
|
||||||
if( !PT::is_substr_nc("pass", name.c_str()) )
|
if( !pt::is_substr_nc("pass", name.c_str()) )
|
||||||
LogFirst(content, config->log_post_value_size);
|
LogFirst(content, config->log_post_value_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PostMultiParser::ConvStr(const std::string & src, std::wstring & dst)
|
void PostMultiParser::ConvStr(const std::string & src, std::wstring & dst)
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(src, dst);
|
pt::UTF8ToWide(src, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ size_t buf_len = sizeof(buf)/sizeof(wchar_t);
|
||||||
tmp_filename_postfix += 1;
|
tmp_filename_postfix += 1;
|
||||||
|
|
||||||
tmp_filename = buf;
|
tmp_filename = buf;
|
||||||
PT::WideToUTF8(tmp_filename, atmp_filename);
|
pt::WideToUTF8(tmp_filename, atmp_filename);
|
||||||
|
|
||||||
tmp_file.open(atmp_filename.c_str(), std::ios_base::binary | std::ios_base::out);
|
tmp_file.open(atmp_filename.c_str(), std::ios_base::binary | std::ios_base::out);
|
||||||
// !! IMPROVE ME dodac ustawienie chmod config.upload_files_chmod dla tymczasowego pliku
|
// !! IMPROVE ME dodac ustawienie chmod config.upload_files_chmod dla tymczasowego pliku
|
||||||
|
|
|
@ -77,7 +77,7 @@ protected:
|
||||||
{
|
{
|
||||||
log << log2 << "Method POST, name: \"" << name << "\"";
|
log << log2 << "Method POST, name: \"" << name << "\"";
|
||||||
|
|
||||||
if( log_value_size > 0 && !PT::is_substr_nc(L"pass", name.c_str()) )
|
if( log_value_size > 0 && !pt::is_substr_nc(L"pass", name.c_str()) )
|
||||||
{
|
{
|
||||||
log << ", value: ";
|
log << ", value: ";
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct Request
|
||||||
they are set when a request starts
|
they are set when a request starts
|
||||||
*/
|
*/
|
||||||
time_t start_time;
|
time_t start_time;
|
||||||
PT::Date start_date;
|
pt::Date start_date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,13 +118,13 @@ struct Request
|
||||||
|
|
||||||
/*
|
/*
|
||||||
raw parameters
|
raw parameters
|
||||||
!! CHECK ME may post_tab and cookie_tab should be changed to PT::Space now?
|
!! CHECK ME may post_tab and cookie_tab should be changed to pt::Space now?
|
||||||
or may change the name to cookie_in? or in_cookie?
|
or may change the name to cookie_in? or in_cookie?
|
||||||
*/
|
*/
|
||||||
PostTab post_tab;
|
PostTab post_tab;
|
||||||
PostFileTab post_file_tab;
|
PostFileTab post_file_tab;
|
||||||
CookieTab cookie_tab;
|
CookieTab cookie_tab;
|
||||||
PT::Space post_in;
|
pt::Space post_in;
|
||||||
bool is_postin_used;// temporarily, before all post variables will be put to post_in
|
bool is_postin_used;// temporarily, before all post variables will be put to post_in
|
||||||
|
|
||||||
// input headers (without cookies)
|
// input headers (without cookies)
|
||||||
|
@ -134,7 +134,7 @@ struct Request
|
||||||
// although https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 says that there can be more
|
// although https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 says that there can be more
|
||||||
// than one http header with the same name we do not support it
|
// than one http header with the same name we do not support it
|
||||||
// each header has a different name here, cookies we have in a different container (cookie_tab)
|
// each header has a different name here, cookies we have in a different container (cookie_tab)
|
||||||
PT::Space headers_in;
|
pt::Space headers_in;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -232,11 +232,11 @@ struct Request
|
||||||
bool send_as_attachment;
|
bool send_as_attachment;
|
||||||
|
|
||||||
// headers send to the client (without cookies) (may change to headers_out?)
|
// headers send to the client (without cookies) (may change to headers_out?)
|
||||||
PT::Space out_headers;
|
pt::Space out_headers;
|
||||||
|
|
||||||
// cookies send to the client
|
// cookies send to the client
|
||||||
// a value can be either a cookie value or the whole cookie string (with domain, date etc)
|
// a value can be either a cookie value or the whole cookie string (with domain, date etc)
|
||||||
PT::Space out_cookies;
|
pt::Space out_cookies;
|
||||||
|
|
||||||
// winix can return either a text answer or a binary answer
|
// winix can return either a text answer or a binary answer
|
||||||
// if send_bin_stream is true then the binary answer is sent (out_bin_stream)
|
// if send_bin_stream is true then the binary answer is sent (out_bin_stream)
|
||||||
|
@ -305,7 +305,7 @@ struct Request
|
||||||
bool return_info_only;
|
bool return_info_only;
|
||||||
|
|
||||||
// additional info added when sending the JSON answer
|
// additional info added when sending the JSON answer
|
||||||
PT::Space info;
|
pt::Space info;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,14 +382,14 @@ struct Request
|
||||||
|
|
||||||
|
|
||||||
// setting a cookie
|
// setting a cookie
|
||||||
// name - cookie name (either const wchar_t, or std::wstring or PT::WTextStream)
|
// name - cookie name (either const wchar_t, or std::wstring or pt::WTextStream)
|
||||||
// value - cookie value (can be everything which can be put to PT::WTextStream stream)
|
// value - cookie value (can be everything which can be put to pt::WTextStream stream)
|
||||||
// the return std::wstring reference is a reference to the cookie inserted value (in out_cookies structure)
|
// the return std::wstring reference is a reference to the cookie inserted value (in out_cookies structure)
|
||||||
template<typename NameType, typename ValueType>
|
template<typename NameType, typename ValueType>
|
||||||
void AddCookie(const NameType & name, const ValueType & value, PT::Date * expires = 0);
|
void AddCookie(const NameType & name, const ValueType & value, pt::Date * expires = 0);
|
||||||
|
|
||||||
template<typename NameType, typename ValueType>
|
template<typename NameType, typename ValueType>
|
||||||
void AddCookie(const NameType & name, const ValueType & value, PT::Date & expires);
|
void AddCookie(const NameType & name, const ValueType & value, pt::Date & expires);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -409,9 +409,9 @@ private:
|
||||||
|
|
||||||
|
|
||||||
template<typename NameType, typename ValueType>
|
template<typename NameType, typename ValueType>
|
||||||
void Request::AddCookie(const NameType & name, const ValueType & value, PT::Date * expires)
|
void Request::AddCookie(const NameType & name, const ValueType & value, pt::Date * expires)
|
||||||
{
|
{
|
||||||
PT::WTextStream cookie;
|
pt::WTextStream cookie;
|
||||||
|
|
||||||
cookie << value;
|
cookie << value;
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ void Request::AddCookie(const NameType & name, const ValueType & value, PT::Date
|
||||||
|
|
||||||
|
|
||||||
template<typename NameType, typename ValueType>
|
template<typename NameType, typename ValueType>
|
||||||
void Request::AddCookie(const NameType & name, const ValueType & value, PT::Date & expires)
|
void Request::AddCookie(const NameType & name, const ValueType & value, pt::Date & expires)
|
||||||
{
|
{
|
||||||
AddCookie(name, value, &expires);
|
AddCookie(name, value, &expires);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ typedef std::vector<Param> ParamTab;
|
||||||
typedef std::map<std::wstring, std::wstring> CookieTab;
|
typedef std::map<std::wstring, std::wstring> CookieTab;
|
||||||
|
|
||||||
|
|
||||||
typedef PT::TextStreamBase<char, 1, 4096> BinaryPage;
|
typedef pt::TextStreamBase<char, 1, 4096> BinaryPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,12 @@ struct Session
|
||||||
// when this session was created
|
// when this session was created
|
||||||
// (the same values)
|
// (the same values)
|
||||||
time_t start_time;
|
time_t start_time;
|
||||||
PT::Date start_date;
|
pt::Date start_date;
|
||||||
|
|
||||||
// when this session was last used
|
// when this session was last used
|
||||||
// (the same values)
|
// (the same values)
|
||||||
time_t last_time;
|
time_t last_time;
|
||||||
PT::Date last_date;
|
pt::Date last_date;
|
||||||
|
|
||||||
// when there was a last get request
|
// when there was a last get request
|
||||||
// (used to calculate spam or invalid login attempts etc.)
|
// (used to calculate spam or invalid login attempts etc.)
|
||||||
|
|
|
@ -86,7 +86,7 @@ void SessionIdManager::SetKeyRenewTime(time_t renew_time)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SessionIdManager::ReadKey(const wchar_t * name, PT::Space & space, std::vector<std::string> & dest_key)
|
void SessionIdManager::ReadKey(const wchar_t * name, pt::Space & space, std::vector<std::string> & dest_key)
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> keys;
|
std::vector<std::wstring> keys;
|
||||||
std::string key_ascii, key_base64_decoded;
|
std::string key_ascii, key_base64_decoded;
|
||||||
|
@ -100,7 +100,7 @@ std::string key_ascii, key_base64_decoded;
|
||||||
{
|
{
|
||||||
dest_key[i].clear();
|
dest_key[i].clear();
|
||||||
|
|
||||||
if( PT::WideToUTF8(keys[i], key_ascii) )
|
if( pt::WideToUTF8(keys[i], key_ascii) )
|
||||||
{
|
{
|
||||||
if( base64.Decode(key_ascii, key_base64_decoded) )
|
if( base64.Decode(key_ascii, key_base64_decoded) )
|
||||||
{
|
{
|
||||||
|
@ -140,14 +140,14 @@ void SessionIdManager::InitializeAesKeys()
|
||||||
|
|
||||||
bool SessionIdManager::ReadKeysFromFile(const wchar_t * file)
|
bool SessionIdManager::ReadKeysFromFile(const wchar_t * file)
|
||||||
{
|
{
|
||||||
PT::Space space;
|
pt::Space space;
|
||||||
PT::SpaceParser parser;
|
pt::SpaceParser parser;
|
||||||
PT::Date date;
|
pt::Date date;
|
||||||
|
|
||||||
parser.SetSpace(space);
|
parser.SetSpace(space);
|
||||||
PT::SpaceParser::Status status = parser.ParseSpaceFile(file);
|
pt::SpaceParser::Status status = parser.ParseSpaceFile(file);
|
||||||
|
|
||||||
if( status == PT::SpaceParser::ok )
|
if( status == pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
key_index = space.to_ulong(L"key_index");
|
key_index = space.to_ulong(L"key_index");
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ PT::Date date;
|
||||||
log << log1 << "SIM: I cannot read the session keys from: " << file << logend;
|
log << log1 << "SIM: I cannot read the session keys from: " << file << logend;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status == PT::SpaceParser::ok;
|
return status == pt::SpaceParser::ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ void SessionIdManager::SaveKeysToFile(std::vector<std::string> & keys)
|
||||||
|
|
||||||
bool SessionIdManager::SaveKeysToFile(const wchar_t * file)
|
bool SessionIdManager::SaveKeysToFile(const wchar_t * file)
|
||||||
{
|
{
|
||||||
PT::Date date = last_key_generated;
|
pt::Date date = last_key_generated;
|
||||||
PT::WideToUTF8(file, file_name_ascii);
|
pt::WideToUTF8(file, file_name_ascii);
|
||||||
|
|
||||||
out_file.clear();
|
out_file.clear();
|
||||||
out_file.open(file_name_ascii, std::ios_base::binary | std::ios_base::out);
|
out_file.open(file_name_ascii, std::ios_base::binary | std::ios_base::out);
|
||||||
|
|
|
@ -124,7 +124,7 @@ private:
|
||||||
bool ReadKeysFromFile(const std::wstring & file);
|
bool ReadKeysFromFile(const std::wstring & file);
|
||||||
bool SaveKeysToFile(const wchar_t * file);
|
bool SaveKeysToFile(const wchar_t * file);
|
||||||
bool SaveKeysToFile(const std::wstring & file);
|
bool SaveKeysToFile(const std::wstring & file);
|
||||||
void ReadKey(const wchar_t * name, PT::Space & space, std::vector<std::string> & dest_key);
|
void ReadKey(const wchar_t * name, pt::Space & space, std::vector<std::string> & dest_key);
|
||||||
bool AreKeysCorrect(size_t index);
|
bool AreKeysCorrect(size_t index);
|
||||||
void GenerateKeys(size_t index, time_t cur_utc_time);
|
void GenerateKeys(size_t index, time_t cur_utc_time);
|
||||||
void CheckKeys(time_t cur_utc_time);
|
void CheckKeys(time_t cur_utc_time);
|
||||||
|
|
|
@ -256,7 +256,7 @@ void SessionManager::IncrementBanLevel(IPBan * ip_ban)
|
||||||
cur->request->start_time + (time_t)config->ban_level_2_delay,
|
cur->request->start_time + (time_t)config->ban_level_2_delay,
|
||||||
cur->request->start_time + (time_t)config->ban_level_3_delay);
|
cur->request->start_time + (time_t)config->ban_level_3_delay);
|
||||||
|
|
||||||
PT::Date date(ip_ban->expires);
|
pt::Date date(ip_ban->expires);
|
||||||
main_log << log2 << "SM: this IP address has been banned to: " << date << " UTC" << logend;
|
main_log << log2 << "SM: this IP address has been banned to: " << date << " UTC" << logend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ bool SessionManager::IsIPBanned()
|
||||||
else
|
else
|
||||||
if( current_ip_ban->IsIPBanned() )
|
if( current_ip_ban->IsIPBanned() )
|
||||||
{
|
{
|
||||||
PT::Date date = current_ip_ban->expires;
|
pt::Date date = current_ip_ban->expires;
|
||||||
main_log << log2 << "SM: this ip is bannned to: " << date << " UTC" << logend;
|
main_log << log2 << "SM: this ip is bannned to: " << date << " UTC" << logend;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ SLog & SLog::operator<<(double s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SLog & SLog::operator<<(const PT::Date & date)
|
SLog & SLog::operator<<(const pt::Date & date)
|
||||||
{
|
{
|
||||||
return PutLog(date);
|
return PutLog(date);
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ return *this;
|
||||||
|
|
||||||
SLog & SLog::TranslateText(const char * str)
|
SLog & SLog::TranslateText(const char * str)
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(str, key_temp);
|
pt::UTF8ToWide(str, key_temp);
|
||||||
return TranslateText(key_temp.c_str());
|
return TranslateText(key_temp.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,10 +99,10 @@ public:
|
||||||
SLog & operator<<(size_t s);
|
SLog & operator<<(size_t s);
|
||||||
SLog & operator<<(double s);
|
SLog & operator<<(double s);
|
||||||
SLog & operator<<(LogManipulators m);
|
SLog & operator<<(LogManipulators m);
|
||||||
SLog & operator<<(const PT::Date & date);
|
SLog & operator<<(const pt::Date & date);
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
SLog & operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
SLog & operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf);
|
||||||
|
|
||||||
|
|
||||||
SLog & TranslateText(const char * str);
|
SLog & TranslateText(const char * str);
|
||||||
|
@ -148,7 +148,7 @@ SLog::TranslateTextHelper<RawType> T(const RawType & par)
|
||||||
|
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
SLog & SLog::operator<<(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
SLog & SLog::operator<<(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & buf)
|
||||||
{
|
{
|
||||||
return PutLog(buf);
|
return PutLog(buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ void System::PutUrlProto(bool can_use_ssl, std::wstring & str, bool clear_str)
|
||||||
/*
|
/*
|
||||||
* try_to_use_ssl is to be meant: config->use_ssl, config->use_ssl_static, config->use_ssl_common
|
* try_to_use_ssl is to be meant: config->use_ssl, config->use_ssl_static, config->use_ssl_common
|
||||||
*/
|
*/
|
||||||
void System::PutUrlProto(bool can_use_ssl, PT::TextStream & str, bool clear_stream)
|
void System::PutUrlProto(bool can_use_ssl, pt::TextStream & str, bool clear_stream)
|
||||||
{
|
{
|
||||||
if( clear_stream )
|
if( clear_stream )
|
||||||
str.clear();
|
str.clear();
|
||||||
|
@ -241,7 +241,7 @@ void System::PutUrlProto(std::wstring & str, bool clear_str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void System::PutUrlProto(PT::TextStream & str, bool clear_stream)
|
void System::PutUrlProto(pt::TextStream & str, bool clear_stream)
|
||||||
{
|
{
|
||||||
return PutUrlProto(config->use_ssl, str, clear_stream);
|
return PutUrlProto(config->use_ssl, str, clear_stream);
|
||||||
}
|
}
|
||||||
|
@ -1117,7 +1117,7 @@ return utc_time;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::Date System::ToLocal(const PT::Date & utc_date)
|
pt::Date System::ToLocal(const pt::Date & utc_date)
|
||||||
{
|
{
|
||||||
size_t tz_id;
|
size_t tz_id;
|
||||||
|
|
||||||
|
@ -1156,7 +1156,7 @@ return local_time;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::Date System::ToUTC(const PT::Date & local_date)
|
pt::Date System::ToUTC(const pt::Date & local_date)
|
||||||
{
|
{
|
||||||
size_t tz_id;
|
size_t tz_id;
|
||||||
|
|
||||||
|
|
|
@ -127,9 +127,9 @@ public:
|
||||||
bool IsSSLRequired(bool try_to_use_ssl);
|
bool IsSSLRequired(bool try_to_use_ssl);
|
||||||
bool IsSSLRequired();
|
bool IsSSLRequired();
|
||||||
void PutUrlProto(bool can_use_ssl, std::wstring & str, bool clear_str = true);
|
void PutUrlProto(bool can_use_ssl, std::wstring & str, bool clear_str = true);
|
||||||
void PutUrlProto(bool can_use_ssl, PT::TextStream & str, bool clear_stream = true);
|
void PutUrlProto(bool can_use_ssl, pt::TextStream & str, bool clear_stream = true);
|
||||||
void PutUrlProto(std::wstring & str, bool clear_str = true);
|
void PutUrlProto(std::wstring & str, bool clear_str = true);
|
||||||
void PutUrlProto(PT::TextStream & str, bool clear_stream = true);
|
void PutUrlProto(pt::TextStream & str, bool clear_stream = true);
|
||||||
|
|
||||||
void RedirectTo(const Item & item, const wchar_t * postfix = 0, bool use_reqtype = true);
|
void RedirectTo(const Item & item, const wchar_t * postfix = 0, bool use_reqtype = true);
|
||||||
void RedirectTo(long item_id, const wchar_t * postfix = 0, bool use_reqtype = true);
|
void RedirectTo(long item_id, const wchar_t * postfix = 0, bool use_reqtype = true);
|
||||||
|
@ -185,10 +185,10 @@ public:
|
||||||
|
|
||||||
|
|
||||||
time_t ToLocal(time_t utc_time);
|
time_t ToLocal(time_t utc_time);
|
||||||
PT::Date ToLocal(const PT::Date & utc_date);
|
pt::Date ToLocal(const pt::Date & utc_date);
|
||||||
|
|
||||||
time_t ToUTC(time_t local_time);
|
time_t ToUTC(time_t local_time);
|
||||||
PT::Date ToUTC(const PT::Date & local_date);
|
pt::Date ToUTC(const pt::Date & local_date);
|
||||||
|
|
||||||
|
|
||||||
int FollowLink(const std::vector<Item*> & current_dir_tab, const std::wstring & link_to,
|
int FollowLink(const std::vector<Item*> & current_dir_tab, const std::wstring & link_to,
|
||||||
|
|
|
@ -104,11 +104,11 @@ public:
|
||||||
TextStream & operator<<(unsigned long);
|
TextStream & operator<<(unsigned long);
|
||||||
TextStream & operator<<(double);
|
TextStream & operator<<(double);
|
||||||
TextStream & operator<<(const void *);// printing a pointer
|
TextStream & operator<<(const void *);// printing a pointer
|
||||||
TextStream & operator<<(const PT::Space & space);
|
TextStream & operator<<(const pt::Space & space);
|
||||||
TextStream & operator<<(const PT::Date & date);
|
TextStream & operator<<(const pt::Date & date);
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
TextStream & operator<<(const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
TextStream & operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
||||||
|
|
||||||
TextStream & Write(const char * buf, size_t len);
|
TextStream & Write(const char * buf, size_t len);
|
||||||
TextStream & Write(const wchar_t * buf, size_t len);
|
TextStream & Write(const wchar_t * buf, size_t len);
|
||||||
|
@ -396,7 +396,7 @@ TextStream<StringType> & TextStream<StringType>::write(const wchar_t * buf, size
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const PT::Space & space)
|
TextStream<StringType> & TextStream<StringType>::operator<<(const pt::Space & space)
|
||||||
{
|
{
|
||||||
space.serialize_to_space_stream(*this, true);
|
space.serialize_to_space_stream(*this, true);
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ return *this;
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const PT::Date & date)
|
TextStream<StringType> & TextStream<StringType>::operator<<(const pt::Date & date)
|
||||||
{
|
{
|
||||||
date.Serialize(*this);
|
date.Serialize(*this);
|
||||||
|
|
||||||
|
@ -417,9 +417,9 @@ return *this;
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(
|
TextStream<StringType> & TextStream<StringType>::operator<<(
|
||||||
const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
||||||
{
|
{
|
||||||
typename PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
typename pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
||||||
|
|
||||||
for(i=arg.begin() ; i != arg.end() ; ++i)
|
for(i=arg.begin() ; i != arg.end() ; ++i)
|
||||||
buffer += static_cast<char_type>(*i);
|
buffer += static_cast<char_type>(*i);
|
||||||
|
@ -434,7 +434,7 @@ return *this;
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(wchar_t c, std::string & dst)
|
void TextStream<StringType>::Convert(wchar_t c, std::string & dst)
|
||||||
{
|
{
|
||||||
PT::IntToUTF8((int)c, dst, false);
|
pt::IntToUTF8((int)c, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ void TextStream<StringType>::Convert(wchar_t c, std::wstring & dst)
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const char * src, size_t len, std::wstring & dst)
|
void TextStream<StringType>::Convert(const char * src, size_t len, std::wstring & dst)
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(src, len, dst, false);
|
pt::UTF8ToWide(src, len, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -456,14 +456,14 @@ void TextStream<StringType>::Convert(const char * src, size_t len, std::wstring
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const char * src, std::wstring & dst)
|
void TextStream<StringType>::Convert(const char * src, std::wstring & dst)
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(src, dst, false);
|
pt::UTF8ToWide(src, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const std::string & src, std::wstring & dst)
|
void TextStream<StringType>::Convert(const std::string & src, std::wstring & dst)
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(src, dst, false);
|
pt::UTF8ToWide(src, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,21 +473,21 @@ void TextStream<StringType>::Convert(const std::string & src, std::wstring & dst
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const wchar_t * src, size_t len, std::string & dst)
|
void TextStream<StringType>::Convert(const wchar_t * src, size_t len, std::string & dst)
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(src, len, dst, false);
|
pt::WideToUTF8(src, len, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const wchar_t * src, std::string & dst)
|
void TextStream<StringType>::Convert(const wchar_t * src, std::string & dst)
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(src, dst, false);
|
pt::WideToUTF8(src, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
template<class StringType>
|
||||||
void TextStream<StringType>::Convert(const std::wstring & src, std::string & dst)
|
void TextStream<StringType>::Convert(const std::wstring & src, std::string & dst)
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(src, dst, false);
|
pt::WideToUTF8(src, dst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ private:
|
||||||
morm::JSONConnector json_connector;
|
morm::JSONConnector json_connector;
|
||||||
morm::PostgreSQLConnector postgresql_connector;
|
morm::PostgreSQLConnector postgresql_connector;
|
||||||
|
|
||||||
PT::WTextStream log_buffer;
|
pt::WTextStream log_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ThreadItem
|
struct ThreadItem
|
||||||
|
|
|
@ -57,7 +57,7 @@ void TimeZone::Dst::Clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TimeZone::Dst::IsDstUsed(const PT::Date & date) const
|
bool TimeZone::Dst::IsDstUsed(const pt::Date & date) const
|
||||||
{
|
{
|
||||||
if( !has_dst )
|
if( !has_dst )
|
||||||
return false;
|
return false;
|
||||||
|
@ -70,7 +70,7 @@ return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int TimeZone::Dst::Compare(const PT::Date & date1, const PT::Date & date2) const
|
int TimeZone::Dst::Compare(const pt::Date & date1, const pt::Date & date2) const
|
||||||
{
|
{
|
||||||
// year is ignored
|
// year is ignored
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ return &i->second;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
time_t TimeZone::CalcLocalOffset(const PT::Date & utc_date)
|
time_t TimeZone::CalcLocalOffset(const pt::Date & utc_date)
|
||||||
{
|
{
|
||||||
time_t dst_offset = 0;
|
time_t dst_offset = 0;
|
||||||
|
|
||||||
|
@ -151,22 +151,22 @@ return offset + dst_offset;
|
||||||
|
|
||||||
time_t TimeZone::ToLocal(time_t utc_time)
|
time_t TimeZone::ToLocal(time_t utc_time)
|
||||||
{
|
{
|
||||||
time_t offset = CalcLocalOffset(PT::Date(utc_time));
|
time_t offset = CalcLocalOffset(pt::Date(utc_time));
|
||||||
|
|
||||||
return utc_time + offset;
|
return utc_time + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PT::Date TimeZone::ToLocal(const PT::Date & utc_date)
|
pt::Date TimeZone::ToLocal(const pt::Date & utc_date)
|
||||||
{
|
{
|
||||||
PT::Date local(utc_date);
|
pt::Date local(utc_date);
|
||||||
local += CalcLocalOffset(utc_date);
|
local += CalcLocalOffset(utc_date);
|
||||||
|
|
||||||
return local;
|
return local;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
time_t TimeZone::CalcUTCOffset(const PT::Date & local_date)
|
time_t TimeZone::CalcUTCOffset(const pt::Date & local_date)
|
||||||
{
|
{
|
||||||
time_t dst_offset = 0;
|
time_t dst_offset = 0;
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ time_t dst_offset = 0;
|
||||||
if( dst && dst->has_dst )
|
if( dst && dst->has_dst )
|
||||||
{
|
{
|
||||||
// dst date ranges we have in UTC
|
// dst date ranges we have in UTC
|
||||||
PT::Date utc(local_date);
|
pt::Date utc(local_date);
|
||||||
utc -= (offset + dst->offset);
|
utc -= (offset + dst->offset);
|
||||||
|
|
||||||
if( dst->IsDstUsed(utc) )
|
if( dst->IsDstUsed(utc) )
|
||||||
|
@ -189,17 +189,17 @@ return offset + dst_offset;
|
||||||
|
|
||||||
time_t TimeZone::ToUTC(time_t local_time)
|
time_t TimeZone::ToUTC(time_t local_time)
|
||||||
{
|
{
|
||||||
time_t offset = CalcUTCOffset(PT::Date(local_time));
|
time_t offset = CalcUTCOffset(pt::Date(local_time));
|
||||||
|
|
||||||
return local_time - offset;
|
return local_time - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::Date TimeZone::ToUTC(const PT::Date & local_date)
|
pt::Date TimeZone::ToUTC(const pt::Date & local_date)
|
||||||
{
|
{
|
||||||
time_t offset;
|
time_t offset;
|
||||||
PT::Date utc(local_date);
|
pt::Date utc(local_date);
|
||||||
|
|
||||||
offset = CalcUTCOffset(local_date);
|
offset = CalcUTCOffset(local_date);
|
||||||
utc -= offset;
|
utc -= offset;
|
||||||
|
@ -211,7 +211,7 @@ return utc;
|
||||||
|
|
||||||
time_t TimeZone::ParseStrOffset(const wchar_t * str)
|
time_t TimeZone::ParseStrOffset(const wchar_t * str)
|
||||||
{
|
{
|
||||||
PT::Date date;
|
pt::Date date;
|
||||||
bool is_sign = false;
|
bool is_sign = false;
|
||||||
time_t offset = 0;
|
time_t offset = 0;
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
time_t TimeZone::GetOffset(PT::Space & space)
|
time_t TimeZone::GetOffset(pt::Space & space)
|
||||||
{
|
{
|
||||||
std::wstring * offset_str = space.get_wstr(L"offset_str");
|
std::wstring * offset_str = space.get_wstr(L"offset_str");
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ time_t TimeZone::GetOffset(PT::Space & space)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TimeZone::SetTzDst(PT::Space & year)
|
bool TimeZone::SetTzDst(pt::Space & year)
|
||||||
{
|
{
|
||||||
time_t h24 = 60 * 60 * 24; // 24 hours
|
time_t h24 = 60 * 60 * 24; // 24 hours
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
@ -291,7 +291,7 @@ return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TimeZone::SetTz(PT::Space & space)
|
bool TimeZone::SetTz(pt::Space & space)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
name.clear();
|
name.clear();
|
||||||
|
@ -306,13 +306,13 @@ bool TimeZone::SetTz(PT::Space & space)
|
||||||
if( offset < -h24 || offset > h24 )
|
if( offset < -h24 || offset > h24 )
|
||||||
result = false;
|
result = false;
|
||||||
|
|
||||||
PT::Space * dst = space.find_child_space(L"dst");
|
pt::Space * dst = space.find_child_space(L"dst");
|
||||||
|
|
||||||
if( dst && dst->child_spaces )
|
if( dst && dst->child_spaces )
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<dst->child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<dst->child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & year = *(*dst->child_spaces)[i];
|
pt::Space & year = *(*dst->child_spaces)[i];
|
||||||
|
|
||||||
if( !SetTzDst(year) )
|
if( !SetTzDst(year) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
// time zone daylight saving time (used if has_dst is true)
|
// time zone daylight saving time (used if has_dst is true)
|
||||||
// the 'year' field is the same in 'start' and 'end'
|
// the 'year' field is the same in 'start' and 'end'
|
||||||
// start and end are represented in UTC time
|
// start and end are represented in UTC time
|
||||||
PT::Date start, end;
|
pt::Date start, end;
|
||||||
|
|
||||||
// time zone daylight saving time offset
|
// time zone daylight saving time offset
|
||||||
// used when has_dst is true and the date is whithin start and end
|
// used when has_dst is true and the date is whithin start and end
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
// checking whether specified 'date' is in the range of <start, end>
|
// checking whether specified 'date' is in the range of <start, end>
|
||||||
// the year field in date, start and end is ignored
|
// the year field in date, start and end is ignored
|
||||||
// has_dst must be true
|
// has_dst must be true
|
||||||
bool IsDstUsed(const PT::Date & date) const;
|
bool IsDstUsed(const pt::Date & date) const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
// return value less than zero if date1 is lower than date2
|
// return value less than zero if date1 is lower than date2
|
||||||
// and a value greater than zero if date1 is greater than date2
|
// and a value greater than zero if date1 is greater than date2
|
||||||
// the year field is ignored
|
// the year field is ignored
|
||||||
int Compare(const PT::Date & date1, const PT::Date & date2) const;
|
int Compare(const pt::Date & date1, const pt::Date & date2) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,23 +106,23 @@ public:
|
||||||
"tz_dst_end" the same as above
|
"tz_dst_end" the same as above
|
||||||
"tz_dst_offset" (long)
|
"tz_dst_offset" (long)
|
||||||
*/
|
*/
|
||||||
bool SetTz(PT::Space & space);
|
bool SetTz(pt::Space & space);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
converting from UTC to local time
|
converting from UTC to local time
|
||||||
*/
|
*/
|
||||||
time_t CalcLocalOffset(const PT::Date & utc_date);
|
time_t CalcLocalOffset(const pt::Date & utc_date);
|
||||||
time_t ToLocal(time_t utc_time);
|
time_t ToLocal(time_t utc_time);
|
||||||
PT::Date ToLocal(const PT::Date & utc_date);
|
pt::Date ToLocal(const pt::Date & utc_date);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
converting from local time to UTC
|
converting from local time to UTC
|
||||||
*/
|
*/
|
||||||
time_t CalcUTCOffset(const PT::Date & local_date);
|
time_t CalcUTCOffset(const pt::Date & local_date);
|
||||||
time_t ToUTC(time_t local_time);
|
time_t ToUTC(time_t local_time);
|
||||||
PT::Date ToUTC(const PT::Date & local_date);
|
pt::Date ToUTC(const pt::Date & local_date);
|
||||||
|
|
||||||
// return a Dst structure for the specified year
|
// return a Dst structure for the specified year
|
||||||
// or null if it not exists
|
// or null if it not exists
|
||||||
|
@ -155,8 +155,8 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
time_t ParseStrOffset(const wchar_t * str);
|
time_t ParseStrOffset(const wchar_t * str);
|
||||||
time_t GetOffset(PT::Space & space);
|
time_t GetOffset(pt::Space & space);
|
||||||
bool SetTzDst(PT::Space & year);
|
bool SetTzDst(pt::Space & year);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ void TimeZones::ParseZones()
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<temp_space.child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<temp_space.child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & zone = *((*temp_space.child_spaces)[i]);
|
pt::Space & zone = *((*temp_space.child_spaces)[i]);
|
||||||
temp_zone.Clear();
|
temp_zone.Clear();
|
||||||
|
|
||||||
if( temp_zone.SetTz(zone) )
|
if( temp_zone.SetTz(zone) )
|
||||||
|
@ -171,27 +171,27 @@ bool TimeZones::ReadTimeZones(const wchar_t * path)
|
||||||
zone_tab.clear();
|
zone_tab.clear();
|
||||||
temp_space.clear();
|
temp_space.clear();
|
||||||
|
|
||||||
PT::SpaceParser::Status status = parser.ParseSpaceFile(path);
|
pt::SpaceParser::Status status = parser.ParseSpaceFile(path);
|
||||||
|
|
||||||
if( status == PT::SpaceParser::ok )
|
if( status == pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
ParseZones();
|
ParseZones();
|
||||||
log << log2 << "Tz: time zones loaded, there are " << zone_tab.size() << " zones" << logend;
|
log << log2 << "Tz: time zones loaded, there are " << zone_tab.size() << " zones" << logend;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( status == PT::SpaceParser::syntax_error )
|
if( status == pt::SpaceParser::syntax_error )
|
||||||
{
|
{
|
||||||
log << log1 << "TZ: error in time zone file, line: " << parser.get_last_parsed_line() << logend;
|
log << log1 << "TZ: error in time zone file, line: " << parser.get_last_parsed_line() << logend;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( status == PT::SpaceParser::cant_open_file )
|
if( status == pt::SpaceParser::cant_open_file )
|
||||||
{
|
{
|
||||||
log << log1 << "TZ: I cannot open the time zone file: " << path << logend;
|
log << log1 << "TZ: I cannot open the time zone file: " << path << logend;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_space.clear();
|
temp_space.clear();
|
||||||
|
|
||||||
return status == PT::SpaceParser::ok;
|
return status == pt::SpaceParser::ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@ private:
|
||||||
// everywhere we use zone_index we refer to this table
|
// everywhere we use zone_index we refer to this table
|
||||||
std::vector<TimeZone> zone_tab;
|
std::vector<TimeZone> zone_tab;
|
||||||
|
|
||||||
PT::SpaceParser parser;
|
pt::SpaceParser parser;
|
||||||
PT::Space temp_space;
|
pt::Space temp_space;
|
||||||
TimeZone temp_zone;
|
TimeZone temp_zone;
|
||||||
|
|
||||||
void ParseZones();
|
void ParseZones();
|
||||||
|
|
|
@ -63,7 +63,7 @@ void WinixBase::set_synchro(Synchro * synchro)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinixBase::set_log_buffer(PT::WTextStream * log_buffer)
|
void WinixBase::set_log_buffer(pt::WTextStream * log_buffer)
|
||||||
{
|
{
|
||||||
log.SetLogBuffer(log_buffer);
|
log.SetLogBuffer(log_buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
|
|
||||||
void set_config(Config * config);
|
void set_config(Config * config);
|
||||||
void set_synchro(Synchro * synchro);
|
void set_synchro(Synchro * synchro);
|
||||||
void set_log_buffer(PT::WTextStream * log_buffer);
|
void set_log_buffer(pt::WTextStream * log_buffer);
|
||||||
void set_file_log(FileLog * file_log);
|
void set_file_log(FileLog * file_log);
|
||||||
|
|
||||||
Log * get_logger();
|
Log * get_logger();
|
||||||
|
|
|
@ -187,7 +187,7 @@ const std::wstring & DbBase::AssertValueWide(PGresult * r, int row, int col)
|
||||||
const char * res = AssertValue(r, row, col);
|
const char * res = AssertValue(r, row, col);
|
||||||
static std::wstring temp_wide_value; // !! IMPROVE ME add as a class field (nonstatic)
|
static std::wstring temp_wide_value; // !! IMPROVE ME add as a class field (nonstatic)
|
||||||
|
|
||||||
PT::UTF8ToWide(res, temp_wide_value);
|
pt::UTF8ToWide(res, temp_wide_value);
|
||||||
|
|
||||||
return temp_wide_value;
|
return temp_wide_value;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ void DbBase::AssertValueBin(PGresult * r, int row, int col, std::string & result
|
||||||
void DbBase::AssertValueWide(PGresult * r, int row, int col, std::wstring & result)
|
void DbBase::AssertValueWide(PGresult * r, int row, int col, std::wstring & result)
|
||||||
{
|
{
|
||||||
const char * res = AssertValue(r, row, col);
|
const char * res = AssertValue(r, row, col);
|
||||||
PT::UTF8ToWide(res, result);
|
pt::UTF8ToWide(res, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,28 +247,28 @@ unsigned int DbBase::AssertValueUInt(PGresult * r, int row, int col)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::Date DbBase::AssertValueDate(PGresult * r, int row, int col)
|
pt::Date DbBase::AssertValueDate(PGresult * r, int row, int col)
|
||||||
{
|
{
|
||||||
PT::Date date = AssertValue(r, row, col);
|
pt::Date date = AssertValue(r, row, col);
|
||||||
|
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DbBase::AssertValueSpace(PGresult * r, int row, int col, PT::Space & space)
|
bool DbBase::AssertValueSpace(PGresult * r, int row, int col, pt::Space & space)
|
||||||
{
|
{
|
||||||
const char * res = AssertValue(r, row, col);
|
const char * res = AssertValue(r, row, col);
|
||||||
|
|
||||||
conf_parser.SetSpace(space);
|
conf_parser.SetSpace(space);
|
||||||
space.clear();
|
space.clear();
|
||||||
|
|
||||||
PT::SpaceParser::Status status = conf_parser.ParseSpace(res);
|
pt::SpaceParser::Status status = conf_parser.ParseSpace(res);
|
||||||
|
|
||||||
if( status != PT::SpaceParser::ok )
|
if( status != pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
log << log1 << "Db: a problem with parsing a PT::Space";
|
log << log1 << "Db: a problem with parsing a PT::Space";
|
||||||
|
|
||||||
if( status == PT::SpaceParser::syntax_error )
|
if( status == pt::SpaceParser::syntax_error )
|
||||||
log << ", syntax error at line: " << conf_parser.get_last_parsed_line();
|
log << ", syntax error at line: " << conf_parser.get_last_parsed_line();
|
||||||
|
|
||||||
log << logend;
|
log << logend;
|
||||||
|
|
|
@ -80,9 +80,9 @@ public:
|
||||||
bool AssertValueBool(PGresult * r, int row, int col);
|
bool AssertValueBool(PGresult * r, int row, int col);
|
||||||
unsigned long AssertValueULong(PGresult * r, int row, int col);
|
unsigned long AssertValueULong(PGresult * r, int row, int col);
|
||||||
unsigned int AssertValueUInt(PGresult * r, int row, int col);
|
unsigned int AssertValueUInt(PGresult * r, int row, int col);
|
||||||
PT::Date AssertValueDate(PGresult * r, int row, int col);
|
pt::Date AssertValueDate(PGresult * r, int row, int col);
|
||||||
|
|
||||||
bool AssertValueSpace(PGresult * r, int row, int col, PT::Space & space);
|
bool AssertValueSpace(PGresult * r, int row, int col, pt::Space & space);
|
||||||
|
|
||||||
void ClearResult(PGresult * r);
|
void ClearResult(PGresult * r);
|
||||||
long AssertCurrval(const char * table);
|
long AssertCurrval(const char * table);
|
||||||
|
@ -129,7 +129,7 @@ private:
|
||||||
char UnescapeBinHexToDigit(char hex);
|
char UnescapeBinHexToDigit(char hex);
|
||||||
|
|
||||||
DbTextStream bquery;
|
DbTextStream bquery;
|
||||||
PT::SpaceParser conf_parser;
|
pt::SpaceParser conf_parser;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -225,11 +225,11 @@ return *this;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DbTextStream & DbTextStream::operator<<(RawText<PT::Date> date)
|
DbTextStream & DbTextStream::operator<<(RawText<pt::Date> date)
|
||||||
{
|
{
|
||||||
tmp_stream.Clear();
|
tmp_stream.Clear();
|
||||||
date.par.Serialize(tmp_stream);
|
date.par.Serialize(tmp_stream);
|
||||||
PT::WideToUTF8(tmp_stream.CStr(), buffer, false);
|
pt::WideToUTF8(tmp_stream.CStr(), buffer, false);
|
||||||
tmp_stream.Clear();
|
tmp_stream.Clear();
|
||||||
|
|
||||||
was_param = false;
|
was_param = false;
|
||||||
|
@ -290,7 +290,7 @@ DbTextStream & DbTextStream::ETextPutChar(wchar_t c)
|
||||||
buffer += "\\\'"; // don't use "''" because we use the method for PQconnectdb too
|
buffer += "\\\'"; // don't use "''" because we use the method for PQconnectdb too
|
||||||
else
|
else
|
||||||
if( c != 0 )
|
if( c != 0 )
|
||||||
PT::IntToUTF8(int(c), buffer, false);
|
pt::IntToUTF8(int(c), buffer, false);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -584,7 +584,7 @@ return *this;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DbTextStream & DbTextStream::operator<<(const PT::Space & space)
|
DbTextStream & DbTextStream::operator<<(const pt::Space & space)
|
||||||
{
|
{
|
||||||
tmp_stream.Clear();
|
tmp_stream.Clear();
|
||||||
// !! IMPROVE ME
|
// !! IMPROVE ME
|
||||||
|
@ -597,7 +597,7 @@ return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DbTextStream & DbTextStream::operator<<(const PT::Date & date)
|
DbTextStream & DbTextStream::operator<<(const pt::Date & date)
|
||||||
{
|
{
|
||||||
tmp_stream.Clear();
|
tmp_stream.Clear();
|
||||||
date.Serialize(tmp_stream);
|
date.Serialize(tmp_stream);
|
||||||
|
|
|
@ -143,10 +143,10 @@ public:
|
||||||
DbTextStream & operator<<(RawText<unsigned long> raw);
|
DbTextStream & operator<<(RawText<unsigned long> raw);
|
||||||
DbTextStream & operator<<(RawText<double> raw);
|
DbTextStream & operator<<(RawText<double> raw);
|
||||||
DbTextStream & operator<<(RawText<void*> raw);
|
DbTextStream & operator<<(RawText<void*> raw);
|
||||||
DbTextStream & operator<<(RawText<PT::Date> date);
|
DbTextStream & operator<<(RawText<pt::Date> date);
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
DbTextStream & operator<<(RawText<PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw);
|
DbTextStream & operator<<(RawText<pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
with escaping
|
with escaping
|
||||||
|
@ -183,11 +183,11 @@ public:
|
||||||
DbTextStream & operator<<(double);
|
DbTextStream & operator<<(double);
|
||||||
DbTextStream & operator<<(const void *);
|
DbTextStream & operator<<(const void *);
|
||||||
DbTextStream & operator<<(const std::vector<long> & tabid);
|
DbTextStream & operator<<(const std::vector<long> & tabid);
|
||||||
DbTextStream & operator<<(const PT::Space & space);
|
DbTextStream & operator<<(const pt::Space & space);
|
||||||
DbTextStream & operator<<(const PT::Date & date);
|
DbTextStream & operator<<(const pt::Date & date);
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
DbTextStream & operator<<(const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
DbTextStream & operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
DbTextStream & DbTextStream::operator<<(RawText<PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw)
|
DbTextStream & DbTextStream::operator<<(RawText<pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw)
|
||||||
{
|
{
|
||||||
TextStream<std::string>::operator<<(raw.par);
|
TextStream<std::string>::operator<<(raw.par);
|
||||||
|
|
||||||
|
@ -212,9 +212,9 @@ return *this;
|
||||||
|
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
DbTextStream & DbTextStream::operator<<(const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
DbTextStream & DbTextStream::operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
||||||
{
|
{
|
||||||
typename PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
typename pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
||||||
|
|
||||||
if( was_param )
|
if( was_param )
|
||||||
buffer += ", ";
|
buffer += ", ";
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool Env::Parse(const std::wstring & env_str)
|
||||||
space.clear();
|
space.clear();
|
||||||
conf_parser.SetSpace(space);
|
conf_parser.SetSpace(space);
|
||||||
|
|
||||||
return (conf_parser.ParseSpace(env_str) == PT::SpaceParser::ok);
|
return (conf_parser.ParseSpace(env_str) == pt::SpaceParser::ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
PT::SpaceParser conf_parser;
|
pt::SpaceParser conf_parser;
|
||||||
PT::Space space;
|
pt::Space space;
|
||||||
User * puser;
|
User * puser;
|
||||||
|
|
||||||
bool EditAdminEnv(const std::wstring & env_str, bool use_ses_log = false);
|
bool EditAdminEnv(const std::wstring & env_str, bool use_ses_log = false);
|
||||||
|
|
|
@ -296,7 +296,7 @@ void FunctionParser::ParseAnchor()
|
||||||
while( *path )
|
while( *path )
|
||||||
name_ascii += GetChar();
|
name_ascii += GetChar();
|
||||||
|
|
||||||
PT::UTF8ToWide(name_ascii, cur->request->anchor);
|
pt::UTF8ToWide(name_ascii, cur->request->anchor);
|
||||||
|
|
||||||
if( !cur->request->anchor.empty() )
|
if( !cur->request->anchor.empty() )
|
||||||
log << log3 << "FP: anchor: " << cur->request->anchor << logend;
|
log << log3 << "FP: anchor: " << cur->request->anchor << logend;
|
||||||
|
@ -368,7 +368,7 @@ void FunctionParser::ReadName()
|
||||||
while( *path && *path!='/' && *path!='?' && *path!='#' )
|
while( *path && *path!='/' && *path!='?' && *path!='#' )
|
||||||
name_ascii += GetChar();
|
name_ascii += GetChar();
|
||||||
|
|
||||||
PT::UTF8ToWide(name_ascii, name);
|
pt::UTF8ToWide(name_ascii, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ void FunctionParser::ReadOrdinaryParName()
|
||||||
while( *path && *path!='=' && *path!='&' && *path!='#' )
|
while( *path && *path!='=' && *path!='&' && *path!='#' )
|
||||||
name_ascii += GetChar();
|
name_ascii += GetChar();
|
||||||
|
|
||||||
PT::UTF8ToWide(name_ascii, name);
|
pt::UTF8ToWide(name_ascii, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ void FunctionParser::ReadOrdinaryParValue()
|
||||||
while( *path && *path!='&' && *path!='#' )
|
while( *path && *path!='&' && *path!='#' )
|
||||||
value_ascii += GetChar();
|
value_ascii += GetChar();
|
||||||
|
|
||||||
PT::UTF8ToWide(value_ascii, value);
|
pt::UTF8ToWide(value_ascii, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ void FunctionParser::ReadWinixParName()
|
||||||
while( *path && *path!='/' && *path!=':' && *path!='#' )
|
while( *path && *path!='/' && *path!=':' && *path!='#' )
|
||||||
name_ascii += GetChar();
|
name_ascii += GetChar();
|
||||||
|
|
||||||
PT::UTF8ToWide(name_ascii, name);
|
pt::UTF8ToWide(name_ascii, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ void FunctionParser::ReadWinixParValue()
|
||||||
while( *path && *path!='/' && *path!='#' )
|
while( *path && *path!='/' && *path!='#' )
|
||||||
value_ascii += GetChar();
|
value_ascii += GetChar();
|
||||||
|
|
||||||
PT::UTF8ToWide(value_ascii, value);
|
pt::UTF8ToWide(value_ascii, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ bool Login::CheckPasswords(User & user, const std::wstring & password)
|
||||||
{
|
{
|
||||||
if( system->crypt.RSA(false, config->pass_rsa_private_key, user.pass_encrypted, pass_decrypted) )
|
if( system->crypt.RSA(false, config->pass_rsa_private_key, user.pass_encrypted, pass_decrypted) )
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(pass_decrypted, user.password);
|
pt::UTF8ToWide(pass_decrypted, user.password);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,7 @@ void Login::CheckBan()
|
||||||
if( ip_ban->expires < expires )
|
if( ip_ban->expires < expires )
|
||||||
ip_ban->expires = expires;
|
ip_ban->expires = expires;
|
||||||
|
|
||||||
PT::Date date(ip_ban->expires);
|
pt::Date date(ip_ban->expires);
|
||||||
log << log2 << "Login: logging from this IP address has been blocked until to: " << date << " UTC" << logend;
|
log << log2 << "Login: logging from this IP address has been blocked until to: " << date << " UTC" << logend;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -65,7 +65,7 @@ bool Meta::Parse(const std::wstring & meta_str)
|
||||||
space.clear();
|
space.clear();
|
||||||
conf_parser.SetSpace(space);
|
conf_parser.SetSpace(space);
|
||||||
|
|
||||||
return (conf_parser.ParseSpace(meta_str) == PT::SpaceParser::ok);
|
return (conf_parser.ParseSpace(meta_str) == pt::SpaceParser::ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
PT::SpaceParser conf_parser;
|
pt::SpaceParser conf_parser;
|
||||||
PT::Space space;
|
pt::Space space;
|
||||||
|
|
||||||
bool Parse(const std::wstring & meta_str);
|
bool Parse(const std::wstring & meta_str);
|
||||||
void ChangeAdminMeta();
|
void ChangeAdminMeta();
|
||||||
|
|
|
@ -524,7 +524,7 @@ void Rm::Clear()
|
||||||
void Rm::CreateJSON(bool status)
|
void Rm::CreateJSON(bool status)
|
||||||
{
|
{
|
||||||
using TemplatesFunctions::R;
|
using TemplatesFunctions::R;
|
||||||
PT::WTextStream buf;
|
pt::WTextStream buf;
|
||||||
|
|
||||||
JSONescape(buf, cur->request->item.url);
|
JSONescape(buf, cur->request->item.url);
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ SortPair sp;
|
||||||
|
|
||||||
for( ; i2 != cur->request->post_tab.end() ; ++i2 )
|
for( ; i2 != cur->request->post_tab.end() ; ++i2 )
|
||||||
{
|
{
|
||||||
if( PT::is_substr_nc(L"sort", i2->first.c_str()) )
|
if( pt::is_substr_nc(L"sort", i2->first.c_str()) )
|
||||||
{
|
{
|
||||||
sp.id = Tol(i2->first.c_str() + 4);
|
sp.id = Tol(i2->first.c_str() + 4);
|
||||||
sp.sort_index = Toi(i2->second);
|
sp.sort_index = Toi(i2->second);
|
||||||
|
|
|
@ -306,11 +306,11 @@ void Upload::MakePost()
|
||||||
void Upload::CreateAnswer()
|
void Upload::CreateAnswer()
|
||||||
{
|
{
|
||||||
Request & req = *cur->request;
|
Request & req = *cur->request;
|
||||||
PT::Space & files = req.info.add_empty_space(L"files");
|
pt::Space & files = req.info.add_empty_space(L"files");
|
||||||
|
|
||||||
for(size_t i=0 ; i<req.item_tab.size() ; ++i)
|
for(size_t i=0 ; i<req.item_tab.size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & file = files.add_empty_space();
|
pt::Space & file = files.add_empty_space();
|
||||||
|
|
||||||
file.add(L"name", req.item_tab[i].url);
|
file.add(L"name", req.item_tab[i].url);
|
||||||
file.add(L"size", req.item_tab[i].item_content.file_size);
|
file.add(L"size", req.item_tab[i].item_content.file_size);
|
||||||
|
|
|
@ -101,7 +101,7 @@ void CloseDescriptors()
|
||||||
void LogInfo(Log & log, LogManipulators log_level, const char * msg, bool put_version, const char * msg2)
|
void LogInfo(Log & log, LogManipulators log_level, const char * msg, bool put_version, const char * msg2)
|
||||||
{
|
{
|
||||||
log << log_level;
|
log << log_level;
|
||||||
log.PrintDate(PT::Date(std::time(0)));
|
log.PrintDate(pt::Date(std::time(0)));
|
||||||
log << ' ' << msg;
|
log << ' ' << msg;
|
||||||
|
|
||||||
if( put_version )
|
if( put_version )
|
||||||
|
@ -120,7 +120,7 @@ void SavePidFile(Log & log)
|
||||||
if( !app.config.pid_file.empty() )
|
if( !app.config.pid_file.empty() )
|
||||||
{
|
{
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
PT::WideToUTF8(app.config.pid_file, file_name);
|
pt::WideToUTF8(app.config.pid_file, file_name);
|
||||||
std::ofstream file(file_name);
|
std::ofstream file(file_name);
|
||||||
|
|
||||||
if( !file )
|
if( !file )
|
||||||
|
@ -142,7 +142,7 @@ void RemovePidFile()
|
||||||
if( !app.config.pid_file.empty() )
|
if( !app.config.pid_file.empty() )
|
||||||
{
|
{
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
PT::WideToUTF8(app.config.pid_file, file_name);
|
pt::WideToUTF8(app.config.pid_file, file_name);
|
||||||
unlink(file_name.c_str());
|
unlink(file_name.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ using Winix::app;
|
||||||
|
|
||||||
app.system.system_start = time(0);
|
app.system.system_start = time(0);
|
||||||
|
|
||||||
if( !PT::UTF8ToWide(argc[1], app.config.config_file) )
|
if( !pt::UTF8ToWide(argc[1], app.config.config_file) )
|
||||||
{
|
{
|
||||||
std::wcout << "An incorrect UTF-8 path of the config file" << std::endl;
|
std::wcout << "An incorrect UTF-8 path of the config file" << std::endl;
|
||||||
return 6;
|
return 6;
|
||||||
|
|
|
@ -103,7 +103,7 @@ bool Item::insert(morm::ModelData * model_data, bool update_whole_tree)
|
||||||
{
|
{
|
||||||
if( !url_prepared_correctly )
|
if( !url_prepared_correctly )
|
||||||
{
|
{
|
||||||
PT::Toa(id, url);
|
pt::Toa(id, url);
|
||||||
insert_status = morm::Model::update(model_data, false);
|
insert_status = morm::Model::update(model_data, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ bool Item::update(morm::ModelData * model_data, bool update_whole_tree)
|
||||||
{
|
{
|
||||||
if( !url_prepared_correctly )
|
if( !url_prepared_correctly )
|
||||||
{
|
{
|
||||||
PT::Toa(id, url);
|
pt::Toa(id, url);
|
||||||
update_status = morm::Model::update(model_data, false);
|
update_status = morm::Model::update(model_data, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ std::wstring postfix;
|
||||||
if( index > 1 )
|
if( index > 1 )
|
||||||
{
|
{
|
||||||
postfix = L"_(";
|
postfix = L"_(";
|
||||||
PT::Toa(index, postfix, false);
|
pt::Toa(index, postfix, false);
|
||||||
postfix += L")";
|
postfix += L")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,14 +291,14 @@ bool Item::do_migration_to_2()
|
||||||
eq(L"content_id", -1).
|
eq(L"content_id", -1).
|
||||||
get_list();
|
get_list();
|
||||||
|
|
||||||
PT::Log * log = model_connector->get_logger();
|
pt::Log * log = model_connector->get_logger();
|
||||||
|
|
||||||
for(Item & item : list)
|
for(Item & item : list)
|
||||||
{
|
{
|
||||||
if( log )
|
if( log )
|
||||||
{
|
{
|
||||||
(*log) << "Item: adding a content row corresponding to item id: " << item.id << ", type: " << (int)item.type << ", url: " << item.url
|
(*log) << "Item: adding a content row corresponding to item id: " << item.id << ", type: " << (int)item.type << ", url: " << item.url
|
||||||
<< ", subject: " << item.subject << PT::Log::logend;
|
<< ", subject: " << item.subject << pt::Log::logend;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.item_content.set_save_mode(morm::Model::DO_INSERT_ON_SAVE);
|
item.item_content.set_save_mode(morm::Model::DO_INSERT_ON_SAVE);
|
||||||
|
|
|
@ -113,12 +113,12 @@ public:
|
||||||
/*
|
/*
|
||||||
* when the object was created
|
* when the object was created
|
||||||
*/
|
*/
|
||||||
PT::Date date_creation;
|
pt::Date date_creation;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* when the object was last modified
|
* when the object was last modified
|
||||||
*/
|
*/
|
||||||
PT::Date date_modification;
|
pt::Date date_modification;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,13 +201,13 @@ public:
|
||||||
* meta information
|
* meta information
|
||||||
* additional information in the form af a Space struct
|
* additional information in the form af a Space struct
|
||||||
*/
|
*/
|
||||||
PT::Space meta;
|
pt::Space meta;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* admin meta information
|
* admin meta information
|
||||||
* additional information available to edit only by an admin
|
* additional information available to edit only by an admin
|
||||||
*/
|
*/
|
||||||
PT::Space meta_admin;
|
pt::Space meta_admin;
|
||||||
|
|
||||||
|
|
||||||
ItemContent();
|
ItemContent();
|
||||||
|
|
|
@ -78,19 +78,19 @@ bool Migration::do_migration(morm::ModelConnector * model_connector, morm::Model
|
||||||
migration.table_version = current_table_version;
|
migration.table_version = current_table_version;
|
||||||
migration_status = migration.save();
|
migration_status = migration.save();
|
||||||
|
|
||||||
PT::Log * log = model_connector->get_logger();
|
pt::Log * log = model_connector->get_logger();
|
||||||
|
|
||||||
if( log )
|
if( log )
|
||||||
{
|
{
|
||||||
(*log) << PT::Log::log2 << "Migration: table " << table_name << " has been migrated to version " << current_table_version << PT::Log::logend;
|
(*log) << pt::Log::log2 << "Migration: table " << table_name << " has been migrated to version " << current_table_version << pt::Log::logend;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !migration_status && log )
|
if( !migration_status && log )
|
||||||
{
|
{
|
||||||
(*log) << PT::Log::log1 << "Migration: table " << table_name << " has been migrated to version " << current_table_version;
|
(*log) << pt::Log::log1 << "Migration: table " << table_name << " has been migrated to version " << current_table_version;
|
||||||
(*log) << " but there was a problem with saving this information in the migration table." << PT::Log::logend;
|
(*log) << " but there was a problem with saving this information in the migration table." << pt::Log::logend;
|
||||||
(*log) << "Make sure the migration table is created and save/update following record there:" << PT::Log::logend;
|
(*log) << "Make sure the migration table is created and save/update following record there:" << pt::Log::logend;
|
||||||
(*log) << migration << PT::Log::logend;
|
(*log) << migration << pt::Log::logend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
long id;
|
long id;
|
||||||
std::wstring table_name;
|
std::wstring table_name;
|
||||||
int table_version;
|
int table_version;
|
||||||
PT::Date migration_date;
|
pt::Date migration_date;
|
||||||
|
|
||||||
|
|
||||||
void fields()
|
void fields()
|
||||||
|
|
|
@ -107,12 +107,12 @@ public:
|
||||||
|
|
||||||
// environment variables which can be set by this user
|
// environment variables which can be set by this user
|
||||||
// use 'env' winix function
|
// use 'env' winix function
|
||||||
PT::Space env;
|
pt::Space env;
|
||||||
|
|
||||||
// environment variables set only by an administrator
|
// environment variables set only by an administrator
|
||||||
// an administrator can use 'env' winix function with 'a' parameter
|
// an administrator can use 'env' winix function with 'a' parameter
|
||||||
// IMPROVEME rename me to something better (env_admin?)
|
// IMPROVEME rename me to something better (env_admin?)
|
||||||
PT::Space aenv;
|
pt::Space aenv;
|
||||||
|
|
||||||
// account status
|
// account status
|
||||||
// WINIX_ACCOUNT_*
|
// WINIX_ACCOUNT_*
|
||||||
|
@ -138,7 +138,7 @@ public:
|
||||||
|
|
||||||
void Clear(); // IMPROVEME what about clear() from Model?
|
void Clear(); // IMPROVEME what about clear() from Model?
|
||||||
bool IsMemberOf(long group);
|
bool IsMemberOf(long group);
|
||||||
bool ReadMonthDayTime(PT::Date & date, const wchar_t * str);
|
bool ReadMonthDayTime(pt::Date & date, const wchar_t * str);
|
||||||
bool SetTzFromEnv();
|
bool SetTzFromEnv();
|
||||||
|
|
||||||
void clear_passwords();
|
void clear_passwords();
|
||||||
|
|
|
@ -258,7 +258,7 @@ void NotifyThread::SendMail()
|
||||||
// second thread
|
// second thread
|
||||||
void NotifyThread::SendMail(const std::wstring & email, const std::wstring & message)
|
void NotifyThread::SendMail(const std::wstring & email, const std::wstring & message)
|
||||||
{
|
{
|
||||||
log << log1 << PT::Date(std::time(0)) << ' ';
|
log << log1 << pt::Date(std::time(0)) << ' ';
|
||||||
|
|
||||||
if( !ValidateEmail(email) )
|
if( !ValidateEmail(email) )
|
||||||
{
|
{
|
||||||
|
@ -267,7 +267,7 @@ void NotifyThread::SendMail(const std::wstring & email, const std::wstring & mes
|
||||||
}
|
}
|
||||||
|
|
||||||
sendmail_command = "sendmail ";
|
sendmail_command = "sendmail ";
|
||||||
PT::WideToUTF8(email, sendmail_command, false);
|
pt::WideToUTF8(email, sendmail_command, false);
|
||||||
FILE * sendmail = popen(sendmail_command.c_str(), "w");
|
FILE * sendmail = popen(sendmail_command.c_str(), "w");
|
||||||
|
|
||||||
if( !sendmail )
|
if( !sendmail )
|
||||||
|
@ -297,7 +297,7 @@ size_t len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = PT::IntToUTF8(int(message[i]), buf, sizeof(buf) / sizeof(char));
|
len = pt::IntToUTF8(int(message[i]), buf, sizeof(buf) / sizeof(char));
|
||||||
|
|
||||||
for(size_t a=0 ; a<len ; ++a)
|
for(size_t a=0 ; a<len ; ++a)
|
||||||
fputc(buf[a], sendmail);
|
fputc(buf[a], sendmail);
|
||||||
|
|
|
@ -123,7 +123,7 @@ bool ExportInfo::DecodePass(Export & exp)
|
||||||
/*
|
/*
|
||||||
if( system->crypt.RSA(false, rsa_key, exp.ftp_pass_bin, pass_decrypted) )
|
if( system->crypt.RSA(false, rsa_key, exp.ftp_pass_bin, pass_decrypted) )
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(pass_decrypted, exp.ftp_pass);
|
pt::UTF8ToWide(pass_decrypted, exp.ftp_pass);
|
||||||
system->crypt.ClearString(pass_decrypted);
|
system->crypt.ClearString(pass_decrypted);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -143,7 +143,7 @@ bool ExportInfo::SkipDir(long dir_id, std::wstring & dir)
|
||||||
{
|
{
|
||||||
if( system->dirs.MakePath(dir_id, tmp_dir) )
|
if( system->dirs.MakePath(dir_id, tmp_dir) )
|
||||||
{
|
{
|
||||||
if( !tmp_dir.empty() && PT::is_substr(tmp_dir, dir) )
|
if( !tmp_dir.empty() && pt::is_substr(tmp_dir, dir) )
|
||||||
{
|
{
|
||||||
// tmp_dir has a slash at the end
|
// tmp_dir has a slash at the end
|
||||||
// we want the slash at the beginning
|
// we want the slash at the beginning
|
||||||
|
@ -334,7 +334,7 @@ void ExportInfo::AdditionalExport(const Item & item)
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<item.item_content.meta.child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<item.item_content.meta.child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & child = *(*item.item_content.meta.child_spaces)[i];
|
pt::Space & child = *(*item.item_content.meta.child_spaces)[i];
|
||||||
|
|
||||||
if( child.name && *child.name == L"export" )
|
if( child.name && *child.name == L"export" )
|
||||||
AdditionalExport(item, child);
|
AdditionalExport(item, child);
|
||||||
|
@ -343,7 +343,7 @@ void ExportInfo::AdditionalExport(const Item & item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExportInfo::AdditionalExport(const Item & item, PT::Space & meta)
|
void ExportInfo::AdditionalExport(const Item & item, pt::Space & meta)
|
||||||
{
|
{
|
||||||
meta.to_list(L"additional_export", additional_export);
|
meta.to_list(L"additional_export", additional_export);
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ private:
|
||||||
bool SkipDir(long dir_id, std::wstring & dir);
|
bool SkipDir(long dir_id, std::wstring & dir);
|
||||||
|
|
||||||
void AdditionalExport(const Item & item);
|
void AdditionalExport(const Item & item);
|
||||||
void AdditionalExport(const Item & item, PT::Space & meta);
|
void AdditionalExport(const Item & item, pt::Space & meta);
|
||||||
void AdditionalExport(const std::wstring & path);
|
void AdditionalExport(const std::wstring & path);
|
||||||
|
|
||||||
bool HasRecurrenceId(long id);
|
bool HasRecurrenceId(long id);
|
||||||
|
|
|
@ -262,7 +262,7 @@ return len;
|
||||||
void ExportThread::Convert(const std::wstring & in, std::string & out, bool clear)
|
void ExportThread::Convert(const std::wstring & in, std::string & out, bool clear)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
PT::WideToUTF8(in, out, clear);
|
pt::WideToUTF8(in, out, clear);
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,13 +393,13 @@ bool ExportThread::HasThumbInAdress(std::string & buf, size_t i)
|
||||||
|
|
||||||
for( ; i<buf.size() ; ++i)
|
for( ; i<buf.size() ; ++i)
|
||||||
{
|
{
|
||||||
if( PT::is_substr(thumb1, &buf[i]) )
|
if( pt::is_substr(thumb1, &buf[i]) )
|
||||||
{
|
{
|
||||||
buf.erase(i, len1);
|
buf.erase(i, len1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PT::is_substr(thumb2, &buf[i]) )
|
if( pt::is_substr(thumb2, &buf[i]) )
|
||||||
{
|
{
|
||||||
buf.erase(i, len2);
|
buf.erase(i, len2);
|
||||||
return true;
|
return true;
|
||||||
|
@ -427,7 +427,7 @@ void ExportThread::ChangeAdressesThumb(std::string & buf, const char * http_pref
|
||||||
|
|
||||||
for(size_t i=0 ; i<buf.size() ; ++i)
|
for(size_t i=0 ; i<buf.size() ; ++i)
|
||||||
{
|
{
|
||||||
if( PT::is_substr(look_for_url.c_str(), &buf[i]) )
|
if( pt::is_substr(look_for_url.c_str(), &buf[i]) )
|
||||||
{
|
{
|
||||||
i += look_for_url.size() - 1; // without skipping the last slash
|
i += look_for_url.size() - 1; // without skipping the last slash
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,10 @@ Groups * GroupInfo::FindGroups(long dir_id)
|
||||||
bool GroupInfo::ParseGroups(const std::wstring & str, Groups & groups)
|
bool GroupInfo::ParseGroups(const std::wstring & str, Groups & groups)
|
||||||
{
|
{
|
||||||
groups.Clear();
|
groups.Clear();
|
||||||
PT::Space & space = *groups.GetSpace();
|
pt::Space & space = *groups.GetSpace();
|
||||||
conf_parser.SetSpace(space);
|
conf_parser.SetSpace(space);
|
||||||
|
|
||||||
if( conf_parser.ParseSpace(str) == PT::SpaceParser::ok )
|
if( conf_parser.ParseSpace(str) == pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
groups.Reindex();
|
groups.Reindex();
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ bool GroupInfo::ParseGroups(const std::wstring & str, Groups & groups)
|
||||||
groups.Clear();
|
groups.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf_parser.status == PT::SpaceParser::ok;
|
return conf_parser.status == pt::SpaceParser::ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ private:
|
||||||
typedef std::map<long, GroupsWrapItem> GroupsWrap;
|
typedef std::map<long, GroupsWrapItem> GroupsWrap;
|
||||||
GroupsWrap groups_wrap;
|
GroupsWrap groups_wrap;
|
||||||
|
|
||||||
PT::SpaceParser conf_parser;
|
pt::SpaceParser conf_parser;
|
||||||
std::vector<Item*> config_dir_tab;
|
std::vector<Item*> config_dir_tab;
|
||||||
Item config_file;
|
Item config_file;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace GroupItem
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::Space * Groups::GetSpace()
|
pt::Space * Groups::GetSpace()
|
||||||
{
|
{
|
||||||
return &space;
|
return &space;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ void Groups::Reindex()
|
||||||
{
|
{
|
||||||
while( seti < space.child_spaces->size() )
|
while( seti < space.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[seti];
|
pt::Space & sp = *(*space.child_spaces)[seti];
|
||||||
|
|
||||||
if( sp.name )
|
if( sp.name )
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ void Groups::Reindex()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Groups::ReindexGroups(GroupIndex & group_index, PT::Space & set)
|
void Groups::ReindexGroups(GroupIndex & group_index, pt::Space & set)
|
||||||
{
|
{
|
||||||
size_t i, v;
|
size_t i, v;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ size_t i, v;
|
||||||
// loop through all groups in the set
|
// loop through all groups in the set
|
||||||
for( i=0 ; i < set.child_spaces->size() ; ++i )
|
for( i=0 ; i < set.child_spaces->size() ; ++i )
|
||||||
{
|
{
|
||||||
PT::Space & group = *(*set.child_spaces)[i];
|
pt::Space & group = *(*set.child_spaces)[i];
|
||||||
// !! IMPROVE ME will be safer to copy the value out
|
// !! IMPROVE ME will be safer to copy the value out
|
||||||
// if we used accidently the group.Text later the key
|
// if we used accidently the group.Text later the key
|
||||||
// would be overwritten
|
// would be overwritten
|
||||||
|
@ -141,7 +141,7 @@ size_t i, v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Groups::SortValues(PT::Space & group)
|
void Groups::SortValues(pt::Space & group)
|
||||||
{
|
{
|
||||||
sort_by = group.to_wstr(L"sort_by");
|
sort_by = group.to_wstr(L"sort_by");
|
||||||
sort_asc = group.is_equal(L"sort_asc", L"true");
|
sort_asc = group.is_equal(L"sort_asc", L"true");
|
||||||
|
@ -154,7 +154,7 @@ void Groups::SortValues(PT::Space & group)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Groups::SortFunHelper::operator()(PT::Space * sp1, PT::Space * sp2)
|
bool Groups::SortFunHelper::operator()(pt::Space * sp1, pt::Space * sp2)
|
||||||
{
|
{
|
||||||
const std::wstring * val1 = sp1->get_wstr(groups->sort_by.c_str());
|
const std::wstring * val1 = sp1->get_wstr(groups->sort_by.c_str());
|
||||||
const std::wstring * val2 = sp2->get_wstr(groups->sort_by.c_str());
|
const std::wstring * val2 = sp2->get_wstr(groups->sort_by.c_str());
|
||||||
|
@ -208,11 +208,11 @@ const std::wstring & Groups::GetOption(size_t seti, size_t groupi, size_t valuei
|
||||||
{
|
{
|
||||||
if( space.child_spaces && seti < space.child_spaces->size() )
|
if( space.child_spaces && seti < space.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & groups = *(*space.child_spaces)[seti];
|
pt::Space & groups = *(*space.child_spaces)[seti];
|
||||||
|
|
||||||
if( groups.child_spaces && groupi < groups.child_spaces->size() )
|
if( groups.child_spaces && groupi < groups.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & value = *(*groups.child_spaces)[groupi];
|
pt::Space & value = *(*groups.child_spaces)[groupi];
|
||||||
|
|
||||||
if( value.child_spaces && valuei < value.child_spaces->size() )
|
if( value.child_spaces && valuei < value.child_spaces->size() )
|
||||||
{
|
{
|
||||||
|
@ -239,7 +239,7 @@ size_t Groups::Size(size_t seti, size_t groupi)
|
||||||
{
|
{
|
||||||
if( space.child_spaces && seti < space.child_spaces->size() )
|
if( space.child_spaces && seti < space.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & groups = *(*space.child_spaces)[seti];
|
pt::Space & groups = *(*space.child_spaces)[seti];
|
||||||
|
|
||||||
if( groups.child_spaces && groupi < groups.child_spaces->size() )
|
if( groups.child_spaces && groupi < groups.child_spaces->size() )
|
||||||
return (*groups.child_spaces)[groupi]->child_spaces->size();
|
return (*groups.child_spaces)[groupi]->child_spaces->size();
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
reading all space
|
reading all space
|
||||||
(sets and groups)
|
(sets and groups)
|
||||||
*/
|
*/
|
||||||
PT::Space * GetSpace();
|
pt::Space * GetSpace();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -110,7 +110,7 @@ private:
|
||||||
# sets should have a unique name
|
# sets should have a unique name
|
||||||
# groups don't have a name
|
# groups don't have a name
|
||||||
*/
|
*/
|
||||||
PT::Space space;
|
pt::Space space;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -143,13 +143,13 @@ private:
|
||||||
Groups * groups;
|
Groups * groups;
|
||||||
SortFunHelper(Groups * pgroups) : groups(pgroups) {};
|
SortFunHelper(Groups * pgroups) : groups(pgroups) {};
|
||||||
size_t SortValue(const std::wstring & val);
|
size_t SortValue(const std::wstring & val);
|
||||||
bool operator()(PT::Space * sp1, PT::Space * sp2);
|
bool operator()(pt::Space * sp1, pt::Space * sp2);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ReindexGroups(GroupIndex & group_index, PT::Space & set);
|
void ReindexGroups(GroupIndex & group_index, pt::Space & set);
|
||||||
void SortValues(PT::Space & group);
|
void SortValues(pt::Space & group);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,18 +73,18 @@ void AddWinixFunctions(PluginInfo & info)
|
||||||
// create a class from these methods
|
// create a class from these methods
|
||||||
void ReloadConfigFile(PluginInfo & info, Item & file)
|
void ReloadConfigFile(PluginInfo & info, Item & file)
|
||||||
{
|
{
|
||||||
PT::Space space;
|
pt::Space space;
|
||||||
PT::SpaceParser parser;
|
pt::SpaceParser parser;
|
||||||
|
|
||||||
parser.SetSpace(space);
|
parser.SetSpace(space);
|
||||||
PT::SpaceParser::Status status = parser.ParseSpace(file.item_content.content_raw);
|
pt::SpaceParser::Status status = parser.ParseSpace(file.item_content.content_raw);
|
||||||
|
|
||||||
if( status == PT::SpaceParser::syntax_error )
|
if( status == pt::SpaceParser::syntax_error )
|
||||||
{
|
{
|
||||||
info.log << log1 << "MR: syntax error in file: " << file.url << ", line: " << parser.get_last_parsed_line() << " (skipping this file)" << logend;
|
info.log << log1 << "MR: syntax error in file: " << file.url << ", line: " << parser.get_last_parsed_line() << " (skipping this file)" << logend;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( status == PT::SpaceParser::ok )
|
if( status == pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
std::wstring * list_id_str = space.get_wstr(L"list_id");
|
std::wstring * list_id_str = space.get_wstr(L"list_id");
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct MenuItem
|
||||||
long id; // item id
|
long id; // item id
|
||||||
std::wstring url;
|
std::wstring url;
|
||||||
std::wstring subject;
|
std::wstring subject;
|
||||||
PT::Space meta;
|
pt::Space meta;
|
||||||
Item::Type type;
|
Item::Type type;
|
||||||
int file_type;
|
int file_type;
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,7 +77,7 @@ void Seo::MakePost()
|
||||||
|
|
||||||
item.subject = subject;
|
item.subject = subject;
|
||||||
|
|
||||||
PT::Space & seo = item.item_content.meta.find_add_child_space(L"seo");
|
pt::Space & seo = item.item_content.meta.find_add_child_space(L"seo");
|
||||||
seo.add(L"description", description);
|
seo.add(L"description", description);
|
||||||
seo.add(L"keywords", keywords);
|
seo.add(L"keywords", keywords);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void Stats::ReadStats()
|
||||||
if( stats_file.empty() )
|
if( stats_file.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PT::WideToUTF8(stats_file, astats_file);
|
pt::WideToUTF8(stats_file, astats_file);
|
||||||
std::ifstream file(astats_file.c_str());
|
std::ifstream file(astats_file.c_str());
|
||||||
|
|
||||||
if( !file )
|
if( !file )
|
||||||
|
@ -147,7 +147,7 @@ void Stats::SaveStats()
|
||||||
if( stats_file.empty() )
|
if( stats_file.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PT::WideToUTF8(stats_file, astats_file);
|
pt::WideToUTF8(stats_file, astats_file);
|
||||||
std::ofstream file(astats_file.c_str());
|
std::ofstream file(astats_file.c_str());
|
||||||
|
|
||||||
if( !file )
|
if( !file )
|
||||||
|
|
|
@ -80,7 +80,7 @@ bool Reply::HasAccess()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
PT::Space * thread_space = cur->request->item.item_content.meta_admin.find_child_space(L"thread");
|
pt::Space * thread_space = cur->request->item.item_content.meta_admin.find_child_space(L"thread");
|
||||||
|
|
||||||
if( thread_space )
|
if( thread_space )
|
||||||
{
|
{
|
||||||
|
|
|
@ -298,7 +298,7 @@ void thread_sort_tab_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
if( item_sort_index < thread_info.item_sort_tab.size() )
|
if( item_sort_index < thread_info.item_sort_tab.size() )
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->item_content.date_creation);
|
pt::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->item_content.date_creation);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ void thread_sort_tab_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
if( item_sort_index < thread_info.item_sort_tab.size() )
|
if( item_sort_index < thread_info.item_sort_tab.size() )
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->item_content.date_modification);
|
pt::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->item_content.date_modification);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,8 +337,8 @@ void thread_sort_tab_dates_equal(Info & i)
|
||||||
{
|
{
|
||||||
if( item_sort_index < thread_info.item_sort_tab.size() )
|
if( item_sort_index < thread_info.item_sort_tab.size() )
|
||||||
{
|
{
|
||||||
PT::Date & date1 = thread_info.item_sort_tab[item_sort_index]->item_content.date_creation;
|
pt::Date & date1 = thread_info.item_sort_tab[item_sort_index]->item_content.date_creation;
|
||||||
PT::Date & date2 = thread_info.item_sort_tab[item_sort_index]->item_content.date_modification;
|
pt::Date & date2 = thread_info.item_sort_tab[item_sort_index]->item_content.date_modification;
|
||||||
|
|
||||||
i.res = date1 == date2;
|
i.res = date1 == date2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
// the last file in a thread
|
// the last file in a thread
|
||||||
long last_item_id;
|
long last_item_id;
|
||||||
PT::Date last_item_date_modification;
|
pt::Date last_item_date_modification;
|
||||||
long last_item_user_id;
|
long last_item_user_id;
|
||||||
std::wstring last_item_guest_name;
|
std::wstring last_item_guest_name;
|
||||||
|
|
||||||
|
|
|
@ -164,13 +164,13 @@ return ticket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PT::Space & CreateTicket::PrepareSpace()
|
pt::Space & CreateTicket::PrepareSpace()
|
||||||
{
|
{
|
||||||
SessionData * session_data = reinterpret_cast<SessionData*>(
|
SessionData * session_data = reinterpret_cast<SessionData*>(
|
||||||
cur->session->plugin_data.Get(ticket_info->plugin_id) );
|
cur->session->plugin_data.Get(ticket_info->plugin_id) );
|
||||||
|
|
||||||
long dir_id = cur->request->dir_tab.back()->id;
|
long dir_id = cur->request->dir_tab.back()->id;
|
||||||
PT::Space & new_space = session_data->GetNewSpace(dir_id, session_data->create_space_map);
|
pt::Space & new_space = session_data->GetNewSpace(dir_id, session_data->create_space_map);
|
||||||
|
|
||||||
return new_space;
|
return new_space;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ void CreateTicket::MakePost()
|
||||||
ticket_info->FindCurrentConf();
|
ticket_info->FindCurrentConf();
|
||||||
|
|
||||||
Ticket & ticket = PrepareTicket();
|
Ticket & ticket = PrepareTicket();
|
||||||
PT::Space & meta = PrepareSpace();
|
pt::Space & meta = PrepareSpace();
|
||||||
Item & item = cur->request->item;
|
Item & item = cur->request->item;
|
||||||
ticket_info->ticket = &ticket;
|
ticket_info->ticket = &ticket;
|
||||||
ticket_info->item = &item;
|
ticket_info->item = &item;
|
||||||
|
@ -209,7 +209,7 @@ void CreateTicket::MakeGet()
|
||||||
ticket_info->FindCurrentConf();
|
ticket_info->FindCurrentConf();
|
||||||
|
|
||||||
Ticket & ticket = PrepareTicket();
|
Ticket & ticket = PrepareTicket();
|
||||||
PT::Space & meta = PrepareSpace();
|
pt::Space & meta = PrepareSpace();
|
||||||
ticket_info->ticket = &ticket;
|
ticket_info->ticket = &ticket;
|
||||||
ticket_info->item = &cur->request->item;
|
ticket_info->item = &cur->request->item;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ private:
|
||||||
void Submit(Ticket & ticket, Item & item);
|
void Submit(Ticket & ticket, Item & item);
|
||||||
void RemoveTmpTicket();
|
void RemoveTmpTicket();
|
||||||
Ticket & PrepareTicket();
|
Ticket & PrepareTicket();
|
||||||
PT::Space & PrepareSpace();
|
pt::Space & PrepareSpace();
|
||||||
|
|
||||||
TDb * tdb;
|
TDb * tdb;
|
||||||
TicketInfo * ticket_info;
|
TicketInfo * ticket_info;
|
||||||
|
|
|
@ -174,23 +174,23 @@ return ticket;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::Space & EditTicket::PrepareSpace()
|
pt::Space & EditTicket::PrepareSpace()
|
||||||
{
|
{
|
||||||
SessionData * session_data = reinterpret_cast<SessionData*>(
|
SessionData * session_data = reinterpret_cast<SessionData*>(
|
||||||
cur->session->plugin_data.Get(ticket_info->plugin_id) );
|
cur->session->plugin_data.Get(ticket_info->plugin_id) );
|
||||||
|
|
||||||
bool is_new;
|
bool is_new;
|
||||||
long file_id = cur->request->item.id;
|
long file_id = cur->request->item.id;
|
||||||
PT::Space & new_space = session_data->GetNewSpace(file_id, session_data->edit_space_map, &is_new);
|
pt::Space & new_space = session_data->GetNewSpace(file_id, session_data->edit_space_map, &is_new);
|
||||||
|
|
||||||
if( is_new )
|
if( is_new )
|
||||||
{
|
{
|
||||||
PT::Space * ticket_space = cur->request->item.item_content.meta.find_child_space(L"ticket");
|
pt::Space * ticket_space = cur->request->item.item_content.meta.find_child_space(L"ticket");
|
||||||
|
|
||||||
if( ticket_space )
|
if( ticket_space )
|
||||||
{
|
{
|
||||||
new_space = *ticket_space;
|
new_space = *ticket_space;
|
||||||
PT::Space & old_space = session_data->GetOldSpace(file_id, session_data->edit_space_map);
|
pt::Space & old_space = session_data->GetOldSpace(file_id, session_data->edit_space_map);
|
||||||
old_space = new_space;
|
old_space = new_space;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,10 +203,10 @@ bool EditTicket::CloseTicket()
|
||||||
{
|
{
|
||||||
cur->request->item.propagate_connector();
|
cur->request->item.propagate_connector();
|
||||||
|
|
||||||
PT::Space & ticket_space = cur->request->item.item_content.meta_admin.find_add_child_space(L"ticket");
|
pt::Space & ticket_space = cur->request->item.item_content.meta_admin.find_add_child_space(L"ticket");
|
||||||
ticket_space.add(L"closed", true);
|
ticket_space.add(L"closed", true);
|
||||||
|
|
||||||
PT::Space & thread_space = cur->request->item.item_content.meta_admin.find_add_child_space(L"thread");
|
pt::Space & thread_space = cur->request->item.item_content.meta_admin.find_add_child_space(L"thread");
|
||||||
thread_space.add(L"closed", true);
|
thread_space.add(L"closed", true);
|
||||||
|
|
||||||
//if( db->EditAdminMetaById(cur->request->item.ameta, cur->request->item.id) == WINIX_ERR_OK )
|
//if( db->EditAdminMetaById(cur->request->item.ameta, cur->request->item.id) == WINIX_ERR_OK )
|
||||||
|
@ -228,7 +228,7 @@ void EditTicket::MakePost()
|
||||||
ticket_info->FindCurrentConf();
|
ticket_info->FindCurrentConf();
|
||||||
|
|
||||||
Ticket & ticket = PrepareTicket();
|
Ticket & ticket = PrepareTicket();
|
||||||
PT::Space & meta = PrepareSpace();
|
pt::Space & meta = PrepareSpace();
|
||||||
Item & item = cur->request->item;
|
Item & item = cur->request->item;
|
||||||
|
|
||||||
old_url = item.url;
|
old_url = item.url;
|
||||||
|
@ -267,7 +267,7 @@ void EditTicket::MakeGet()
|
||||||
ticket_info->FindCurrentConf();
|
ticket_info->FindCurrentConf();
|
||||||
|
|
||||||
Ticket & ticket = PrepareTicket();
|
Ticket & ticket = PrepareTicket();
|
||||||
PT::Space & meta = PrepareSpace();
|
pt::Space & meta = PrepareSpace();
|
||||||
ticket_info->ticket = &ticket;
|
ticket_info->ticket = &ticket;
|
||||||
ticket_info->item = &cur->request->item;
|
ticket_info->item = &cur->request->item;
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ private:
|
||||||
|
|
||||||
void RemoveTmpTicket();
|
void RemoveTmpTicket();
|
||||||
Ticket & PrepareTicket();
|
Ticket & PrepareTicket();
|
||||||
PT::Space & PrepareSpace();
|
pt::Space & PrepareSpace();
|
||||||
void ChangeTicket(Ticket & ticket, Item & item);
|
void ChangeTicket(Ticket & ticket, Item & item);
|
||||||
void Submit(Ticket & ticket, Item & item);
|
void Submit(Ticket & ticket, Item & item);
|
||||||
bool CloseTicket();
|
bool CloseTicket();
|
||||||
|
|
|
@ -83,7 +83,7 @@ SpaceMap::iterator i;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionData::RemoveAllFiles(PT::Space & new_space)
|
void SessionData::RemoveAllFiles(pt::Space & new_space)
|
||||||
{
|
{
|
||||||
std::vector<long> new_file_tab;
|
std::vector<long> new_file_tab;
|
||||||
BuildFileList(new_file_tab, new_space);
|
BuildFileList(new_file_tab, new_space);
|
||||||
|
@ -94,7 +94,7 @@ void SessionData::RemoveAllFiles(PT::Space & new_space)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionData::RemoveAllStaleFiles(PT::Space & new_space, PT::Space & old_space)
|
void SessionData::RemoveAllStaleFiles(pt::Space & new_space, pt::Space & old_space)
|
||||||
{
|
{
|
||||||
std::vector<long> new_file_tab;
|
std::vector<long> new_file_tab;
|
||||||
std::vector<long> old_file_tab;
|
std::vector<long> old_file_tab;
|
||||||
|
@ -140,7 +140,7 @@ void SessionData::RemoveAllStaleFiles(PT::Space & new_space, PT::Space & old_spa
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionData::BuildFileList(std::vector<long> & file_tab, PT::Space & space)
|
void SessionData::BuildFileList(std::vector<long> & file_tab, pt::Space & space)
|
||||||
{
|
{
|
||||||
file_tab.clear();
|
file_tab.clear();
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void SessionData::BuildFileList(std::vector<long> & file_tab, PT::Space & space)
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<space.child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<space.child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[i];
|
pt::Space & sp = *(*space.child_spaces)[i];
|
||||||
|
|
||||||
if( sp.name && (*sp.name) == L"param" )
|
if( sp.name && (*sp.name) == L"param" )
|
||||||
CheckFile(file_tab, sp);
|
CheckFile(file_tab, sp);
|
||||||
|
@ -157,13 +157,13 @@ void SessionData::BuildFileList(std::vector<long> & file_tab, PT::Space & space)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SessionData::CheckFile(std::vector<long> & file_tab, PT::Space & space)
|
void SessionData::CheckFile(std::vector<long> & file_tab, pt::Space & space)
|
||||||
{
|
{
|
||||||
if( space.child_spaces )
|
if( space.child_spaces )
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<space.child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<space.child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & subsp = *(*space.child_spaces)[i];
|
pt::Space & subsp = *(*space.child_spaces)[i];
|
||||||
|
|
||||||
if( subsp.name && *subsp.name == L"file" )
|
if( subsp.name && *subsp.name == L"file" )
|
||||||
{
|
{
|
||||||
|
@ -194,7 +194,7 @@ return res.first->second;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PT::Space & SessionData::GetOldSpace(long id, SpaceMap & space_map, bool * is_new)
|
pt::Space & SessionData::GetOldSpace(long id, SpaceMap & space_map, bool * is_new)
|
||||||
{
|
{
|
||||||
std::pair<SpaceMap::iterator, bool> res = space_map.insert( std::make_pair(id, SpacePair()) );
|
std::pair<SpaceMap::iterator, bool> res = space_map.insert( std::make_pair(id, SpacePair()) );
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ return res.first->second.old_space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PT::Space & SessionData::GetNewSpace(long id, SpaceMap & space_map, bool * is_new)
|
pt::Space & SessionData::GetNewSpace(long id, SpaceMap & space_map, bool * is_new)
|
||||||
{
|
{
|
||||||
std::pair<SpaceMap::iterator, bool> res = space_map.insert( std::make_pair(id, SpacePair()) );
|
std::pair<SpaceMap::iterator, bool> res = space_map.insert( std::make_pair(id, SpacePair()) );
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@ struct SessionData : public PluginDataBase
|
||||||
|
|
||||||
struct SpacePair
|
struct SpacePair
|
||||||
{
|
{
|
||||||
PT::Space new_space;
|
pt::Space new_space;
|
||||||
PT::Space old_space;
|
pt::Space old_space;
|
||||||
|
|
||||||
// old_space is used when editing an existing ticket
|
// old_space is used when editing an existing ticket
|
||||||
// current ticket space is copied to old_space
|
// current ticket space is copied to old_space
|
||||||
|
@ -95,8 +95,8 @@ struct SessionData : public PluginDataBase
|
||||||
Ticket & GetTicket(long id, TicketMap & ticket_map, bool * is_new = 0);
|
Ticket & GetTicket(long id, TicketMap & ticket_map, bool * is_new = 0);
|
||||||
|
|
||||||
// inserting and returning a new/old space or just returning the space if it exists
|
// inserting and returning a new/old space or just returning the space if it exists
|
||||||
PT::Space & GetOldSpace(long id, SpaceMap & space_map, bool * is_new = 0);
|
pt::Space & GetOldSpace(long id, SpaceMap & space_map, bool * is_new = 0);
|
||||||
PT::Space & GetNewSpace(long id, SpaceMap & space_map, bool * is_new = 0);
|
pt::Space & GetNewSpace(long id, SpaceMap & space_map, bool * is_new = 0);
|
||||||
|
|
||||||
// for deleting files
|
// for deleting files
|
||||||
Fun::Rm * fun_rm;
|
Fun::Rm * fun_rm;
|
||||||
|
@ -104,11 +104,11 @@ struct SessionData : public PluginDataBase
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void RemoveFiles(SpaceMap & space_map, bool only_stale_files);
|
void RemoveFiles(SpaceMap & space_map, bool only_stale_files);
|
||||||
void RemoveAllFiles(PT::Space & new_space);
|
void RemoveAllFiles(pt::Space & new_space);
|
||||||
void RemoveAllStaleFiles(PT::Space & new_space, PT::Space & old_space);
|
void RemoveAllStaleFiles(pt::Space & new_space, pt::Space & old_space);
|
||||||
|
|
||||||
void BuildFileList(std::vector<long> & file_tab, PT::Space & space);
|
void BuildFileList(std::vector<long> & file_tab, pt::Space & space);
|
||||||
void CheckFile(std::vector<long> & file_tab, PT::Space & space);
|
void CheckFile(std::vector<long> & file_tab, pt::Space & space);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct TicketValue
|
||||||
{
|
{
|
||||||
bool is_param; // true if there is a paremeter (in config Space)
|
bool is_param; // true if there is a paremeter (in config Space)
|
||||||
|
|
||||||
PT::Space * config_par; // current space param (from current config) if is_param is true
|
pt::Space * config_par; // current space param (from current config) if is_param is true
|
||||||
// when is_param is true then this pointer is never null
|
// when is_param is true then this pointer is never null
|
||||||
|
|
||||||
long param_id; // param id (the same as config_par->Long(L"id"))
|
long param_id; // param id (the same as config_par->Long(L"id"))
|
||||||
|
@ -79,7 +79,7 @@ bool is_in_ticket_par; // true if the value is defined in ticket.par_tab
|
||||||
// else the value can be defined in meta (or not at all)
|
// else the value can be defined in meta (or not at all)
|
||||||
|
|
||||||
Ticket::TicketParam * ticket_par; // if is_in_ticket_par is true
|
Ticket::TicketParam * ticket_par; // if is_in_ticket_par is true
|
||||||
PT::Space * value_meta; // if is_in_ticket_par is false and if there is such a value in meta
|
pt::Space * value_meta; // if is_in_ticket_par is false and if there is such a value in meta
|
||||||
|
|
||||||
|
|
||||||
TicketValue()
|
TicketValue()
|
||||||
|
@ -169,7 +169,7 @@ return false;
|
||||||
looking for a subspace in meta which has id equal to param_id
|
looking for a subspace in meta which has id equal to param_id
|
||||||
can return a null pointer
|
can return a null pointer
|
||||||
*/
|
*/
|
||||||
PT::Space * find_ticket_param(long param_id, PT::Space & meta)
|
pt::Space * find_ticket_param(long param_id, pt::Space & meta)
|
||||||
{
|
{
|
||||||
wchar_t param_id_str[50];
|
wchar_t param_id_str[50];
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ wchar_t param_id_str[50];
|
||||||
|
|
||||||
for(size_t i=0 ; i<meta.child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<meta.child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*meta.child_spaces)[i];
|
pt::Space & sp = *(*meta.child_spaces)[i];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"param" && sp.is_equal(L"id", param_id_str) )
|
if( sp.name && *sp.name == L"param" && sp.is_equal(L"id", param_id_str) )
|
||||||
return &sp;
|
return &sp;
|
||||||
|
@ -211,7 +211,7 @@ return 0;
|
||||||
value.ticket_par
|
value.ticket_par
|
||||||
value.value_meta
|
value.value_meta
|
||||||
*/
|
*/
|
||||||
void find_ticket_value(TicketValue & value, Ticket::ParTab & par_tab, PT::Space & item_meta)
|
void find_ticket_value(TicketValue & value, Ticket::ParTab & par_tab, pt::Space & item_meta)
|
||||||
{
|
{
|
||||||
size_t par_index;
|
size_t par_index;
|
||||||
|
|
||||||
|
@ -229,11 +229,11 @@ size_t par_index;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PT::Space * meta = item_meta.find_child_space(L"ticket");
|
pt::Space * meta = item_meta.find_child_space(L"ticket");
|
||||||
|
|
||||||
if( meta )
|
if( meta )
|
||||||
{
|
{
|
||||||
PT::Space * sp = find_ticket_param(value.param_id, *meta);
|
pt::Space * sp = find_ticket_param(value.param_id, *meta);
|
||||||
|
|
||||||
if( sp )
|
if( sp )
|
||||||
{
|
{
|
||||||
|
@ -253,7 +253,7 @@ void ticket_print_value_select(Info & i, TicketValue & value)
|
||||||
{
|
{
|
||||||
for(size_t a=0 ; a<value.config_par->child_spaces->size() ; ++a)
|
for(size_t a=0 ; a<value.config_par->child_spaces->size() ; ++a)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*value.config_par->child_spaces)[a];
|
pt::Space & sp = *(*value.config_par->child_spaces)[a];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"option" && sp.to_long(L"id") == value.ticket_par->intv )
|
if( sp.name && *sp.name == L"option" && sp.to_long(L"id") == value.ticket_par->intv )
|
||||||
{
|
{
|
||||||
|
@ -322,7 +322,7 @@ void ticket_meta_value(Info & i)
|
||||||
|
|
||||||
void ticket_is_closed(Info & i)
|
void ticket_is_closed(Info & i)
|
||||||
{
|
{
|
||||||
PT::Space * ticket_space = ticket_info.item->item_content.meta_admin.find_child_space(L"ticket");
|
pt::Space * ticket_space = ticket_info.item->item_content.meta_admin.find_child_space(L"ticket");
|
||||||
|
|
||||||
if( ticket_space )
|
if( ticket_space )
|
||||||
i.res = ticket_space->to_bool(L"closed", false);
|
i.res = ticket_space->to_bool(L"closed", false);
|
||||||
|
@ -337,14 +337,14 @@ void ticket_param_value_for_param_id(Info & i)
|
||||||
value_for_param_id.Clear();
|
value_for_param_id.Clear();
|
||||||
|
|
||||||
size_t conf_index = 0;
|
size_t conf_index = 0;
|
||||||
PT::Space & space = *ticket_info.cur_conf;
|
pt::Space & space = *ticket_info.cur_conf;
|
||||||
int id = Toi(i.par);
|
int id = Toi(i.par);
|
||||||
|
|
||||||
if( space.child_spaces )
|
if( space.child_spaces )
|
||||||
{
|
{
|
||||||
for( ; conf_index < space.child_spaces->size() ; ++conf_index)
|
for( ; conf_index < space.child_spaces->size() ; ++conf_index)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[conf_index];
|
pt::Space & sp = *(*space.child_spaces)[conf_index];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"param" && sp.to_int(L"id") == id )
|
if( sp.name && *sp.name == L"param" && sp.to_int(L"id") == id )
|
||||||
{
|
{
|
||||||
|
@ -372,7 +372,7 @@ void ticket_does_param_id_have_value(Info & i)
|
||||||
value_for_param_id.Clear();
|
value_for_param_id.Clear();
|
||||||
|
|
||||||
size_t conf_index = 0;
|
size_t conf_index = 0;
|
||||||
PT::Space & space = *ticket_info.cur_conf;
|
pt::Space & space = *ticket_info.cur_conf;
|
||||||
|
|
||||||
if( i.params.size() == 2 && space.child_spaces )
|
if( i.params.size() == 2 && space.child_spaces )
|
||||||
{
|
{
|
||||||
|
@ -381,7 +381,7 @@ void ticket_does_param_id_have_value(Info & i)
|
||||||
|
|
||||||
for( ; conf_index < space.child_spaces->size() ; ++conf_index)
|
for( ; conf_index < space.child_spaces->size() ; ++conf_index)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[conf_index];
|
pt::Space & sp = *(*space.child_spaces)[conf_index];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"param" && sp.to_long(L"id") == id )
|
if( sp.name && *sp.name == L"param" && sp.to_long(L"id") == id )
|
||||||
{
|
{
|
||||||
|
@ -559,7 +559,7 @@ void tickets_tab_is_closed(Info & i)
|
||||||
|
|
||||||
if( tickets_value.is_item )
|
if( tickets_value.is_item )
|
||||||
{
|
{
|
||||||
PT::Space * ticket_space = tickets_value.item->item_content.meta_admin.find_child_space(L"ticket");
|
pt::Space * ticket_space = tickets_value.item->item_content.meta_admin.find_child_space(L"ticket");
|
||||||
|
|
||||||
if( ticket_space )
|
if( ticket_space )
|
||||||
i.res = ticket_space->to_bool(L"closed", false);
|
i.res = ticket_space->to_bool(L"closed", false);
|
||||||
|
@ -638,14 +638,14 @@ void tickets_tab_param_value_for_param_id(Info & i)
|
||||||
if( tickets_value.is_ticket )
|
if( tickets_value.is_ticket )
|
||||||
{
|
{
|
||||||
size_t param_index = 0;
|
size_t param_index = 0;
|
||||||
PT::Space & space = *ticket_info.cur_conf;
|
pt::Space & space = *ticket_info.cur_conf;
|
||||||
long id = Tol(i.par);
|
long id = Tol(i.par);
|
||||||
|
|
||||||
if( space.child_spaces )
|
if( space.child_spaces )
|
||||||
{
|
{
|
||||||
for( ; param_index < space.child_spaces->size() ; ++param_index)
|
for( ; param_index < space.child_spaces->size() ; ++param_index)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[param_index];
|
pt::Space & sp = *(*space.child_spaces)[param_index];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"param" &&
|
if( sp.name && *sp.name == L"param" &&
|
||||||
sp.to_long(L"id") == id )
|
sp.to_long(L"id") == id )
|
||||||
|
@ -675,7 +675,7 @@ void tickets_tab_does_param_id_have_value(Info & i)
|
||||||
if( tickets_value.is_ticket && i.params.size() == 2 )
|
if( tickets_value.is_ticket && i.params.size() == 2 )
|
||||||
{
|
{
|
||||||
size_t param_index = 0;
|
size_t param_index = 0;
|
||||||
PT::Space & space = *ticket_info.cur_conf;
|
pt::Space & space = *ticket_info.cur_conf;
|
||||||
long id = Toi(i.params[0].str);
|
long id = Toi(i.params[0].str);
|
||||||
long id2 = Toi(i.params[1].str);
|
long id2 = Toi(i.params[1].str);
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ void tickets_tab_does_param_id_have_value(Info & i)
|
||||||
{
|
{
|
||||||
for( ; param_index < space.child_spaces->size() ; ++param_index)
|
for( ; param_index < space.child_spaces->size() ; ++param_index)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[param_index];
|
pt::Space & sp = *(*space.child_spaces)[param_index];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"param" && sp.to_long(L"id") == id )
|
if( sp.name && *sp.name == L"param" && sp.to_long(L"id") == id )
|
||||||
{
|
{
|
||||||
|
@ -723,13 +723,13 @@ void tickets_tab_conf_tab(Info & i)
|
||||||
if( tickets_value.is_ticket )
|
if( tickets_value.is_ticket )
|
||||||
{
|
{
|
||||||
conf_index = i.iter;
|
conf_index = i.iter;
|
||||||
PT::Space & space = *ticket_info.cur_conf;
|
pt::Space & space = *ticket_info.cur_conf;
|
||||||
|
|
||||||
if( space.child_spaces )
|
if( space.child_spaces )
|
||||||
{
|
{
|
||||||
while( conf_index < space.child_spaces->size() )
|
while( conf_index < space.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[conf_index];
|
pt::Space & sp = *(*space.child_spaces)[conf_index];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"param" )
|
if( sp.name && *sp.name == L"param" )
|
||||||
break;
|
break;
|
||||||
|
@ -840,13 +840,13 @@ void tickets_tab_conf_tab_file_tab(Info & i)
|
||||||
if( i.iter == 0 )
|
if( i.iter == 0 )
|
||||||
tickets_file_number = 0;
|
tickets_file_number = 0;
|
||||||
|
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces )
|
if( mt.child_spaces )
|
||||||
{
|
{
|
||||||
while( tickets_file_index < mt.child_spaces->size() )
|
while( tickets_file_index < mt.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*mt.child_spaces)[tickets_file_index];
|
pt::Space & sp = *(*mt.child_spaces)[tickets_file_index];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"file" )
|
if( sp.name && *sp.name == L"file" )
|
||||||
break;
|
break;
|
||||||
|
@ -869,7 +869,7 @@ void tickets_tab_conf_tab_file_tab_index(Info & i)
|
||||||
|
|
||||||
if( value.is_value && !value.is_in_ticket_par )
|
if( value.is_value && !value.is_in_ticket_par )
|
||||||
{
|
{
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces && tickets_file_index < mt.child_spaces->size() )
|
if( mt.child_spaces && tickets_file_index < mt.child_spaces->size() )
|
||||||
i.out << tickets_file_number;
|
i.out << tickets_file_number;
|
||||||
|
@ -884,7 +884,7 @@ void tickets_tab_conf_tab_file_tab_path(Info & i)
|
||||||
|
|
||||||
if( value.is_value && !value.is_in_ticket_par )
|
if( value.is_value && !value.is_in_ticket_par )
|
||||||
{
|
{
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces && tickets_file_index < mt.child_spaces->size() )
|
if( mt.child_spaces && tickets_file_index < mt.child_spaces->size() )
|
||||||
i.out << (*mt.child_spaces)[tickets_file_index]->to_wstr(L"path");
|
i.out << (*mt.child_spaces)[tickets_file_index]->to_wstr(L"path");
|
||||||
|
@ -898,7 +898,7 @@ void tickets_tab_conf_tab_file_tab_itemid(Info & i)
|
||||||
|
|
||||||
if( value.is_value && !value.is_in_ticket_par )
|
if( value.is_value && !value.is_in_ticket_par )
|
||||||
{
|
{
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces && tickets_file_index < mt.child_spaces->size() )
|
if( mt.child_spaces && tickets_file_index < mt.child_spaces->size() )
|
||||||
i.out << (*mt.child_spaces)[tickets_file_index]->to_wstr(L"itemid");
|
i.out << (*mt.child_spaces)[tickets_file_index]->to_wstr(L"itemid");
|
||||||
|
@ -912,7 +912,7 @@ void tickets_tab_conf_tab_file_tab_meta(Info & i)
|
||||||
|
|
||||||
if( value.is_value && !value.is_in_ticket_par )
|
if( value.is_value && !value.is_in_ticket_par )
|
||||||
{
|
{
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces && tickets_file_index < mt.child_spaces->size() )
|
if( mt.child_spaces && tickets_file_index < mt.child_spaces->size() )
|
||||||
space_value(i, *(*mt.child_spaces)[tickets_file_index]);
|
space_value(i, *(*mt.child_spaces)[tickets_file_index]);
|
||||||
|
@ -954,13 +954,13 @@ void ticket_tab(Info & i)
|
||||||
value.Clear();
|
value.Clear();
|
||||||
|
|
||||||
conf_index = i.iter;
|
conf_index = i.iter;
|
||||||
PT::Space & space = *ticket_info.cur_conf;
|
pt::Space & space = *ticket_info.cur_conf;
|
||||||
|
|
||||||
if( space.child_spaces )
|
if( space.child_spaces )
|
||||||
{
|
{
|
||||||
while( conf_index < space.child_spaces->size() )
|
while( conf_index < space.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[conf_index];
|
pt::Space & sp = *(*space.child_spaces)[conf_index];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"param" )
|
if( sp.name && *sp.name == L"param" )
|
||||||
break;
|
break;
|
||||||
|
@ -1072,13 +1072,13 @@ void ticket_tab_select_tab(Info & i)
|
||||||
if( value.is_param )
|
if( value.is_param )
|
||||||
{
|
{
|
||||||
select_index = i.iter;
|
select_index = i.iter;
|
||||||
PT::Space & sp = *value.config_par;
|
pt::Space & sp = *value.config_par;
|
||||||
|
|
||||||
if( sp.child_spaces )
|
if( sp.child_spaces )
|
||||||
{
|
{
|
||||||
while( select_index < sp.child_spaces->size() )
|
while( select_index < sp.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & sp_child = *(*sp.child_spaces)[select_index];
|
pt::Space & sp_child = *(*sp.child_spaces)[select_index];
|
||||||
|
|
||||||
if( sp_child.name && *sp_child.name == L"option" )
|
if( sp_child.name && *sp_child.name == L"option" )
|
||||||
break;
|
break;
|
||||||
|
@ -1098,11 +1098,11 @@ void ticket_tab_select_tab_is_selected(Info & i)
|
||||||
|
|
||||||
if( value.is_param )
|
if( value.is_param )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *value.config_par;
|
pt::Space & sp = *value.config_par;
|
||||||
|
|
||||||
if( sp.child_spaces && select_index < sp.child_spaces->size() )
|
if( sp.child_spaces && select_index < sp.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & sp_child = *(*sp.child_spaces)[select_index];
|
pt::Space & sp_child = *(*sp.child_spaces)[select_index];
|
||||||
|
|
||||||
long id = sp_child.to_long(L"id");
|
long id = sp_child.to_long(L"id");
|
||||||
|
|
||||||
|
@ -1126,7 +1126,7 @@ void ticket_tab_select_tab_name(Info & i)
|
||||||
|
|
||||||
if( value.is_param )
|
if( value.is_param )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *value.config_par;
|
pt::Space & sp = *value.config_par;
|
||||||
|
|
||||||
if( sp.child_spaces && select_index < sp.child_spaces->size() )
|
if( sp.child_spaces && select_index < sp.child_spaces->size() )
|
||||||
i.out << (*sp.child_spaces)[select_index]->to_wstr(L"value");
|
i.out << (*sp.child_spaces)[select_index]->to_wstr(L"value");
|
||||||
|
@ -1140,7 +1140,7 @@ void ticket_tab_select_tab_id(Info & i)
|
||||||
|
|
||||||
if( value.is_param )
|
if( value.is_param )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *value.config_par;
|
pt::Space & sp = *value.config_par;
|
||||||
|
|
||||||
if( sp.child_spaces && select_index < sp.child_spaces->size() )
|
if( sp.child_spaces && select_index < sp.child_spaces->size() )
|
||||||
i.out << (*sp.child_spaces)[select_index]->to_wstr(L"id");
|
i.out << (*sp.child_spaces)[select_index]->to_wstr(L"id");
|
||||||
|
@ -1153,7 +1153,7 @@ void ticket_tab_select_tab_meta(Info & i)
|
||||||
|
|
||||||
if( value.is_param )
|
if( value.is_param )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *value.config_par;
|
pt::Space & sp = *value.config_par;
|
||||||
|
|
||||||
if( sp.child_spaces && select_index < sp.child_spaces->size() )
|
if( sp.child_spaces && select_index < sp.child_spaces->size() )
|
||||||
space_value(i, *(*sp.child_spaces)[select_index]);
|
space_value(i, *(*sp.child_spaces)[select_index]);
|
||||||
|
@ -1173,13 +1173,13 @@ void ticket_tab_file_tab(Info & i)
|
||||||
if( i.iter == 0 )
|
if( i.iter == 0 )
|
||||||
ticket_file_number = 0;
|
ticket_file_number = 0;
|
||||||
|
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces )
|
if( mt.child_spaces )
|
||||||
{
|
{
|
||||||
while( ticket_file_index < mt.child_spaces->size() )
|
while( ticket_file_index < mt.child_spaces->size() )
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*mt.child_spaces)[ticket_file_index];
|
pt::Space & sp = *(*mt.child_spaces)[ticket_file_index];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"file" )
|
if( sp.name && *sp.name == L"file" )
|
||||||
break;
|
break;
|
||||||
|
@ -1202,7 +1202,7 @@ void ticket_tab_file_tab_index(Info & i)
|
||||||
|
|
||||||
if( value.is_value && !value.is_in_ticket_par )
|
if( value.is_value && !value.is_in_ticket_par )
|
||||||
{
|
{
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces && ticket_file_index < mt.child_spaces->size() )
|
if( mt.child_spaces && ticket_file_index < mt.child_spaces->size() )
|
||||||
i.out << ticket_file_number;
|
i.out << ticket_file_number;
|
||||||
|
@ -1216,7 +1216,7 @@ void ticket_tab_file_tab_path(Info & i)
|
||||||
|
|
||||||
if( value.is_value && !value.is_in_ticket_par )
|
if( value.is_value && !value.is_in_ticket_par )
|
||||||
{
|
{
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces && ticket_file_index < mt.child_spaces->size() )
|
if( mt.child_spaces && ticket_file_index < mt.child_spaces->size() )
|
||||||
i.out << (*mt.child_spaces)[ticket_file_index]->to_wstr(L"path");
|
i.out << (*mt.child_spaces)[ticket_file_index]->to_wstr(L"path");
|
||||||
|
@ -1229,7 +1229,7 @@ void ticket_tab_file_tab_itemid(Info & i)
|
||||||
|
|
||||||
if( value.is_value && !value.is_in_ticket_par )
|
if( value.is_value && !value.is_in_ticket_par )
|
||||||
{
|
{
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces && ticket_file_index < mt.child_spaces->size() )
|
if( mt.child_spaces && ticket_file_index < mt.child_spaces->size() )
|
||||||
i.out << (*mt.child_spaces)[ticket_file_index]->to_wstr(L"itemid");
|
i.out << (*mt.child_spaces)[ticket_file_index]->to_wstr(L"itemid");
|
||||||
|
@ -1242,7 +1242,7 @@ void ticket_tab_file_tab_meta(Info & i)
|
||||||
|
|
||||||
if( value.is_value && !value.is_in_ticket_par )
|
if( value.is_value && !value.is_in_ticket_par )
|
||||||
{
|
{
|
||||||
PT::Space & mt = *value.value_meta;
|
pt::Space & mt = *value.value_meta;
|
||||||
|
|
||||||
if( mt.child_spaces && ticket_file_index < mt.child_spaces->size() )
|
if( mt.child_spaces && ticket_file_index < mt.child_spaces->size() )
|
||||||
space_value(i, *(*mt.child_spaces)[ticket_file_index]);
|
space_value(i, *(*mt.child_spaces)[ticket_file_index]);
|
||||||
|
|
|
@ -169,7 +169,7 @@ bool TicketInfo::ParseTicketConf(long mount_dir_id, const std::wstring & path)
|
||||||
conf_parser.SetSpace(conf_tab[mount_dir_id].conf);
|
conf_parser.SetSpace(conf_tab[mount_dir_id].conf);
|
||||||
conf_tab[mount_dir_id].conf.clear();
|
conf_tab[mount_dir_id].conf.clear();
|
||||||
|
|
||||||
return (conf_parser.ParseSpace(config_file.item_content.content_raw) == PT::SpaceParser::ok);
|
return (conf_parser.ParseSpace(config_file.item_content.content_raw) == pt::SpaceParser::ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ void TicketInfo::FindCurrentConf()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TicketInfo::CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par)
|
void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par)
|
||||||
{
|
{
|
||||||
std::wstring * type = space.get_wstr(L"type");
|
std::wstring * type = space.get_wstr(L"type");
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ void TicketInfo::CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par)
|
||||||
{
|
{
|
||||||
for(size_t a=0 ; a<space.child_spaces->size() ; ++a)
|
for(size_t a=0 ; a<space.child_spaces->size() ; ++a)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*space.child_spaces)[a];
|
pt::Space & sp = *(*space.child_spaces)[a];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"option" && sp.to_long(L"id") == par.intv )
|
if( sp.name && *sp.name == L"option" && sp.to_long(L"id") == par.intv )
|
||||||
return;
|
return;
|
||||||
|
@ -323,20 +323,20 @@ void TicketInfo::CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PT::Space & TicketInfo::FindAddMetaByParam(PT::Space & meta, long param)
|
pt::Space & TicketInfo::FindAddMetaByParam(pt::Space & meta, long param)
|
||||||
{
|
{
|
||||||
if( meta.child_spaces )
|
if( meta.child_spaces )
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<meta.child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<meta.child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & sp = *(*meta.child_spaces)[i];
|
pt::Space & sp = *(*meta.child_spaces)[i];
|
||||||
|
|
||||||
if( sp.name && *sp.name == L"param" && sp.to_long(L"id") == param )
|
if( sp.name && *sp.name == L"param" && sp.to_long(L"id") == param )
|
||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PT::Space & sp = meta.add_child_space(L"param");
|
pt::Space & sp = meta.add_child_space(L"param");
|
||||||
sp.add(L"id", param);
|
sp.add(L"id", param);
|
||||||
|
|
||||||
return sp;
|
return sp;
|
||||||
|
@ -344,7 +344,7 @@ return sp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool TicketInfo::ReadTicketValue(PT::Space & space, long param_id, Ticket::TicketParam & par, const std::wstring & value, PT::Space & meta)
|
bool TicketInfo::ReadTicketValue(pt::Space & space, long param_id, Ticket::TicketParam & par, const std::wstring & value, pt::Space & meta)
|
||||||
{
|
{
|
||||||
if( space.is_equal(L"type", L"integer") ||
|
if( space.is_equal(L"type", L"integer") ||
|
||||||
space.is_equal(L"type", L"progress") ||
|
space.is_equal(L"type", L"progress") ||
|
||||||
|
@ -360,7 +360,7 @@ bool TicketInfo::ReadTicketValue(PT::Space & space, long param_id, Ticket::Ticke
|
||||||
space.is_equal(L"type", L"multistring") )
|
space.is_equal(L"type", L"multistring") )
|
||||||
{
|
{
|
||||||
// !! dodac cos co sprawdzi czy string nie zawiera znakow konca linii
|
// !! dodac cos co sprawdzi czy string nie zawiera znakow konca linii
|
||||||
PT::Space & sp = FindAddMetaByParam(meta, param_id);
|
pt::Space & sp = FindAddMetaByParam(meta, param_id);
|
||||||
sp.add(L"value", value);
|
sp.add(L"value", value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -391,10 +391,10 @@ return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TicketInfo::ReadTicketValue(PT::Space & space,
|
void TicketInfo::ReadTicketValue(pt::Space & space,
|
||||||
long param_id,
|
long param_id,
|
||||||
const PostFile & value,
|
const PostFile & value,
|
||||||
PT::Space & meta,
|
pt::Space & meta,
|
||||||
Item & upload_dir)
|
Item & upload_dir)
|
||||||
{
|
{
|
||||||
file.Clear(); // clearing and setting date
|
file.Clear(); // clearing and setting date
|
||||||
|
@ -409,8 +409,8 @@ void TicketInfo::ReadTicketValue(PT::Space & space,
|
||||||
|
|
||||||
if( cur->request->status == WINIX_ERR_OK )
|
if( cur->request->status == WINIX_ERR_OK )
|
||||||
{
|
{
|
||||||
PT::Space & space = FindAddMetaByParam(meta, param_id);
|
pt::Space & space = FindAddMetaByParam(meta, param_id);
|
||||||
PT::Space & file_space = space.add_child_space(L"file");
|
pt::Space & file_space = space.add_child_space(L"file");
|
||||||
|
|
||||||
if( file.item_content.file_type == WINIX_ITEM_FILETYPE_IMAGE )
|
if( file.item_content.file_type == WINIX_ITEM_FILETYPE_IMAGE )
|
||||||
file_space.add(L"type", L"image");
|
file_space.add(L"type", L"image");
|
||||||
|
@ -428,8 +428,8 @@ void TicketInfo::ReadTicketValue(PT::Space & space,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TicketInfo::ReadTicketValue(PT::Space & space,
|
void TicketInfo::ReadTicketValue(pt::Space & space,
|
||||||
long param_id, const PostFile & value, PT::Space & meta)
|
long param_id, const PostFile & value, pt::Space & meta)
|
||||||
{
|
{
|
||||||
std::wstring * type = space.get_wstr(L"type");
|
std::wstring * type = space.get_wstr(L"type");
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ void TicketInfo::ReadTicketValue(PT::Space & space,
|
||||||
|
|
||||||
|
|
||||||
// adding a new parameter only if it not exists in ticket.par_tab
|
// adding a new parameter only if it not exists in ticket.par_tab
|
||||||
void TicketInfo::ReadTicketParam(PT::Space & space, Ticket & ticket, long param_id, const std::wstring & value, PT::Space & meta)
|
void TicketInfo::ReadTicketParam(pt::Space & space, Ticket & ticket, long param_id, const std::wstring & value, pt::Space & meta)
|
||||||
{
|
{
|
||||||
ticket_param.param = param_id;
|
ticket_param.param = param_id;
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ void TicketInfo::ReadTicketParam(PT::Space & space, Ticket & ticket, long param_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstring & value, PT::Space & meta)
|
void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstring & value, pt::Space & meta)
|
||||||
{
|
{
|
||||||
ticket_param.Clear();
|
ticket_param.Clear();
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstr
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<cur_conf->child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<cur_conf->child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & space = *(*cur_conf->child_spaces)[i];
|
pt::Space & space = *(*cur_conf->child_spaces)[i];
|
||||||
|
|
||||||
if( space.name && *space.name == L"param" && space.to_long(L"id") == param_id )
|
if( space.name && *space.name == L"param" && space.to_long(L"id") == param_id )
|
||||||
{
|
{
|
||||||
|
@ -504,13 +504,13 @@ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstr
|
||||||
|
|
||||||
|
|
||||||
// always adds a new parameter
|
// always adds a new parameter
|
||||||
void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, PT::Space & meta)
|
void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, pt::Space & meta)
|
||||||
{
|
{
|
||||||
if( cur_conf->child_spaces )
|
if( cur_conf->child_spaces )
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<cur_conf->child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<cur_conf->child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & space = *(*cur_conf->child_spaces)[i];
|
pt::Space & space = *(*cur_conf->child_spaces)[i];
|
||||||
|
|
||||||
if( space.name && *space.name == L"param" && space.to_long(L"id") == param_id )
|
if( space.name && *space.name == L"param" && space.to_long(L"id") == param_id )
|
||||||
{
|
{
|
||||||
|
@ -527,19 +527,19 @@ void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, PT::Spac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, PT::Space & meta)
|
bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & meta)
|
||||||
{
|
{
|
||||||
if( meta.child_spaces )
|
if( meta.child_spaces )
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<meta.child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<meta.child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & param = *(*meta.child_spaces)[i];
|
pt::Space & param = *(*meta.child_spaces)[i];
|
||||||
|
|
||||||
if( param.name && *param.name == L"param" && param.child_spaces )
|
if( param.name && *param.name == L"param" && param.child_spaces )
|
||||||
{
|
{
|
||||||
for(size_t z=0 ; z<param.child_spaces->size() ; ++z)
|
for(size_t z=0 ; z<param.child_spaces->size() ; ++z)
|
||||||
{
|
{
|
||||||
PT::Space & file = *(*param.child_spaces)[z];
|
pt::Space & file = *(*param.child_spaces)[z];
|
||||||
|
|
||||||
if( file.name && *file.name == L"file" )
|
if( file.name && *file.name == L"file" )
|
||||||
{
|
{
|
||||||
|
@ -566,7 +566,7 @@ return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TicketInfo::ReadTicketParams(Ticket & ticket, bool clear_ticket, PT::Space & meta, bool & file_was_deleted)
|
void TicketInfo::ReadTicketParams(Ticket & ticket, bool clear_ticket, pt::Space & meta, bool & file_was_deleted)
|
||||||
{
|
{
|
||||||
PostTab::iterator i;
|
PostTab::iterator i;
|
||||||
PostFileTab::iterator i2;
|
PostFileTab::iterator i2;
|
||||||
|
@ -583,13 +583,13 @@ PostFileTab::iterator i2;
|
||||||
{
|
{
|
||||||
// !! CHECKME why ticket_form_prefix is in the global config?
|
// !! CHECKME why ticket_form_prefix is in the global config?
|
||||||
// (this is a plugin variable)
|
// (this is a plugin variable)
|
||||||
if( PT::is_substr(config->ticket_form_prefix, i->first) )
|
if( pt::is_substr(config->ticket_form_prefix, i->first) )
|
||||||
{
|
{
|
||||||
long param_id = Tol(i->first.c_str() + config->ticket_form_prefix.size());
|
long param_id = Tol(i->first.c_str() + config->ticket_form_prefix.size());
|
||||||
ReadTicketParam(ticket, param_id, i->second, meta);
|
ReadTicketParam(ticket, param_id, i->second, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PT::is_substr(ticket_delete_prefix, i->first) )
|
if( pt::is_substr(ticket_delete_prefix, i->first) )
|
||||||
{
|
{
|
||||||
long file_id = Tol(i->first.c_str() + ticket_delete_prefix.size());
|
long file_id = Tol(i->first.c_str() + ticket_delete_prefix.size());
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ PostFileTab::iterator i2;
|
||||||
|
|
||||||
for(i2=cur->request->post_file_tab.begin() ; i2!=cur->request->post_file_tab.end() ; ++i2)
|
for(i2=cur->request->post_file_tab.begin() ; i2!=cur->request->post_file_tab.end() ; ++i2)
|
||||||
{
|
{
|
||||||
if( PT::is_substr(config->ticket_form_prefix, i2->first) )
|
if( pt::is_substr(config->ticket_form_prefix, i2->first) )
|
||||||
ReadTicketParam(Tol(i2->first.c_str() + config->ticket_form_prefix.size()), i2->second, meta);
|
ReadTicketParam(Tol(i2->first.c_str() + config->ticket_form_prefix.size()), i2->second, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,9 +629,9 @@ void TicketInfo::RemoveTicket(long file_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TicketInfo::CopyTicketSpace(PT::Space & ticket_space, Item & item)
|
void TicketInfo::CopyTicketSpace(pt::Space & ticket_space, Item & item)
|
||||||
{
|
{
|
||||||
PT::Space & ticket_meta = item.item_content.meta.find_add_child_space(L"ticket");
|
pt::Space & ticket_meta = item.item_content.meta.find_add_child_space(L"ticket");
|
||||||
ticket_meta = ticket_space;
|
ticket_meta = ticket_space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct TicketConfWrap
|
||||||
{
|
{
|
||||||
bool to_delete;
|
bool to_delete;
|
||||||
std::wstring file_name;
|
std::wstring file_name;
|
||||||
PT::Space conf;
|
pt::Space conf;
|
||||||
|
|
||||||
TicketConfWrap()
|
TicketConfWrap()
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ public:
|
||||||
// current ticket config
|
// current ticket config
|
||||||
// will be set by FindCurrentConf()
|
// will be set by FindCurrentConf()
|
||||||
TicketConfWrap * cur_conf_wrap;
|
TicketConfWrap * cur_conf_wrap;
|
||||||
PT::Space * cur_conf;
|
pt::Space * cur_conf;
|
||||||
|
|
||||||
// default: "progress"
|
// default: "progress"
|
||||||
// can be set in config in option: ticket_form_progress_prefix
|
// can be set in config in option: ticket_form_progress_prefix
|
||||||
|
@ -127,9 +127,9 @@ public:
|
||||||
void ReadTicketConf(bool skip_existing_configs = false);
|
void ReadTicketConf(bool skip_existing_configs = false);
|
||||||
void FindCurrentConf(long dir_id);
|
void FindCurrentConf(long dir_id);
|
||||||
void FindCurrentConf();
|
void FindCurrentConf();
|
||||||
void ReadTicketParams(Ticket & ticket, bool clear_ticket, PT::Space & meta, bool & file_was_deleted);
|
void ReadTicketParams(Ticket & ticket, bool clear_ticket, pt::Space & meta, bool & file_was_deleted);
|
||||||
void RemoveTicket(long file_id);
|
void RemoveTicket(long file_id);
|
||||||
void CopyTicketSpace(PT::Space & ticket_space, Item & item);
|
void CopyTicketSpace(pt::Space & ticket_space, Item & item);
|
||||||
|
|
||||||
void MakeRedirectIfPossible(const Item & item);
|
void MakeRedirectIfPossible(const Item & item);
|
||||||
|
|
||||||
|
@ -154,14 +154,14 @@ private:
|
||||||
std::wstring file_path;
|
std::wstring file_path;
|
||||||
|
|
||||||
// for reading config file
|
// for reading config file
|
||||||
PT::SpaceParser conf_parser;
|
pt::SpaceParser conf_parser;
|
||||||
std::vector<Item*> config_dir_tab;
|
std::vector<Item*> config_dir_tab;
|
||||||
Item config_file;
|
Item config_file;
|
||||||
|
|
||||||
// for Clearing
|
// for Clearing
|
||||||
// (we don't want to use empty pointers)
|
// (we don't want to use empty pointers)
|
||||||
TicketConfWrap cur_conf_wrap_empty;
|
TicketConfWrap cur_conf_wrap_empty;
|
||||||
PT::Space cur_conf_empty;
|
pt::Space cur_conf_empty;
|
||||||
Ticket ticket_empty;
|
Ticket ticket_empty;
|
||||||
Item item_empty;
|
Item item_empty;
|
||||||
|
|
||||||
|
@ -174,17 +174,17 @@ private:
|
||||||
void MarkAllConfToDelete();
|
void MarkAllConfToDelete();
|
||||||
void DeleteAllMarkedConf();
|
void DeleteAllMarkedConf();
|
||||||
void ReadTicketConf(const Mount & mount, bool skip_existing_configs);
|
void ReadTicketConf(const Mount & mount, bool skip_existing_configs);
|
||||||
PT::Space & FindAddMetaByParam(PT::Space & meta, long param);
|
pt::Space & FindAddMetaByParam(pt::Space & meta, long param);
|
||||||
|
|
||||||
|
|
||||||
void CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par);
|
void CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par);
|
||||||
bool ReadTicketValue(PT::Space & space, long param_id, Ticket::TicketParam & par, const std::wstring & value, PT::Space & meta);
|
bool ReadTicketValue(pt::Space & space, long param_id, Ticket::TicketParam & par, const std::wstring & value, pt::Space & meta);
|
||||||
void ReadTicketValue(PT::Space & space, long param_id, const PostFile & value, PT::Space & meta, Item & upload_dir);
|
void ReadTicketValue(pt::Space & space, long param_id, const PostFile & value, pt::Space & meta, Item & upload_dir);
|
||||||
void ReadTicketValue(PT::Space & space, long param_id, const PostFile & value, PT::Space & meta);
|
void ReadTicketValue(pt::Space & space, long param_id, const PostFile & value, pt::Space & meta);
|
||||||
void ReadTicketParam(PT::Space & space, Ticket & ticket, long param_id, const std::wstring & value, PT::Space & meta);
|
void ReadTicketParam(pt::Space & space, Ticket & ticket, long param_id, const std::wstring & value, pt::Space & meta);
|
||||||
void ReadTicketParam(Ticket & ticket, long param_id, const std::wstring & value, PT::Space & meta);
|
void ReadTicketParam(Ticket & ticket, long param_id, const std::wstring & value, pt::Space & meta);
|
||||||
void ReadTicketParam(long param_id, const PostFile & value, PT::Space & meta);
|
void ReadTicketParam(long param_id, const PostFile & value, pt::Space & meta);
|
||||||
bool DeleteTicketFile(Ticket & ticket, long file_id, PT::Space & meta);
|
bool DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & meta);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,45 +87,45 @@ void current_date_utc(Info & i)
|
||||||
|
|
||||||
void current_sec(Info & i)
|
void current_sec(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->start_date);
|
pt::Date date = system->ToLocal(cur->request->start_date);
|
||||||
i.out << date.sec;
|
i.out << date.sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void current_min(Info & i)
|
void current_min(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->start_date);
|
pt::Date date = system->ToLocal(cur->request->start_date);
|
||||||
i.out << date.min;
|
i.out << date.min;
|
||||||
}
|
}
|
||||||
|
|
||||||
void current_hour(Info & i)
|
void current_hour(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->start_date);
|
pt::Date date = system->ToLocal(cur->request->start_date);
|
||||||
i.out << date.hour;
|
i.out << date.hour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void current_day(Info & i)
|
void current_day(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->start_date);
|
pt::Date date = system->ToLocal(cur->request->start_date);
|
||||||
i.out << date.day;
|
i.out << date.day;
|
||||||
}
|
}
|
||||||
|
|
||||||
void current_month(Info & i)
|
void current_month(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->start_date);
|
pt::Date date = system->ToLocal(cur->request->start_date);
|
||||||
i.out << date.month;
|
i.out << date.month;
|
||||||
}
|
}
|
||||||
|
|
||||||
void current_year(Info & i)
|
void current_year(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->start_date);
|
pt::Date date = system->ToLocal(cur->request->start_date);
|
||||||
i.out << date.year;
|
i.out << date.year;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void current_date(Info & i)
|
void current_date(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->start_date);
|
pt::Date date = system->ToLocal(cur->request->start_date);
|
||||||
i.out << date;
|
i.out << date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ void dir_has_parents(Info & i)
|
||||||
dir_parents_str += '/';
|
dir_parents_str += '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
i.res = PT::is_substr(i.par, dir_parents_str);
|
i.res = pt::is_substr(i.par, dir_parents_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -402,14 +402,14 @@ void dir_last_url_is_no(Info & i)
|
||||||
|
|
||||||
void dir_last_date_creation(Info & i)
|
void dir_last_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->dir_tab.back()->item_content.date_creation);
|
pt::Date date = system->ToLocal(cur->request->dir_tab.back()->item_content.date_creation);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dir_last_date_modification(Info & i)
|
void dir_last_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->dir_tab.back()->item_content.date_modification);
|
pt::Date date = system->ToLocal(cur->request->dir_tab.back()->item_content.date_modification);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,8 +429,8 @@ void dir_last_date_modification_nice(Info & i)
|
||||||
|
|
||||||
void dir_last_dates_equal(Info & i)
|
void dir_last_dates_equal(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date & date1 = cur->request->dir_tab.back()->item_content.date_creation;
|
pt::Date & date1 = cur->request->dir_tab.back()->item_content.date_creation;
|
||||||
PT::Date & date2 = cur->request->dir_tab.back()->item_content.date_modification;
|
pt::Date & date2 = cur->request->dir_tab.back()->item_content.date_modification;
|
||||||
|
|
||||||
i.res = date1 == date2;
|
i.res = date1 == date2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,8 +163,8 @@ void doc_css_tab_file_is_global(Info & i)
|
||||||
// !! z konfiga wziasc przedrostki
|
// !! z konfiga wziasc przedrostki
|
||||||
|
|
||||||
if( doc_css_index < cur->session->last_css.size() )
|
if( doc_css_index < cur->session->last_css.size() )
|
||||||
i.res = PT::is_substr(L"http://", cur->session->last_css[doc_css_index].c_str()) ||
|
i.res = pt::is_substr(L"http://", cur->session->last_css[doc_css_index].c_str()) ||
|
||||||
PT::is_substr(L"https://", cur->session->last_css[doc_css_index].c_str());
|
pt::is_substr(L"https://", cur->session->last_css[doc_css_index].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -233,14 +233,14 @@ HtmlTextStream & HtmlTextStream::operator<<(RawText<void*> raw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::operator<<(RawText<PT::Space> raw)
|
HtmlTextStream & HtmlTextStream::operator<<(RawText<pt::Space> raw)
|
||||||
{
|
{
|
||||||
TextStream<std::wstring>::operator<<(raw.par);
|
TextStream<std::wstring>::operator<<(raw.par);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::operator<<(RawText<PT::Date> raw)
|
HtmlTextStream & HtmlTextStream::operator<<(RawText<pt::Date> raw)
|
||||||
{
|
{
|
||||||
TextStream<std::wstring>::operator<<(raw.par);
|
TextStream<std::wstring>::operator<<(raw.par);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -329,7 +329,7 @@ return *this;
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::EPutText(const char * str)
|
HtmlTextStream & HtmlTextStream::EPutText(const char * str)
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(str, tmp_string);
|
pt::UTF8ToWide(str, tmp_string);
|
||||||
|
|
||||||
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
||||||
ETextPutChar(tmp_string[i]);
|
ETextPutChar(tmp_string[i]);
|
||||||
|
@ -343,7 +343,7 @@ return *this;
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::EPutText(const char * str, size_t len)
|
HtmlTextStream & HtmlTextStream::EPutText(const char * str, size_t len)
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(str, len, tmp_string);
|
pt::UTF8ToWide(str, len, tmp_string);
|
||||||
|
|
||||||
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
||||||
ETextPutChar(tmp_string[i]);
|
ETextPutChar(tmp_string[i]);
|
||||||
|
@ -362,7 +362,7 @@ HtmlTextStream & HtmlTextStream::EPutText(const std::string * str)
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::EPutText(const std::string & str)
|
HtmlTextStream & HtmlTextStream::EPutText(const std::string & str)
|
||||||
{
|
{
|
||||||
PT::UTF8ToWide(str, tmp_string);
|
pt::UTF8ToWide(str, tmp_string);
|
||||||
|
|
||||||
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
for(size_t i=0 ; i<tmp_string.size() ; ++i)
|
||||||
ETextPutChar(tmp_string[i]);
|
ETextPutChar(tmp_string[i]);
|
||||||
|
@ -551,7 +551,7 @@ return *this;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::operator<<(const PT::Space & space)
|
HtmlTextStream & HtmlTextStream::operator<<(const pt::Space & space)
|
||||||
{
|
{
|
||||||
if( escape )
|
if( escape )
|
||||||
{
|
{
|
||||||
|
@ -575,7 +575,7 @@ return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HtmlTextStream & HtmlTextStream::operator<<(const PT::Date & date)
|
HtmlTextStream & HtmlTextStream::operator<<(const pt::Date & date)
|
||||||
{
|
{
|
||||||
if( escape )
|
if( escape )
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,11 +143,11 @@ public:
|
||||||
HtmlTextStream & operator<<(RawText<unsigned long> raw);
|
HtmlTextStream & operator<<(RawText<unsigned long> raw);
|
||||||
HtmlTextStream & operator<<(RawText<double> raw);
|
HtmlTextStream & operator<<(RawText<double> raw);
|
||||||
HtmlTextStream & operator<<(RawText<void*> raw);
|
HtmlTextStream & operator<<(RawText<void*> raw);
|
||||||
HtmlTextStream & operator<<(RawText<PT::Space> raw);
|
HtmlTextStream & operator<<(RawText<pt::Space> raw);
|
||||||
HtmlTextStream & operator<<(RawText<PT::Date> raw);
|
HtmlTextStream & operator<<(RawText<pt::Date> raw);
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
HtmlTextStream & operator<<(RawText<PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw);
|
HtmlTextStream & operator<<(RawText<pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,11 +196,11 @@ public:
|
||||||
HtmlTextStream & operator<<(unsigned long);
|
HtmlTextStream & operator<<(unsigned long);
|
||||||
HtmlTextStream & operator<<(double);
|
HtmlTextStream & operator<<(double);
|
||||||
HtmlTextStream & operator<<(const void *);
|
HtmlTextStream & operator<<(const void *);
|
||||||
HtmlTextStream & operator<<(const PT::Space & space);
|
HtmlTextStream & operator<<(const pt::Space & space);
|
||||||
HtmlTextStream & operator<<(const PT::Date & Date);
|
HtmlTextStream & operator<<(const pt::Date & Date);
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
HtmlTextStream & operator<<(const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
HtmlTextStream & operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -214,7 +214,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
HtmlTextStream & HtmlTextStream::operator<<(RawText<PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw)
|
HtmlTextStream & HtmlTextStream::operator<<(RawText<pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw)
|
||||||
{
|
{
|
||||||
TextStream<std::wstring>::operator<<(raw.par);
|
TextStream<std::wstring>::operator<<(raw.par);
|
||||||
|
|
||||||
|
@ -223,9 +223,9 @@ return *this;
|
||||||
|
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
HtmlTextStream & HtmlTextStream::operator<<(const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
HtmlTextStream & HtmlTextStream::operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
||||||
{
|
{
|
||||||
typename PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
typename pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
||||||
|
|
||||||
if( escape )
|
if( escape )
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ void ipban_current_ip_expires_time(Info & i)
|
||||||
{
|
{
|
||||||
if( cur->session->ip_ban && cur->session->ip_ban->expires != 0 )
|
if( cur->session->ip_ban && cur->session->ip_ban->expires != 0 )
|
||||||
{
|
{
|
||||||
PT::Date date = cur->session->ip_ban->expires;
|
pt::Date date = cur->session->ip_ban->expires;
|
||||||
i.out << date << " UTC";
|
i.out << date << " UTC";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void ipban_tab_ip(Info & i)
|
||||||
{
|
{
|
||||||
if( ipban_index < session_manager->BanListSize() )
|
if( ipban_index < session_manager->BanListSize() )
|
||||||
{
|
{
|
||||||
PT::WTextStream buf = IPToStr(session_manager->GetIPBan(ipban_index).ip);
|
pt::WTextStream buf = IPToStr(session_manager->GetIPBan(ipban_index).ip);
|
||||||
i.out << buf;
|
i.out << buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void ipban_tab_expires(Info & i)
|
||||||
if( ipban.expires != 0 )
|
if( ipban.expires != 0 )
|
||||||
{
|
{
|
||||||
time_t expires_local = system->ToLocal(ipban.expires);
|
time_t expires_local = system->ToLocal(ipban.expires);
|
||||||
PT::Date date(expires_local);
|
pt::Date date(expires_local);
|
||||||
i.out << date;
|
i.out << date;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ void ipban_tab_last_used(Info & i)
|
||||||
if( ipban.last_used != 0 )
|
if( ipban.last_used != 0 )
|
||||||
{
|
{
|
||||||
time_t last_used_local = system->ToLocal(ipban.last_used);
|
time_t last_used_local = system->ToLocal(ipban.last_used);
|
||||||
PT::Date date(last_used_local);
|
pt::Date date(last_used_local);
|
||||||
i.out << date;
|
i.out << date;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,14 +285,14 @@ void item_users_different(Info & i)
|
||||||
|
|
||||||
void item_date_creation(Info & i)
|
void item_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->last_item->item_content.date_creation);
|
pt::Date date = system->ToLocal(cur->request->last_item->item_content.date_creation);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void item_date_modification(Info & i)
|
void item_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->last_item->item_content.date_modification);
|
pt::Date date = system->ToLocal(cur->request->last_item->item_content.date_modification);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,8 +311,8 @@ void item_date_modification_nice(Info & i)
|
||||||
|
|
||||||
void item_dates_equal(Info & i)
|
void item_dates_equal(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date & date1 = cur->request->last_item->item_content.date_creation;
|
pt::Date & date1 = cur->request->last_item->item_content.date_creation;
|
||||||
PT::Date & date2 = cur->request->last_item->item_content.date_modification;
|
pt::Date & date2 = cur->request->last_item->item_content.date_modification;
|
||||||
|
|
||||||
i.res = date1 == date2;
|
i.res = date1 == date2;
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,7 @@ void item_tab_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
if( item_index < cur->request->item_tab.size() )
|
if( item_index < cur->request->item_tab.size() )
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->item_tab[item_index].item_content.date_creation);
|
pt::Date date = system->ToLocal(cur->request->item_tab[item_index].item_content.date_creation);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -694,7 +694,7 @@ void item_tab_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
if( item_index < cur->request->item_tab.size() )
|
if( item_index < cur->request->item_tab.size() )
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->item_tab[item_index].item_content.date_modification);
|
pt::Date date = system->ToLocal(cur->request->item_tab[item_index].item_content.date_modification);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,8 +723,8 @@ void item_tab_dates_equal(Info & i)
|
||||||
{
|
{
|
||||||
if( item_index < cur->request->item_tab.size() )
|
if( item_index < cur->request->item_tab.size() )
|
||||||
{
|
{
|
||||||
PT::Date & date1 = cur->request->item_tab[item_index].item_content.date_creation;
|
pt::Date & date1 = cur->request->item_tab[item_index].item_content.date_creation;
|
||||||
PT::Date & date2 = cur->request->item_tab[item_index].item_content.date_modification;
|
pt::Date & date2 = cur->request->item_tab[item_index].item_content.date_modification;
|
||||||
|
|
||||||
i.res = date1 == date2;
|
i.res = date1 == date2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,15 +113,15 @@ bool read = false;
|
||||||
file_name += file;
|
file_name += file;
|
||||||
|
|
||||||
loc_parser.SetSpace(temp_space);
|
loc_parser.SetSpace(temp_space);
|
||||||
PT::SpaceParser::Status status = loc_parser.ParseSpaceFile(file_name);
|
pt::SpaceParser::Status status = loc_parser.ParseSpaceFile(file_name);
|
||||||
|
|
||||||
if( status == PT::SpaceParser::ok )
|
if( status == pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
read = true;
|
read = true;
|
||||||
log << log3 << "Locale: read locale from: " << file_name << logend;
|
log << log3 << "Locale: read locale from: " << file_name << logend;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( status == PT::SpaceParser::syntax_error )
|
if( status == pt::SpaceParser::syntax_error )
|
||||||
{
|
{
|
||||||
log << log1 << "Locale: syntax error in: " << file_name << " in line: " << loc_parser.get_last_parsed_line() << logend;
|
log << log1 << "Locale: syntax error in: " << file_name << " in line: " << loc_parser.get_last_parsed_line() << logend;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ bool read = false;
|
||||||
|
|
||||||
loc_parser.SetSpace(temp_space);
|
loc_parser.SetSpace(temp_space);
|
||||||
|
|
||||||
if( loc_parser.ParseSpaceFile(file_name) == PT::SpaceParser::ok )
|
if( loc_parser.ParseSpaceFile(file_name) == pt::SpaceParser::ok )
|
||||||
{
|
{
|
||||||
read = true;
|
read = true;
|
||||||
CreateSubstVector(subst_url, temp_space.to_wstr(L"url_original"), temp_space.to_wstr(L"url_changeto"));
|
CreateSubstVector(subst_url, temp_space.to_wstr(L"url_original"), temp_space.to_wstr(L"url_changeto"));
|
||||||
|
@ -266,7 +266,7 @@ void Locale::Read(const char * dir, const char * dir_def)
|
||||||
|
|
||||||
for(size_t i=0 ; i<locale_files.size() ; ++i)
|
for(size_t i=0 ; i<locale_files.size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(locale_files[i], locale_filea);
|
pt::WideToUTF8(locale_files[i], locale_filea);
|
||||||
ReadFile(dir, dir_def, locale_filea.c_str());
|
ReadFile(dir, dir_def, locale_filea.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ void Locale::Read(const std::string & dir, const std::string & dir_def)
|
||||||
|
|
||||||
void Locale::Read(const wchar_t * dir, const wchar_t * dir_def)
|
void Locale::Read(const wchar_t * dir, const wchar_t * dir_def)
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(dir, adir1);
|
pt::WideToUTF8(dir, adir1);
|
||||||
|
|
||||||
if( !dir_def )
|
if( !dir_def )
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,7 @@ void Locale::Read(const wchar_t * dir, const wchar_t * dir_def)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PT::WideToUTF8(dir_def, adir2);
|
pt::WideToUTF8(dir_def, adir2);
|
||||||
Read(adir1.c_str(), adir2.c_str());
|
Read(adir1.c_str(), adir2.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ public:
|
||||||
bool IsKey(const std::wstring & key, bool try_default_too = true) const;
|
bool IsKey(const std::wstring & key, bool try_default_too = true) const;
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
bool IsKey(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
bool IsKey(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
||||||
bool try_default_too = true);
|
bool try_default_too = true);
|
||||||
|
|
||||||
// checking whether there is a 'key' in the lang_id language
|
// checking whether there is a 'key' in the lang_id language
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
bool IsKey(const std::wstring & key, size_t lang_id, bool try_default_too = true) const;
|
bool IsKey(const std::wstring & key, size_t lang_id, bool try_default_too = true) const;
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
bool IsKey(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
bool IsKey(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
||||||
size_t lang_id, bool try_default_too = true);
|
size_t lang_id, bool try_default_too = true);
|
||||||
|
|
||||||
// returning a value for a specific key
|
// returning a value for a specific key
|
||||||
|
@ -107,7 +107,7 @@ public:
|
||||||
const std::wstring & Get(const std::wstring & key, size_t lang_id, bool try_default_too = true) const;
|
const std::wstring & Get(const std::wstring & key, size_t lang_id, bool try_default_too = true) const;
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
const std::wstring & Get(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
const std::wstring & Get(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
||||||
bool try_default_too = true);
|
bool try_default_too = true);
|
||||||
|
|
||||||
template<typename ... Types>
|
template<typename ... Types>
|
||||||
|
@ -232,7 +232,7 @@ private:
|
||||||
std::vector<size_t> locale_indices;
|
std::vector<size_t> locale_indices;
|
||||||
|
|
||||||
// messages vector<via language>
|
// messages vector<via language>
|
||||||
std::vector<PT::Space> locale_tab;
|
std::vector<pt::Space> locale_tab;
|
||||||
|
|
||||||
// default locale index (index to locale_indexes)
|
// default locale index (index to locale_indexes)
|
||||||
size_t default_lang;
|
size_t default_lang;
|
||||||
|
@ -240,7 +240,7 @@ private:
|
||||||
// current locale index (index to locale_indexes)
|
// current locale index (index to locale_indexes)
|
||||||
size_t current_lang;
|
size_t current_lang;
|
||||||
|
|
||||||
PT::WPatternReplacer pattern_replacer;
|
pt::WPatternReplacer pattern_replacer;
|
||||||
|
|
||||||
|
|
||||||
// vectors of characters substitution (sort by 'from')
|
// vectors of characters substitution (sort by 'from')
|
||||||
|
@ -250,8 +250,8 @@ private:
|
||||||
std::vector<SubstItem> subst_sort; // local characters for comparison
|
std::vector<SubstItem> subst_sort; // local characters for comparison
|
||||||
|
|
||||||
|
|
||||||
PT::Space temp_space;
|
pt::Space temp_space;
|
||||||
PT::SpaceParser loc_parser;
|
pt::SpaceParser loc_parser;
|
||||||
std::string locale_filea;
|
std::string locale_filea;
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
std::wstring key_str;
|
std::wstring key_str;
|
||||||
|
@ -262,7 +262,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
bool Locale::IsKey(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
bool Locale::IsKey(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
||||||
bool try_default_too)
|
bool try_default_too)
|
||||||
{
|
{
|
||||||
key.to_string(key_str);
|
key.to_string(key_str);
|
||||||
|
@ -271,7 +271,7 @@ bool Locale::IsKey(const PT::TextStreamBase<char_type, stack_size, heap_block_si
|
||||||
|
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
bool Locale::IsKey(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
bool Locale::IsKey(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
||||||
size_t lang_id, bool try_default_too)
|
size_t lang_id, bool try_default_too)
|
||||||
{
|
{
|
||||||
key.to_string(key_str);
|
key.to_string(key_str);
|
||||||
|
@ -281,7 +281,7 @@ bool Locale::IsKey(const PT::TextStreamBase<char_type, stack_size, heap_block_si
|
||||||
|
|
||||||
|
|
||||||
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
template<typename char_type, size_t stack_size, size_t heap_block_size>
|
||||||
const std::wstring & Locale::Get(const PT::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
const std::wstring & Locale::Get(const pt::TextStreamBase<char_type, stack_size, heap_block_size> & key,
|
||||||
bool try_default_too)
|
bool try_default_too)
|
||||||
{
|
{
|
||||||
key.to_string(key_str);
|
key.to_string(key_str);
|
||||||
|
|
|
@ -126,10 +126,10 @@ char buffer[100];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void print_date_nice(Info & i, const PT::Date & date)
|
void print_date_nice(Info & i, const pt::Date & date)
|
||||||
{
|
{
|
||||||
time_t one_day = 60 * 60 * 24;
|
time_t one_day = 60 * 60 * 24;
|
||||||
PT::Date ltm = system->ToLocal(date);
|
pt::Date ltm = system->ToLocal(date);
|
||||||
|
|
||||||
if( date + one_day > cur->request->start_time )
|
if( date + one_day > cur->request->start_time )
|
||||||
i.out << DateToStr(ltm.year, ltm.month, ltm.day, ltm.hour, ltm.min, ltm.sec);
|
i.out << DateToStr(ltm.year, ltm.month, ltm.day, ltm.hour, ltm.min, ltm.sec);
|
||||||
|
@ -140,7 +140,7 @@ void print_date_nice(Info & i, const PT::Date & date)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// cannot be a const reference at the moment (PT::Space is used)
|
// cannot be a const reference at the moment (pt::Space is used)
|
||||||
void print_user_name(Info & i, User & user)
|
void print_user_name(Info & i, User & user)
|
||||||
{
|
{
|
||||||
std::wstring * dname = user.aenv.get_wstr(L"display_name");
|
std::wstring * dname = user.aenv.get_wstr(L"display_name");
|
||||||
|
|
|
@ -68,7 +68,7 @@ void InitGenerator(EzcGen & gen);
|
||||||
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in);
|
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in);
|
||||||
|
|
||||||
void print_hour_min(Info & i, time_t time);
|
void print_hour_min(Info & i, time_t time);
|
||||||
void print_date_nice(Info & i, const PT::Date & date);
|
void print_date_nice(Info & i, const pt::Date & date);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -73,13 +73,13 @@ void copy_space(const std::vector<Ezc::Var> & params, std::vector<std::wstring>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PT::Space * find_space(const std::vector<Ezc::Var> & params, PT::Space & space, size_t level = 0)
|
pt::Space * find_space(const std::vector<Ezc::Var> & params, pt::Space & space, size_t level = 0)
|
||||||
{
|
{
|
||||||
if( level + 1 < params.size() && space.child_spaces )
|
if( level + 1 < params.size() && space.child_spaces )
|
||||||
{
|
{
|
||||||
for(size_t i=0 ; i<space.child_spaces->size() ; ++i)
|
for(size_t i=0 ; i<space.child_spaces->size() ; ++i)
|
||||||
{
|
{
|
||||||
PT::Space & child = *(*space.child_spaces)[i];
|
pt::Space & child = *(*space.child_spaces)[i];
|
||||||
|
|
||||||
if( child.name && *child.name == params[level].str )
|
if( child.name && *child.name == params[level].str )
|
||||||
return find_space(params, child, level+1);
|
return find_space(params, child, level+1);
|
||||||
|
@ -107,7 +107,7 @@ PT::Space * find_space(const std::vector<Ezc::Var> & params, PT::Space & space,
|
||||||
struct SpaceInfo
|
struct SpaceInfo
|
||||||
{
|
{
|
||||||
bool inited;
|
bool inited;
|
||||||
PT::Space * last_space;
|
pt::Space * last_space;
|
||||||
std::vector<std::wstring> spaces;
|
std::vector<std::wstring> spaces;
|
||||||
|
|
||||||
SpaceInfo()
|
SpaceInfo()
|
||||||
|
@ -117,14 +117,14 @@ struct SpaceInfo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<PT::Space*, SpaceInfo> spaces_map;
|
static std::map<pt::Space*, SpaceInfo> spaces_map;
|
||||||
static size_t space_reqid = 0;
|
static size_t space_reqid = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void space_init(const std::vector<Ezc::Var> & params, PT::Space & space, SpaceInfo & space_info)
|
void space_init(const std::vector<Ezc::Var> & params, pt::Space & space, SpaceInfo & space_info)
|
||||||
{
|
{
|
||||||
if( !space_info.inited || !are_spaces_the_same(params, space_info.spaces) )
|
if( !space_info.inited || !are_spaces_the_same(params, space_info.spaces) )
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ void space_check_reqid()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void space_value(Info & i, PT::Space & space, bool escape)
|
void space_value(Info & i, pt::Space & space, bool escape)
|
||||||
{
|
{
|
||||||
space_check_reqid();
|
space_check_reqid();
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ struct SpaceTabStackItem : public Ezc::FunData
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void space_list_tab(Info & i, PT::Space & space)
|
void space_list_tab(Info & i, pt::Space & space)
|
||||||
{
|
{
|
||||||
if( !i.stack.fun_data )
|
if( !i.stack.fun_data )
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,7 @@ void space_list_tab(Info & i, PT::Space & space)
|
||||||
SpaceTabStackItem * stack_item = new SpaceTabStackItem();
|
SpaceTabStackItem * stack_item = new SpaceTabStackItem();
|
||||||
i.stack.fun_data = stack_item;
|
i.stack.fun_data = stack_item;
|
||||||
|
|
||||||
PT::Space * dst_space = find_space(i.params, space);
|
pt::Space * dst_space = find_space(i.params, space);
|
||||||
|
|
||||||
if( dst_space )
|
if( dst_space )
|
||||||
dst_space->to_list(i.params.back().str, stack_item->values);
|
dst_space->to_list(i.params.back().str, stack_item->values);
|
||||||
|
@ -209,7 +209,7 @@ void space_list_tab(Info & i, PT::Space & space)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void space_list_tab_value(Info & i, PT::Space & space, const std::wstring & function_name)
|
void space_list_tab_value(Info & i, pt::Space & space, const std::wstring & function_name)
|
||||||
{
|
{
|
||||||
Ezc::Stack * stack;
|
Ezc::Stack * stack;
|
||||||
auto user_object = i.FindUserObject<SpaceTabStackItem>(function_name, &stack);
|
auto user_object = i.FindUserObject<SpaceTabStackItem>(function_name, &stack);
|
||||||
|
@ -219,7 +219,7 @@ void space_list_tab_value(Info & i, PT::Space & space, const std::wstring & func
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void space_list_tab_has_next(Info & i, PT::Space & space, const std::wstring & function_name)
|
void space_list_tab_has_next(Info & i, pt::Space & space, const std::wstring & function_name)
|
||||||
{
|
{
|
||||||
Ezc::Stack * stack;
|
Ezc::Stack * stack;
|
||||||
auto user_object = i.FindUserObject<SpaceTabStackItem>(function_name, &stack);
|
auto user_object = i.FindUserObject<SpaceTabStackItem>(function_name, &stack);
|
||||||
|
|
|
@ -65,18 +65,18 @@ namespace TemplatesFunctions
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void space_value(Info & i, PT::Space & space, bool escape = true);
|
void space_value(Info & i, pt::Space & space, bool escape = true);
|
||||||
|
|
||||||
|
|
||||||
// !! IMPROVE ME
|
// !! IMPROVE ME
|
||||||
// add
|
// add
|
||||||
// void space_list_tab_size(Info & i, PT::Space & space);
|
// void space_list_tab_size(Info & i, pt::Space & space);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void space_list_tab(Info & i, PT::Space & space);
|
void space_list_tab(Info & i, pt::Space & space);
|
||||||
void space_list_tab_value(Info & i, PT::Space & space, const std::wstring & function_name);
|
void space_list_tab_value(Info & i, pt::Space & space, const std::wstring & function_name);
|
||||||
void space_list_tab_has_next(Info & i, PT::Space & space, const std::wstring & function_name);
|
void space_list_tab_has_next(Info & i, pt::Space & space, const std::wstring & function_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -122,8 +122,8 @@ void mount_css_tab_file_is_global(Info & i)
|
||||||
int parcss = system->mounts.MountParCss();
|
int parcss = system->mounts.MountParCss();
|
||||||
|
|
||||||
if( mount_css_index < cur->mount->param[parcss].arg.size() )
|
if( mount_css_index < cur->mount->param[parcss].arg.size() )
|
||||||
i.res = PT::is_substr(L"http://", cur->mount->param[parcss].arg[mount_css_index].c_str()) ||
|
i.res = pt::is_substr(L"http://", cur->mount->param[parcss].arg[mount_css_index].c_str()) ||
|
||||||
PT::is_substr(L"https://", cur->mount->param[parcss].arg[mount_css_index].c_str());
|
pt::is_substr(L"https://", cur->mount->param[parcss].arg[mount_css_index].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -99,14 +99,14 @@ void stat_item_privileges(Info & i)
|
||||||
|
|
||||||
void stat_item_date_creation(Info & i)
|
void stat_item_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->last_item->item_content.date_creation);
|
pt::Date date = system->ToLocal(cur->request->last_item->item_content.date_creation);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void stat_item_date_modification(Info & i)
|
void stat_item_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
PT::Date date = system->ToLocal(cur->request->last_item->item_content.date_modification);
|
pt::Date date = system->ToLocal(cur->request->last_item->item_content.date_modification);
|
||||||
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -472,7 +472,7 @@ return *this;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TexTextStream & TexTextStream::operator<<(const PT::Space & space)
|
TexTextStream & TexTextStream::operator<<(const pt::Space & space)
|
||||||
{
|
{
|
||||||
tmp_stream.Clear();
|
tmp_stream.Clear();
|
||||||
// !! IMPROVE ME
|
// !! IMPROVE ME
|
||||||
|
@ -485,7 +485,7 @@ return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TexTextStream & TexTextStream::operator<<(const PT::Date & date)
|
TexTextStream & TexTextStream::operator<<(const pt::Date & date)
|
||||||
{
|
{
|
||||||
tmp_stream.Clear();
|
tmp_stream.Clear();
|
||||||
// !! IMPROVE ME
|
// !! IMPROVE ME
|
||||||
|
|
|
@ -132,7 +132,7 @@ public:
|
||||||
TexTextStream & operator<<(RawText<void*> raw);
|
TexTextStream & operator<<(RawText<void*> raw);
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
TexTextStream & operator<<(RawText<PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw);
|
TexTextStream & operator<<(RawText<pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw);
|
||||||
|
|
||||||
|
|
||||||
// 'write' don't escapes too
|
// 'write' don't escapes too
|
||||||
|
@ -175,11 +175,11 @@ public:
|
||||||
TexTextStream & operator<<(unsigned long);
|
TexTextStream & operator<<(unsigned long);
|
||||||
TexTextStream & operator<<(double);
|
TexTextStream & operator<<(double);
|
||||||
TexTextStream & operator<<(const void *);
|
TexTextStream & operator<<(const void *);
|
||||||
TexTextStream & operator<<(const PT::Space & space);
|
TexTextStream & operator<<(const pt::Space & space);
|
||||||
TexTextStream & operator<<(const PT::Date & Date);
|
TexTextStream & operator<<(const pt::Date & Date);
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
TexTextStream & operator<<(const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
TexTextStream & operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
TexTextStream & TexTextStream::operator<<(RawText<PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw)
|
TexTextStream & TexTextStream::operator<<(RawText<pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw)
|
||||||
{
|
{
|
||||||
TextStream<std::wstring>::operator<<(raw.par);
|
TextStream<std::wstring>::operator<<(raw.par);
|
||||||
|
|
||||||
|
@ -198,9 +198,9 @@ return *this;
|
||||||
|
|
||||||
|
|
||||||
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
|
||||||
TexTextStream & TexTextStream::operator<<(const PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
TexTextStream & TexTextStream::operator<<(const pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> & arg)
|
||||||
{
|
{
|
||||||
typename PT::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
typename pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size>::const_iterator i;
|
||||||
|
|
||||||
for(i=arg.begin() ; i != arg.end() ; ++i)
|
for(i=arg.begin() ; i != arg.end() ; ++i)
|
||||||
ETextPutChar(*i);
|
ETextPutChar(*i);
|
||||||
|
|
|
@ -56,7 +56,7 @@ void winix_cur_time(Info & i)
|
||||||
{
|
{
|
||||||
static char buffer[100];
|
static char buffer[100];
|
||||||
|
|
||||||
PT::Date & date = cur->request->start_date;
|
pt::Date & date = cur->request->start_date;
|
||||||
|
|
||||||
sprintf(buffer, "%02d:%02d:%02d", date.hour, date.min, date.sec);
|
sprintf(buffer, "%02d:%02d:%02d", date.hour, date.min, date.sec);
|
||||||
i.out << buffer;
|
i.out << buffer;
|
||||||
|
|
Loading…
Reference in New Issue