2008-12-10 05:42:49 +01:00
|
|
|
/*
|
|
|
|
* This file is a part of CMSLU -- Content Management System like Unix
|
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2009-04-21 22:50:55 +02:00
|
|
|
* Copyright (c) 2008-2009, Tomasz Sowa
|
2008-12-10 05:42:49 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-04-21 22:50:55 +02:00
|
|
|
#ifndef headerfilecmslucoredata
|
|
|
|
#define headerfilecmslucoredata
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2008-12-12 04:11:29 +01:00
|
|
|
#include <string.h>
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2008-12-21 22:17:09 +01:00
|
|
|
#include "dirs.h"
|
|
|
|
#include "users.h"
|
|
|
|
#include "groups.h"
|
2008-12-30 02:05:03 +01:00
|
|
|
#include "functions.h"
|
2009-04-16 03:59:42 +02:00
|
|
|
#include "lastcontainer.h"
|
2009-04-20 00:13:21 +02:00
|
|
|
#include "mounts.h"
|
2009-11-17 00:36:38 +01:00
|
|
|
#include "rebus.h"
|
2010-02-13 21:12:15 +01:00
|
|
|
#include "loadavg.h"
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Data
|
|
|
|
{
|
|
|
|
public:
|
2008-12-11 03:46:16 +01:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------
|
|
|
|
// members read from a config file
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2008-12-11 03:46:16 +01:00
|
|
|
// name of the config file (full path can be)
|
|
|
|
std::string config_file;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-10-01 00:31:20 +02:00
|
|
|
// log file name, log file name for notifications (sending emails, etc)
|
|
|
|
std::string log_file, log_notify_file;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
// 1 - minimum
|
|
|
|
// 2 - (default)
|
|
|
|
// 3 - maximum - all logs
|
|
|
|
int log_level;
|
|
|
|
|
|
|
|
// logging to stdout too
|
|
|
|
bool log_stdout;
|
|
|
|
|
2010-01-28 22:09:48 +01:00
|
|
|
// how many requests should be logged in the same time
|
|
|
|
// default: 1
|
|
|
|
int log_request;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
// fast cgi: socket (unix domain)
|
|
|
|
std::string fcgi_socket;
|
|
|
|
|
|
|
|
// fast cgi: socket permissions
|
|
|
|
int fcgi_socket_chmod;
|
|
|
|
|
|
|
|
// fast cgi: owner of the socket
|
|
|
|
std::string fcgi_socket_user;
|
|
|
|
|
|
|
|
// fast cgi: group of the socket
|
|
|
|
std::string fcgi_socket_group;
|
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
std::string templates_dir;
|
|
|
|
std::string templates_dir_default; // templates from winix
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
std::string db_database;
|
|
|
|
std::string db_user;
|
|
|
|
std::string db_pass;
|
2009-12-30 21:46:12 +01:00
|
|
|
|
|
|
|
std::string base_server;
|
|
|
|
std::string base_url_prefix;
|
|
|
|
std::string base_url_static_prefix;
|
2010-02-11 21:56:52 +01:00
|
|
|
std::string base_url_static_ext_prefix;
|
2009-12-30 21:46:12 +01:00
|
|
|
std::string base_url_static_auth_prefix;
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
std::string http_session_id_name;
|
|
|
|
|
2008-12-12 04:11:29 +01:00
|
|
|
// when the HOST_HTTP environment variable doesn't point into 'base_url' (the part 'http://' and the last slash is removed)
|
|
|
|
// the server will redirect into 'base_url' + 'REQUEST_URI'
|
|
|
|
// it's useful when you want to redirect from 'mydomain.tld' into 'www.mydomain.tld' etc.
|
|
|
|
bool base_url_redirect;
|
|
|
|
|
2008-12-21 22:17:09 +01:00
|
|
|
// string used in a place where is a user (or group) selected
|
|
|
|
std::string priv_no_user;
|
|
|
|
std::string priv_no_group;
|
|
|
|
|
2009-11-21 00:09:52 +01:00
|
|
|
// time in seconds when the user will be automatically logged out (iddle time)
|
2010-01-11 15:47:52 +01:00
|
|
|
int session_max_idle;
|
2009-11-21 00:09:52 +01:00
|
|
|
|
|
|
|
// time in seconds when the user will be automatically logged out (when he selected 'remember me' option)
|
2010-01-11 15:47:52 +01:00
|
|
|
// this time is usually greater than session_max_idle
|
|
|
|
int session_remember_max_idle;
|
2009-11-21 00:09:52 +01:00
|
|
|
|
|
|
|
// this file is used when the program is starting and ending
|
|
|
|
std::string session_file;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-11-21 00:09:52 +01:00
|
|
|
// allow the html ouput to be compressed
|
2009-09-22 01:05:05 +02:00
|
|
|
bool compression;
|
2009-11-13 21:40:11 +01:00
|
|
|
|
|
|
|
// plugins
|
|
|
|
std::vector<std::string> plugin_file;
|
2009-09-22 01:05:05 +02:00
|
|
|
|
2009-12-09 01:42:40 +01:00
|
|
|
// the html code is cleaned by our filter
|
|
|
|
bool html_filter;
|
|
|
|
|
2009-12-30 21:46:12 +01:00
|
|
|
// the url of a new empty item (if there is not the subject too)
|
|
|
|
std::string item_url_empty;
|
|
|
|
|
2010-01-06 20:17:53 +01:00
|
|
|
// maximum length of a file send by post multipart form
|
|
|
|
// 0 - not used
|
|
|
|
int post_file_max;
|
|
|
|
|
2010-01-06 20:36:29 +01:00
|
|
|
// directory for static files (for fastcgi authorizer mode)
|
|
|
|
std::string static_auth_dir;
|
2010-01-06 20:17:53 +01:00
|
|
|
|
2010-02-12 18:05:32 +01:00
|
|
|
// temporary dir for static content used by upload function
|
|
|
|
// should be on the same partition as static_auth_dir
|
|
|
|
std::string static_auth_dir_tmp;
|
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
// default locale: en pl
|
|
|
|
std::string locale_str;
|
|
|
|
|
|
|
|
// directory with locale files
|
|
|
|
std::string locale_dir;
|
|
|
|
|
|
|
|
// directory with default locale files (those from winix)
|
|
|
|
std::string locale_dir_default;
|
|
|
|
|
2009-12-30 21:46:12 +01:00
|
|
|
// below variables are based on the other config variables
|
|
|
|
|
|
|
|
// base_url_prefix + base_server
|
|
|
|
std::string base_url;
|
|
|
|
|
|
|
|
// base_url_static_prefix + base_server
|
|
|
|
std::string base_url_static;
|
|
|
|
|
2010-02-11 21:56:52 +01:00
|
|
|
// additional static server for common content such as ckeditor
|
|
|
|
std::string base_url_static_ext;
|
|
|
|
|
2009-12-30 21:46:12 +01:00
|
|
|
// base_url_static_auth_prefix + base_server
|
|
|
|
std::string base_url_static_auth;
|
|
|
|
|
2010-02-15 01:31:14 +01:00
|
|
|
// separator used in <title> html tag
|
|
|
|
std::string title_separator;
|
2010-01-28 16:39:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-11 03:46:16 +01:00
|
|
|
// end config members
|
|
|
|
// -----------------------------------------------------------------
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-12-30 21:46:12 +01:00
|
|
|
|
|
|
|
|
2008-12-11 03:46:16 +01:00
|
|
|
// false at the beginning
|
|
|
|
bool stdout_is_closed;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2008-12-12 04:11:29 +01:00
|
|
|
// true if there was SIGHUP signal
|
2008-12-11 03:46:16 +01:00
|
|
|
volatile bool signal_hup;
|
|
|
|
|
2008-12-12 04:11:29 +01:00
|
|
|
// contains current directories tree
|
2008-12-21 22:17:09 +01:00
|
|
|
Dirs dirs;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2008-12-12 04:11:29 +01:00
|
|
|
// based on base_url
|
|
|
|
// set by SetAdditionalVariables()
|
2009-12-30 21:46:12 +01:00
|
|
|
// without the first part http:// (or https://) or the whole string is empty
|
2008-12-12 04:11:29 +01:00
|
|
|
std::string base_url_http_host;
|
2009-12-30 21:46:12 +01:00
|
|
|
std::string base_url_static_auth_http_host;
|
|
|
|
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2008-12-12 04:11:29 +01:00
|
|
|
// call this method after the config file is read
|
|
|
|
void SetAdditionalVariables();
|
|
|
|
|
2008-12-11 03:46:16 +01:00
|
|
|
|
2008-12-21 22:17:09 +01:00
|
|
|
|
|
|
|
// users
|
|
|
|
Users users;
|
|
|
|
|
|
|
|
// groups
|
|
|
|
Groups groups;
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
// functions (ls, cat, etc)
|
|
|
|
Functions functions;
|
2009-04-16 03:59:42 +02:00
|
|
|
|
2009-04-20 00:13:21 +02:00
|
|
|
// for 'last' function
|
2009-04-16 03:59:42 +02:00
|
|
|
LastContainer last;
|
2008-12-30 02:05:03 +01:00
|
|
|
|
2009-04-20 00:13:21 +02:00
|
|
|
// mount points
|
|
|
|
Mounts mounts;
|
|
|
|
|
2009-11-17 00:36:38 +01:00
|
|
|
// rebus (captcha)
|
|
|
|
Rebus rebus;
|
2009-04-20 00:13:21 +02:00
|
|
|
|
2010-02-11 21:56:52 +01:00
|
|
|
// the time when the winix starts
|
|
|
|
time_t system_start;
|
|
|
|
|
|
|
|
// how many logged users
|
|
|
|
long how_many_logged;
|
2009-04-20 00:13:21 +02:00
|
|
|
|
2010-02-13 21:12:15 +01:00
|
|
|
// load averages
|
|
|
|
LoadAvg load_avg;
|
|
|
|
|
2008-12-11 03:46:16 +01:00
|
|
|
Data();
|
2008-12-12 04:11:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
2009-12-30 21:46:12 +01:00
|
|
|
void SetHttpHost(const std::string & in, std::string & out);
|
2008-12-10 05:42:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern Data data;
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|