added: winix functions: locale, timezone

changed: time zones -- now we have the daylight saving time
       different for each year (start, end)
added: config option: time_zone_id (size_t)
       time zone identifier for not logged users
       or for newly created accounts
       those identifiers you can see in etc/time_zones.conf file
       or by using timezone winix function with 'a' parameter (timezone/a) (!!IMPROVE ME NOT IMPLEMENTED YET)
       default: 34 (Coordinated Universal Time UTC+00:00)
added: config option: locale_default_id (size_t)
       locale for not logged users
       or for newly created accounts
added: config option: locale_max_id (size_t)
       a maximum value of a locale identifier
       default: 100 (maximum: 1000)
       each locale files should have its own identifier (in "winix_locale_id" field)
       from zero to this value
added: config option: time_zone_max_id (size_t)
       maximum value of a time zone identifier
       time zones with an id greater than this will be skipped
       default: 130 (maximum: 1000)
removed: config option: locale_default



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@852 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-06-26 23:19:19 +00:00
parent 54e6c07efc
commit b8ff5d4cfc
53 changed files with 4618 additions and 3053 deletions

View File

@@ -96,152 +96,154 @@ bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
void Config::AssignValues(bool stdout_is_closed)
{
demonize = Bool(L"demonize", true);
demonize = Bool(L"demonize", true);
user = AText(L"user");
group = AText(L"group");
additional_groups = Bool(L"additional_groups", true);
user = AText(L"user");
group = AText(L"group");
additional_groups = Bool(L"additional_groups", true);
log_file = AText(L"log_file");
log_notify_file = AText(L"log_notify_file");
log_delimiter = Text(L"log_delimiter", L"---------------------------------------------------------------------------------");
fcgi_socket = AText(L"fcgi_socket");
fcgi_socket_chmod = Int(L"fcgi_socket_chmod", 0770);
fcgi_socket_user = AText(L"fcgi_socket_user");
fcgi_socket_group = AText(L"fcgi_socket_group");
log_level = Int(L"log_level", 1);
log_request = Int(L"log_request", 1);
log_save_each_line = Bool(L"log_save_each_line", false);
log_stdout = Bool(L"log_stdout", false);
log_db_query = Bool(L"log_db_query", false);
log_plugin_call = Bool(L"log_plugin_call", false);
log_post_value_size = Size(L"log_post_value_size", 80);
log_file = AText(L"log_file");
log_notify_file = AText(L"log_notify_file");
log_delimiter = Text(L"log_delimiter", L"---------------------------------------------------------------------------------");
fcgi_socket = AText(L"fcgi_socket");
fcgi_socket_chmod = Int(L"fcgi_socket_chmod", 0770);
fcgi_socket_user = AText(L"fcgi_socket_user");
fcgi_socket_group = AText(L"fcgi_socket_group");
log_level = Int(L"log_level", 1);
log_request = Int(L"log_request", 1);
log_save_each_line = Bool(L"log_save_each_line", false);
log_stdout = Bool(L"log_stdout", false);
log_db_query = Bool(L"log_db_query", false);
log_plugin_call = Bool(L"log_plugin_call", false);
log_post_value_size = Size(L"log_post_value_size", 80);
post_file_max = Size(L"post_file_max", 8388608); // 8 MB
post_file_max = Size(L"post_file_max", 8388608); // 8 MB
upload_dir = Text(L"upload_dir");
common_dir = Text(L"common_dir");
upload_dir = Text(L"upload_dir");
common_dir = Text(L"common_dir");
NoLastSlash(upload_dir);
NoLastSlash(common_dir);
upload_dirs_chmod = Int(L"upload_dirs_chmod", 0750);
upload_files_chmod = Int(L"upload_files_chmod", 0640);
upload_dirs_chmod = Int(L"upload_dirs_chmod", 0750);
upload_files_chmod = Int(L"upload_files_chmod", 0640);
ListText(L"static_dirs", static_dirs);
dont_use_static_dirs = Bool(L"dont_use_static_dirs", false);
create_thumb = Bool(L"create_thumb", true);
thumb_mode = Int(L"thumb_mode", 2);
thumb_cx = Size(L"thumb_cx", 150);
thumb_cy = Size(L"thumb_cy", 150);
thumb_quality = Int(L"thumb_quality", 92);
image_resize = Bool(L"image_resize", true);
image_mode = Int(L"image_mode", 6);
image_cx = Size(L"image_cx", 1000);
image_cy = Size(L"image_cy", 800);
image_quality = Int(L"image_quality", 92);
convert_cmd = Text(L"convert_cmd", L"/usr/local/bin/convert");
dont_use_static_dirs = Bool(L"dont_use_static_dirs", false);
create_thumb = Bool(L"create_thumb", true);
thumb_mode = Int(L"thumb_mode", 2);
thumb_cx = Size(L"thumb_cx", 150);
thumb_cy = Size(L"thumb_cy", 150);
thumb_quality = Int(L"thumb_quality", 92);
image_resize = Bool(L"image_resize", true);
image_mode = Int(L"image_mode", 6);
image_cx = Size(L"image_cx", 1000);
image_cy = Size(L"image_cy", 800);
image_quality = Int(L"image_quality", 92);
convert_cmd = Text(L"convert_cmd", L"/usr/local/bin/convert");
templates_dir = Text(L"templates_dir");
templates_dir_default = Text(L"templates_dir_default");
txt_templates_dir = Text(L"txt_templates_dir");
templates_dir = Text(L"templates_dir");
templates_dir_default = Text(L"templates_dir_default");
txt_templates_dir = Text(L"txt_templates_dir");
txt_templates_dir_default = Text(L"txt_templates_dir_default");
templates_fun_prefix = Text(L"templates_fun_prefix", L"fun_");
templates_fun_postfix = Text(L"templates_fun_postfix", L".html");
templates_index = Text(L"templates_index", L"index.html");
templates_fun_prefix = Text(L"templates_fun_prefix", L"fun_");
templates_fun_postfix = Text(L"templates_fun_postfix", L".html");
templates_index = Text(L"templates_index", L"index.html");
template_only_root_use_template_fun = Bool(L"template_only_root_use_template_fun", false);
http_session_id_name = AText(L"http_session_id_name");
db_database = AText(L"db_database");
db_user = AText(L"db_user");
db_pass = AText(L"db_pass");
item_url_empty = Text(L"item_url_empty");
http_session_id_name = AText(L"http_session_id_name");
db_database = AText(L"db_database");
db_user = AText(L"db_user");
db_pass = AText(L"db_pass");
item_url_empty = Text(L"item_url_empty");
url_proto = Text(L"url_proto", L"http://");
url_ssl_proto = Text(L"url_ssl_proto", L"https://");
url_proto = Text(L"url_proto", L"http://");
url_ssl_proto = Text(L"url_ssl_proto", L"https://");
use_ssl = Bool(L"use_ssl", false);
use_ssl_static = Bool(L"use_ssl_static", false);
use_ssl_common = Bool(L"use_ssl_common", false);
use_ssl = Bool(L"use_ssl", false);
use_ssl_static = Bool(L"use_ssl_static", false);
use_ssl_common = Bool(L"use_ssl_common", false);
use_ssl_only_for_logged_users = Bool(L"use_ssl_only_for_logged_users", true);
use_ssl_redirect_code = Int(L"use_ssl_redirect_code", 303);
use_ssl_redirect_code = Int(L"use_ssl_redirect_code", 303);
base_url = Text(L"base_url");
base_url_static = Text(L"base_url_static");
base_url_common = Text(L"base_url_common");
base_url = Text(L"base_url");
base_url_static = Text(L"base_url_static");
base_url_common = Text(L"base_url_common");
base_url_redirect = Bool(L"base_url_redirect", false);
base_url_redirect_code = Int(L"base_url_redirect_code", 301);
base_url_redirect = Bool(L"base_url_redirect", false);
base_url_redirect_code = Int(L"base_url_redirect_code", 301);
NoLastSlash(base_url);
NoLastSlash(base_url_static);
NoLastSlash(base_url_common);
priv_no_user = Text(L"priv_no_user", L"-- no user --");
priv_no_group = Text(L"priv_no_group", L"-- no group --");
priv_no_user = Text(L"priv_no_user", L"-- no user --");
priv_no_group = Text(L"priv_no_group", L"-- no group --");
session_max_idle = Int(L"session_max_idle", 10800); // 3h
session_max_idle = Int(L"session_max_idle", 10800); // 3h
session_remember_max_idle = Int(L"session_remember_max_idle", 16070400); // 3 months
session_file = AText(L"session_file");
session_max = Size(L"session_max", 1000000);
session_file = AText(L"session_file");
session_max = Size(L"session_max", 1000000);
compression = Bool(L"compression", true);
compression = Bool(L"compression", true);
compression_page_min_size = Size(L"compression_page_min_size", 512);
compression_encoding = Int(L"compression_encoding", 20);
compression_encoding = Int(L"compression_encoding", 20);
html_filter = Bool(L"html_filter", true);
html_filter_trim_white = Bool(L"html_filter_trim_white", true);
html_filter_break_word = Int(L"html_filter_break_word", 60);
html_filter_wrap_line = Int(L"html_filter_wrap_line", 110);
html_filter_tabs = Size(L"html_filter_tabs", 2);
html_filter = Bool(L"html_filter", true);
html_filter_trim_white = Bool(L"html_filter_trim_white", true);
html_filter_break_word = Int(L"html_filter_break_word", 60);
html_filter_wrap_line = Int(L"html_filter_wrap_line", 110);
html_filter_tabs = Size(L"html_filter_tabs", 2);
html_filter_orphans = Bool(L"html_filter_orphans", true);
html_filter_orphans_mode_str = Text(L"html_filter_orphans_mode_str", L"nbsp");
locale_dir = Text(L"locale_dir");
locale_dir_default = Text(L"locale_dir_default");
locale_default = Text(L"locale_default");
locale_dir = Text(L"locale_dir");
locale_dir_default = Text(L"locale_dir_default");
locale_max_id = Size(L"locale_max_id", 100);
locale_default_id = Size(L"locale_default_id", 0);
ListText(L"locale_files", locale_files);
title_separator = Text(L"title_separator", L" / ");
title_separator = Text(L"title_separator", L" / ");
http_header_send_file = Text(L"http_header_send_file", L"X-LIGHTTPD-send-file");
debug_info = Bool(L"debug_info", false);
http_header_send_file = Text(L"http_header_send_file", L"X-LIGHTTPD-send-file");
debug_info = Bool(L"debug_info", false);
editors_html_safe_mode = Bool(L"editors_html_safe_mode", true);
editors_html_safe_mode = Bool(L"editors_html_safe_mode", true);
editors_html_safe_mode_skip_root = Bool(L"editors_html_safe_mode_skip_root", true);
plugins_dir = Text(L"plugins_dir", L"/usr/local/winix/plugins");
plugins_dir = Text(L"plugins_dir", L"/usr/local/winix/plugins");
NoLastSlash(plugins_dir);
ListText(L"plugins", plugin_file);
utf8 = Bool(L"utf8", true);
symlinks_follow_max = Size(L"symlinks_follow_max", 20);
utf8 = Bool(L"utf8", true);
symlinks_follow_max = Size(L"symlinks_follow_max", 20);
ticket_form_prefix = Text(L"ticket_form_prefix", L"ticketparam");
ticket_form_prefix = Text(L"ticket_form_prefix", L"ticketparam");
pass_min_size = Size(L"pass_min_size", 5);
pass_type = Int(L"pass_type", 12);
pass_hash_use_salt = Bool(L"pass_hash_use_salt", false);
pass_hash_salt = Text(L"pass_hash_salt");
pass_use_rsa = Bool(L"pass_use_rsa", false);
pass_rsa_private_key = Text(L"pass_rsa_private_key");
pass_min_size = Size(L"pass_min_size", 5);
pass_type = Int(L"pass_type", 12);
pass_hash_use_salt = Bool(L"pass_hash_use_salt", false);
pass_hash_salt = Text(L"pass_hash_salt");
pass_use_rsa = Bool(L"pass_use_rsa", false);
pass_rsa_private_key = Text(L"pass_rsa_private_key");
opensll_path = Text(L"opensll_path", L"/usr/bin/openssl");
opensll_path = Text(L"opensll_path", L"/usr/bin/openssl");
pattern_cacher_when_delete = Size(L"pattern_cacher_when_delete", 130);
pattern_cacher_how_many_delete = Size(L"pattern_cacher_how_many_delete", 30);
content_type_header = Int(L"content_type_header", 0);
content_type_header = Int(L"content_type_header", 0);
umask = Int(L"umask", 0222);
ezc_max_elements = Size(L"ezc_max_elements", 50000);
ezc_max_loop_elements = Size(L"ezc_max_loop_elements", 5000);
ezc_max_elements = Size(L"ezc_max_elements", 50000);
ezc_max_loop_elements = Size(L"ezc_max_loop_elements", 5000);
account_need_email_verification = Bool(L"account_need_email_verification", true);
reset_password_code_expiration_time = Long(L"reset_password_code_expiration_time", 86400);
time_zone.SetTz(space);
time_zone_default_id = Size(L"time_zone_default_id", 34);
time_zone_max_id = Size(L"time_zone_max_id", 130);
etc_dir = Text(L"etc_dir", L"");
time_zones_file = Text(L"time_zones_file", L"time_zones.conf");
etc_dir = Text(L"etc_dir", L"");
time_zones_file = Text(L"time_zones_file", L"time_zones.conf");
}
@@ -259,42 +261,17 @@ void Config::SetAdditionalVariables()
for(size_t i=0 ; i<static_dirs.size() ; ++i)
NoLastSlash(static_dirs[i]);
CheckLocale();
CheckPasswd();
if( content_type_header < 0 || content_type_header > 2 )
content_type_header = 0;
if( locale_default_id > locale_max_id )
locale_default_id = locale_max_id;
}
void Config::CheckLocale()
{
bool found = false;
if( locale_files.empty() )
locale_files.push_back(L"en");
if( locale_default.empty() )
locale_default = locale_files[0];
for(size_t i=0 ; i<locale_files.size() ; ++i)
{
if( locale_files[i] == locale_default )
{
locale_default_index = i;
found = true;
break;
}
}
if( !found )
{
// we have at least one item
locale_default = locale_files[0];
locale_default_index = 0;
}
}
void Config::CheckPasswd()