added support for UTF-8
now the UTF-8 is a default charset git-svn-id: svn://ttmath.org/publicrep/winix/trunk@677 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
100
core/config.h
100
core/config.h
@@ -65,7 +65,7 @@ public:
|
||||
bool log_db_query;
|
||||
|
||||
// request delimiter in the log file, default "---------"
|
||||
std::string log_delimiter;
|
||||
std::wstring log_delimiter;
|
||||
|
||||
// fast cgi: socket (unix domain)
|
||||
std::string fcgi_socket;
|
||||
@@ -79,19 +79,19 @@ public:
|
||||
// fast cgi: group of the socket
|
||||
std::string fcgi_socket_group;
|
||||
|
||||
std::string templates_dir;
|
||||
std::string templates_dir_default; // templates from winix
|
||||
std::wstring templates_dir;
|
||||
std::wstring templates_dir_default; // templates from winix
|
||||
|
||||
// prefix and postfix for functions templates
|
||||
// default:
|
||||
// prefix: "fun_"
|
||||
// postfix: ".html"
|
||||
std::string templates_fun_prefix;
|
||||
std::string templates_fun_postfix;
|
||||
std::wstring templates_fun_prefix;
|
||||
std::wstring templates_fun_postfix;
|
||||
|
||||
// main html template
|
||||
// default: index.html
|
||||
std::string templates_index;
|
||||
std::wstring templates_index;
|
||||
|
||||
// if true then only root can use 'template' function
|
||||
// default: false
|
||||
@@ -109,8 +109,8 @@ public:
|
||||
bool base_url_redirect;
|
||||
|
||||
// string used in a place where is a user (or group) selected
|
||||
std::string priv_no_user;
|
||||
std::string priv_no_group;
|
||||
std::wstring priv_no_user;
|
||||
std::wstring priv_no_group;
|
||||
|
||||
// time in seconds when the user will be automatically logged out (iddle time)
|
||||
int session_max_idle;
|
||||
@@ -130,12 +130,12 @@ public:
|
||||
|
||||
// plugins directory
|
||||
// default: /usr/local/winix/plugins
|
||||
std::string plugins_dir;
|
||||
std::wstring plugins_dir;
|
||||
|
||||
// plugins
|
||||
// you can provide either a relative path (plugins_dir will be used)
|
||||
// or a full path to a plugin
|
||||
std::vector<std::string> plugin_file;
|
||||
std::vector<std::wstring> plugin_file;
|
||||
|
||||
// should the html code be cleaned by the html filter
|
||||
bool html_filter;
|
||||
@@ -169,50 +169,51 @@ public:
|
||||
HTMLFilter::OrphanMode html_filter_orphans_mode;
|
||||
|
||||
// the url of a new empty item (if there is not the subject too)
|
||||
std::string item_url_empty;
|
||||
std::wstring item_url_empty;
|
||||
|
||||
// maximum length of a file send by post multipart form
|
||||
// 0 - not used
|
||||
int post_file_max;
|
||||
size_t post_file_max;
|
||||
|
||||
// directories for static files
|
||||
std::string auth_simplefs_dir;
|
||||
std::string auth_hashfs_dir;
|
||||
std::wstring auth_simplefs_dir;
|
||||
std::wstring auth_hashfs_dir;
|
||||
|
||||
// temporary directory for static content used by the upload function
|
||||
// should be on the same partition as auth_simplefs_dir and auth_hashfs_dir
|
||||
std::string auth_tmp_dir;
|
||||
std::wstring auth_tmp_dir;
|
||||
|
||||
// default locale: en pl
|
||||
std::string locale_str;
|
||||
// locale: en, pl
|
||||
// default: en
|
||||
std::wstring locale_str;
|
||||
|
||||
// directory with locale files
|
||||
std::string locale_dir;
|
||||
std::wstring locale_dir;
|
||||
|
||||
// directory with default locale files (those from winix)
|
||||
std::string locale_dir_default;
|
||||
std::wstring locale_dir_default;
|
||||
|
||||
// the main address of the server (e.g. someserver.com) (without the 'www' part etc)
|
||||
std::string base_server;
|
||||
std::wstring base_server;
|
||||
|
||||
// the main address of the site (e.g. http://www.someserver.com)
|
||||
std::string base_url;
|
||||
std::wstring base_url;
|
||||
|
||||
// static content authorized by winix
|
||||
std::string base_url_auth;
|
||||
std::wstring base_url_auth;
|
||||
|
||||
// static content not authorized by winix
|
||||
std::string base_url_static;
|
||||
std::wstring base_url_static;
|
||||
|
||||
// additional static server for common content (not authorized)
|
||||
std::string base_url_common;
|
||||
std::wstring base_url_common;
|
||||
|
||||
// separator used in <title> html tag
|
||||
std::string title_separator;
|
||||
std::wstring title_separator;
|
||||
|
||||
// http header recognized by www server as a file to send back
|
||||
// default: X-LIGHTTPD-send-file
|
||||
std::string http_header_send_file;
|
||||
std::wstring http_header_send_file;
|
||||
|
||||
// the minimum size of a password for new users (function: adduser)
|
||||
// default: 5
|
||||
@@ -240,6 +241,11 @@ public:
|
||||
// default: 0
|
||||
int time_zone_offset_guest;
|
||||
|
||||
// charset used in templates, locales, logs etc.
|
||||
// default: true (UTF-8)
|
||||
// if false it means 8-bit ASCII
|
||||
bool utf8;
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
@@ -247,35 +253,39 @@ public:
|
||||
// based on base_url
|
||||
// set by SetAdditionalVariables()
|
||||
// without the first part http:// (or https://) or the whole string is empty
|
||||
std::string base_url_http_host;
|
||||
std::string base_url_auth_http_host;
|
||||
std::wstring base_url_http_host;
|
||||
std::wstring base_url_auth_http_host;
|
||||
|
||||
|
||||
Config();
|
||||
bool ReadConfig(bool errors_to_stdout_, bool stdout_is_closed = true);
|
||||
|
||||
std::string Text(const char * name);
|
||||
std::string Text(const char * name, const char * def);
|
||||
std::string Text(const std::string & name, const std::string & def);
|
||||
int Int(const char *);
|
||||
int Int(const char * name, int def);
|
||||
int Int(const std::string & name, int def);
|
||||
size_t Size(const char *);
|
||||
size_t Size(const char * name, size_t def);
|
||||
size_t Size(const std::string & name, size_t def);
|
||||
bool Bool(const char *);
|
||||
bool Bool(const char * name, bool def);
|
||||
bool Bool(const std::string & name, bool def);
|
||||
void ListText(const char * name, std::vector<std::string> & list);
|
||||
void ListText(const std::string & name, std::vector<std::string> & list);
|
||||
std::wstring Text(const wchar_t * name);
|
||||
std::wstring Text(const wchar_t * name, const wchar_t * def);
|
||||
std::wstring Text(const std::wstring & name, const std::wstring & def);
|
||||
std::string AText(const wchar_t * name);
|
||||
std::string AText(const wchar_t * name, const wchar_t * def);
|
||||
std::string AText(const std::wstring & name, const std::wstring & def);
|
||||
|
||||
void NoLastSlash(std::string & s);
|
||||
void NoFirstHttp(std::string & s);
|
||||
int Int(const wchar_t *);
|
||||
int Int(const wchar_t * name, int def);
|
||||
int Int(const std::wstring & name, int def);
|
||||
size_t Size(const wchar_t *);
|
||||
size_t Size(const wchar_t * name, size_t def);
|
||||
size_t Size(const std::wstring & name, size_t def);
|
||||
bool Bool(const wchar_t *);
|
||||
bool Bool(const wchar_t * name, bool def);
|
||||
bool Bool(const std::wstring & name, bool def);
|
||||
void ListText(const wchar_t * name, std::vector<std::wstring> & list);
|
||||
void ListText(const std::wstring & name, std::vector<std::wstring> & list);
|
||||
|
||||
// for debug
|
||||
void Print(std::ostream & out);
|
||||
|
||||
private:
|
||||
void ShowError();
|
||||
void AssignValues(bool stdout_is_closed);
|
||||
void SetHttpHost(const std::string & in, std::string & out);
|
||||
void SetHttpHost(const std::wstring & in, std::wstring & out);
|
||||
void SetAdditionalVariables();
|
||||
|
||||
ConfParser parser;
|
||||
|
Reference in New Issue
Block a user