Compare commits

...

563 Commits

Author SHA1 Message Date
Tomasz Sowa 612501217c
update uikit to 3.20.9 2024-05-12 16:16:56 +02:00
Tomasz Sowa d86ab8f9c0
update uikit to 3.20.8 2024-04-29 23:59:30 +02:00
Tomasz Sowa 5a33563722
update htmx to 1.9.12 2024-04-28 19:45:16 +02:00
Tomasz Sowa 1c850b12ec
add a q_encode(...) method to misc 2024-04-28 16:14:57 +02:00
Tomasz Sowa 140b4495df
update jquery-file-upload to 10.32.0 2024-04-15 08:20:02 +02:00
Tomasz Sowa 8b0b25ed0a
fix: correctly flush logs when there was a db migration error 2024-04-15 06:38:23 +02:00
Tomasz Sowa eacdcfb980
update htmx to 3.19.4 2024-04-11 05:52:09 +02:00
Tomasz Sowa 132e7aa937
update htmx to 1.9.11 2024-03-20 03:15:05 +01:00
Tomasz Sowa d9f3b69dde
update uikit to 3.19.2 2024-03-20 03:07:17 +01:00
Tomasz Sowa de753070a8
do not overwrite WINIX_INSTALL_DIR if already set 2024-03-11 16:59:45 +01:00
Tomasz Sowa c1c6e6a588
install winix.so to a lib subdirectory 2024-03-11 16:12:13 +01:00
Tomasz Sowa 291147503f
update uikit to 3.19.1 2024-03-08 22:34:42 +01:00
Tomasz Sowa dbf7dfab82
improve the startup help messages 2024-03-08 22:01:33 +01:00
Tomasz Sowa b753464608
add some operators to the Log class
add:
virtual Log & operator<<(long double);
virtual Log & operator<<(float);
virtual Log & operator<<(long long unsigned int);
virtual Log & operator<<(unsigned int);
virtual Log & operator<<(short unsigned int);
virtual Log & operator<<(long long int);
virtual Log & operator<<(short int);
virtual Log & operator<<(bool);
virtual Log & operator<<(unsigned char);
virtual Log & operator<<(const pt::Stream &);
2024-02-13 22:29:22 +01:00
Tomasz Sowa 544ef298aa
update uikit to 3.18.3 2024-02-13 18:54:41 +01:00
Tomasz Sowa 065a2d182f
update htmx to 1.9.10 2024-01-16 23:17:14 +01:00
Tomasz Sowa f4470ccbe7
allow to not set the res value from a plugin function
Add PluginInfo::has_res (bool, default true). If set to false by a plugin function
then the PluginInfo::res value is not taken into account when calculating how many plugins
have returned true or false.
2024-01-04 15:57:29 +01:00
Tomasz Sowa 71ad4869ce
fix: take into account hours when calculating a relative timezone dst 2023-12-27 16:25:54 +01:00
Tomasz Sowa 09dc6782c8
fix: remember the first/last weekday flags from a timezone DST
If a date is given in a relative form with first/last parameters,
we must remember them in order to select the appropriate day
of the week from the appropriate year.
2023-12-24 14:55:39 +01:00
Tomasz Sowa 0cebb2dc52
allow to use a first|last weekday name when defining a timezone dst
the format of a 'start' or 'end' field in a dst is:
MM-[first|last]:[monday|tuesday|wednesday|thursday|friday|saturday|sunday] HH:MM:SS
or just as beforehand: MM-DD HH:MM:SS

a sample timezone:
{
name = "tz_+01:00d"
id = "40"
offset_str = "+01:00"

dst = (

{
year = "2001"
has_dst = true
offset_str = "+01:00"
start  	   = "03-last-sunday 01:00"
end    	   = "10-last-sunday 01:00"
}

) # end of dst
}
2023-12-20 03:58:21 +01:00
Tomasz Sowa 0724ca8eb3
update htmx to 1.9.9 2023-12-02 10:45:44 +01:00
Tomasz Sowa 53991e54e1
update uikit to 3.17.11 2023-11-21 18:59:51 +01:00
Tomasz Sowa df7ae1c6ea
update uikit to 3.17.9 2023-11-16 23:10:51 +01:00
Tomasz Sowa d1f5d9aa88
(winixcli): add a --sort-tables option
while here:
- add a fil_max_size filter for putting a space if the inner stream is greater than x characters
2023-11-09 10:57:11 +01:00
Tomasz Sowa a54d70bed4
add a 422 Header status - Unprocessable Entity 2023-11-08 17:59:40 +01:00
Tomasz Sowa bcde5c628a
update uikit to 3.17.8 2023-11-07 03:56:45 +01:00
Tomasz Sowa f241eb0a18
update htmx to 1.9.7 2023-11-06 04:43:20 +01:00
Tomasz Sowa 74c0c936f6
make depend 2023-11-02 05:15:30 +01:00
Tomasz Sowa 79babc916a
add a Request::raw_post buffer
This buffer is used when a Function::NeedToCopyRawPost() method returned true.

while here:
- remove WINIX_POST_PARAMS and WINIX_RAW_POST_STRING plugin messages
2023-11-02 05:14:48 +01:00
Tomasz Sowa a08bf9f804
update uikit to 3.17.5 2023-10-24 21:36:25 +02:00
Tomasz Sowa 966577cd58
add QT Creator files to .gitignore 2023-10-22 23:38:38 +02:00
Tomasz Sowa 8f20c8f67c
update uikit to 3.17.1 2023-10-10 13:42:49 +02:00
Tomasz Sowa f6c04b2d00
downgrade ckeditor to 4.22.1 as 4.23.0 requires a license key 2023-09-30 01:03:54 +02:00
Tomasz Sowa 0474c76a3d
update ckeditor to 4.23.0 2023-09-30 00:27:59 +02:00
Tomasz Sowa 7a29a072be
update jquery to 3.7.1 2023-09-30 00:13:28 +02:00
Tomasz Sowa 24c2ecb8dd
update htmx to 1.9.6 2023-09-30 00:06:57 +02:00
Tomasz Sowa 7a1cea63bf
update uikit to 3.17.0 2023-09-30 00:02:00 +02:00
Tomasz Sowa e600aebaae
add a RequestJobBase base class for requests jobs 2023-09-28 07:47:06 +02:00
Tomasz Sowa 5e45ad3417
fix(Http): send body content for PATCH, DELETE and OPTIONS methods if exists
while here:
- use CURLOPT_UPLOAD instead of CURLOPT_PUT as the latter is depracated
2023-09-26 23:02:34 +02:00
Tomasz Sowa 79e971cb76
parse the input body for the PUT and PATCH methods too 2023-09-15 10:04:25 +02:00
Tomasz Sowa edee581ecf
update uikit to 3.16.26 2023-08-31 02:01:47 +02:00
Tomasz Sowa f7e077a7c5
add a TimeZone::PrintOffset(...) method 2023-08-29 15:02:37 +02:00
Tomasz Sowa 6a9504fd5f
update htmx to 1.9.5 2023-08-26 00:16:06 +02:00
Tomasz Sowa 6d256e6512
fix: correctly set a Request::RunState::job_run flag to the background request
The flag should be set to the task.request and not to the cur->request.
The cur->request could have been already changed by the main thread.
2023-08-25 16:24:27 +02:00
Tomasz Sowa cf383fa026
update easepick to 1.2.1 2023-08-21 13:31:02 +02:00
Tomasz Sowa c86536d660
update htmx to 1.9.4 2023-08-09 22:45:59 +02:00
Tomasz Sowa dba87d6213
update uikit to 3.16.24 2023-08-06 18:00:25 +02:00
Tomasz Sowa 52f9d399ca
add a Header::text_xml and text_xml_utf8 types 2023-07-31 17:31:22 +02:00
Tomasz Sowa 7b7a962f19
update uikit to 3.16.23 2023-07-30 22:47:36 +02:00
Tomasz Sowa c37722c29a
update ckeditor to 4.22.1 and jquery to 3.7.0 2023-07-23 14:40:13 +02:00
Tomasz Sowa ca509d3a86
update htmx to 1.9.3 2023-07-16 21:37:04 +02:00
Tomasz Sowa bf79e46411
add a GetUTF8File(...) method with a pt::WTextStream & content to the misc 2023-07-04 22:59:57 +02:00
Tomasz Sowa 08821eb440
update uikit to 3.16.22 2023-06-23 01:47:51 +02:00
Tomasz Sowa d7878b5564
update uikit to 3.16.21 2023-06-14 03:13:44 +02:00
Tomasz Sowa 0b52ae80dd
update uikit to 3.16.19 2023-05-27 17:27:42 +02:00
Tomasz Sowa 3e46d8b4b4
update uikit to 3.16.18 2023-05-23 14:48:28 +02:00
Tomasz Sowa 1655ae3562
fix: correctly clear after a request when an exception has been thrown 2023-05-16 15:31:13 +02:00
Tomasz Sowa dda325bbbf
allow to compile with gcc 12 2023-05-13 16:12:02 +02:00
Tomasz Sowa c326c2a095
update uikit to 3.16.17 2023-05-11 08:22:12 +02:00
Tomasz Sowa bf386e2286
add a Http::set_smtp_ssl_mode(long mode) method for selecting the ssl mode 2023-05-10 14:00:33 +02:00
Tomasz Sowa e822e13dc8
add support for sending emails in Http class 2023-05-10 09:01:30 +02:00
Tomasz Sowa cc2c008bfd
update htmx to 1.9.2 2023-05-08 06:01:20 +02:00
Tomasz Sowa b8a8013d4c
update uikit to 3.16.15 2023-04-15 23:50:18 +02:00
Tomasz Sowa 12ed77aeb1
update htmx to 1.9.0 2023-04-13 21:45:39 +02:00
Tomasz Sowa 7476048da6
make depend 2023-04-12 17:21:42 +02:00
Tomasz Sowa 8a307790c0
update jquery to 3.6.4 2023-04-09 14:25:11 +02:00
Tomasz Sowa a49b10ed2d
allow to upload files from the ckeditor
while here:
- update ckeditor to 4.21.0
- add a Sourcedialog plugin to the ckeditor
2023-04-09 14:10:21 +02:00
Tomasz Sowa 6a2da642b0
update uikit to 3.16.14 2023-04-08 09:48:12 +02:00
Tomasz Sowa b836c77950
update uikit to 3.16.13 2023-04-06 07:52:03 +02:00
Tomasz Sowa 2aa4eee20d
update uikit to 3.16.12 2023-03-28 07:37:15 +02:00
Tomasz Sowa 9ada82c4aa
update uikit to 3.16.6 2023-03-12 13:50:50 +01:00
Tomasz Sowa aa9b83f740
update uikit to 3.16.5 2023-03-10 19:26:26 +01:00
Tomasz Sowa 4ddfd2cd3a
update uikit to 3.16.3 2023-02-27 22:14:36 +01:00
Tomasz Sowa d15f5e4fa4
update uikit to 3.16.1 2023-02-27 01:57:39 +01:00
Tomasz Sowa 2e455f97ac
add support for serializing to xml 2023-02-27 00:34:29 +01:00
Tomasz Sowa f664cc1a53
update flatpickr to 4.6.13 2023-02-15 23:03:56 +01:00
Tomasz Sowa ae505f3201
remove white characters from flatpickr js script 2023-02-15 22:57:41 +01:00
Tomasz Sowa d5433cddf1
update jquery to 3.6.3 2023-02-14 13:05:45 +01:00
Tomasz Sowa 52773a271c
update ckeditor to 4.20.1 2023-02-14 12:26:36 +01:00
Tomasz Sowa e9311989ab
update uikit to 3.15.24 2023-02-14 00:21:16 +01:00
Tomasz Sowa 7b63c01033
update uikit to 3.15.23 2023-02-02 10:43:32 +01:00
Tomasz Sowa 5972b2bb39 update uikit to 3.15.22 2023-01-19 23:42:48 +01:00
Tomasz Sowa f182978ea5 update htmx to 1.8.5 2023-01-19 12:49:03 +01:00
Tomasz Sowa ebb8132808 update uikit to 3.15.21 2023-01-12 17:27:09 +01:00
Tomasz Sowa 1bd1762258 update uikit to 3.15.20 2023-01-05 20:29:44 +01:00
Tomasz Sowa 00b0e251f4 update uikit to 3.15.19 2022-12-28 10:05:03 +01:00
Tomasz Sowa 14e32df8c9 fix(Http): use uninitialize_curl() in begin() method 2022-12-23 04:23:38 +01:00
Tomasz Sowa aa938f05ca add methods to set a client certificate/key and the CA in the Http class 2022-12-21 14:09:31 +01:00
Tomasz Sowa 4583ab28ed add primary keys definition to migration rules 2022-12-19 19:13:45 +01:00
Tomasz Sowa 9c0cd6eb5e add Http::set_ssl_version() to set the available TLS version to use 2022-12-19 14:17:30 +01:00
Tomasz Sowa 32c30cf536 update uikit to 3.15.18 2022-12-13 15:10:18 +01:00
Tomasz Sowa a8b7a9e122 update uikit to 3.15.17 2022-12-08 12:26:50 +01:00
Tomasz Sowa d07ff5b881 update uikit to 3.15.15 2022-12-05 06:57:51 +01:00
Tomasz Sowa 66fae598c2 parse winixjson_* environment variables as json config options 2022-11-25 13:30:51 +01:00
Tomasz Sowa 589e889822 update uikit to 3.15.14 2022-11-24 22:14:55 +01:00
Tomasz Sowa 89249f1297 add Http::fetch(...) methods 2022-11-18 16:38:03 +01:00
Tomasz Sowa 2bd56c87e4 update uikit to 3.15.13 2022-11-17 23:07:40 +01:00
Tomasz Sowa 204688464e rename Http:put() to Http:post() and add a separate Http:put() 2022-11-17 02:47:00 +01:00
Tomasz Sowa 1d0956abab update to the new pikotools api: change converting functions to the snake case 2022-11-14 03:22:48 +01:00
Tomasz Sowa c2013ff47f do not use the ezc engine when sending a static file
while here:
- in send_file_mode=0 return a 404 if a static file was not correctly read
2022-11-14 00:54:50 +01:00
Tomasz Sowa 624bf47c8d update htmx to 1.8.4 2022-11-07 21:01:18 +01:00
Tomasz Sowa cdd395efa5 update uikit to 3.15.12 2022-11-07 20:54:41 +01:00
Tomasz Sowa 47f6e2234c update htmx to 1.8.2 2022-10-26 12:44:48 +02:00
Tomasz Sowa 1648092cd5 update uikit to 3.15.11 2022-10-26 12:33:11 +02:00
Tomasz Sowa 99fbf6ca27 add WINIX_STARTED plugin message 2022-10-19 14:26:34 +02:00
Tomasz Sowa f050fc2316 make more virtual functions is BaseThread 2022-10-19 14:26:18 +02:00
Tomasz Sowa 1015baf111 make depend 2022-10-17 08:16:45 +02:00
Tomasz Sowa 04f0a2f808 add MoveHelper for moving winix files - copied from Mv function 2022-10-17 08:16:28 +02:00
Tomasz Sowa 1da240afb9 check notitle parameter in upload winix function 2022-10-17 08:15:27 +02:00
Tomasz Sowa 77a00f5989 fix: return a correct status from Dirs::AddDirectory() 2022-10-17 08:13:20 +02:00
Tomasz Sowa f3d6494ae5 add the easepick - a date and time picker 2022-10-14 01:56:44 +02:00
Tomasz Sowa 8edd0ef07a fix: use the base_url as a domain when creating a session cookie if a cookie domain is empty 2022-09-28 19:28:17 +02:00
Tomasz Sowa 3855ea9fa7 add /usr/include/postgresql to includes paths 2022-09-23 19:53:26 +02:00
Tomasz Sowa a81839fd9c make depend 2022-09-23 18:34:08 +02:00
Tomasz Sowa 03035f038f use PT_HAS_MORM_LIBRARY macro when building too
while here:
- use some conditionals in the Makefile
2022-09-23 18:34:08 +02:00
Tomasz Sowa baa870edbd update to uikit 3.15.10 2022-09-22 10:38:31 +02:00
Tomasz Sowa c8bc23312b update uikit to 3.15.8 2022-09-16 13:29:25 +02:00
Tomasz Sowa d5e6fb7c54 add Access-Control-Expose-Headers to normal cors requests too 2022-09-14 12:48:20 +02:00
Tomasz Sowa 6138497fe0 change how origin header is treated
Now check whether the origin is in allowed_origins table,
and if not check allow_all_origins config parameter.

While here:
- add are_cors_preflight_requests_available - if true then preflight
  requests are available (default false)
2022-09-09 01:01:39 +02:00
Tomasz Sowa 05ecac8426 add support for more cookie flags in Request::AddCookie() method
changed in config options:
- renamed: http_session_id_name to session_cookie_name
- add config options: session_cookie_path, session_cookie_domain, session_cookie_same_site,
  session_cookie_http_only, session_cookie_secure
2022-09-08 05:40:44 +02:00
Tomasz Sowa 222a1c8a1f refactor the algorithm for testing the cors
while here:
- send cors headers even if the status is 404
- add: access_control_expose_headers config option - list of additional headers sent in Access-Control-Expose-Headers
- add: access_control_allow_credentials config option - if true return Access-Control-Allow-Credentials header equal "true"
2022-09-08 03:12:44 +02:00
Tomasz Sowa 04164ff967 add Access-Control-Allow-Credentials for simple requests too 2022-09-07 15:25:48 +02:00
Tomasz Sowa 9f64692ede set Access-Control-Allow-Credentials if available 2022-09-07 14:46:29 +02:00
Tomasz Sowa 8b9ad5d079 make depend 2022-09-01 07:34:39 +02:00
Tomasz Sowa bff435db9a add WINIX_SAVE_FILELOG plugin message 2022-09-01 07:34:10 +02:00
Tomasz Sowa e09a93bd72 update uikit to 3.15.6 2022-09-01 03:39:02 +02:00
Tomasz Sowa e378fcfe3b remove not used variables from Request 2022-08-31 21:33:54 +02:00
Tomasz Sowa a7a338f28e fix(Request): allow to prepare integer headers 2022-08-31 21:25:14 +02:00
Tomasz Sowa a19158cb62 add config options for testing the Origin header in cors requests
- allow_all_cors_origins - whether or not to allow all origins
- allowed_cors_origins - a list of allowed origins (used if allow_all_cors_origins is false)
2022-08-31 20:42:42 +02:00
Tomasz Sowa 778ed01a55 make depend 2022-08-30 01:52:20 +02:00
Tomasz Sowa 217f42b7c6 add support for preflight requ (cors) 2022-08-30 01:52:02 +02:00
Tomasz Sowa a34db6505d move some methods from App to Request
methods moved: SetEnv(), ReadEnvVariables(), ReadEnvRemoteIP(), CheckSSL(), SetSubdomain()

while here:
- add the rest of http methods: put, connect, trace, patch
2022-08-29 19:20:41 +02:00
Tomasz Sowa 7dc117da5e update UIkit to 3.15.5 2022-08-28 16:09:43 +02:00
Tomasz Sowa b1441366f4 add Http::verify_ssl(bool verify) method 2022-08-25 05:16:23 +02:00
Tomasz Sowa c730b85629 make depend 2022-08-22 16:04:10 +02:00
Tomasz Sowa d3a440fa0a add Request::AddPostVar(pt::Space & space, const wchar_t * name) 2022-08-22 16:03:07 +02:00
Tomasz Sowa 5f77ce619e make depend 2022-08-20 00:31:30 +02:00
Tomasz Sowa 5dd34c802e add Request::job_second_id 2022-08-20 00:31:10 +02:00
Tomasz Sowa 3609d94c09 update uikit to 3.15.3 2022-08-15 12:36:54 +02:00
Tomasz Sowa 5dc00e95e7 make depend 2022-08-14 12:55:03 +02:00
Tomasz Sowa e88615226b add Http::allow_redirects(bool allow_redirects) method 2022-08-13 20:00:15 +02:00
Tomasz Sowa ca1a854fd1 fix: use CURLOPT_POSTFIELDSIZE_LARGE to tell libcurl of the post content size 2022-08-13 17:15:48 +02:00
Tomasz Sowa ceb5336ca1 add support for OPTIONS http method 2022-08-11 08:04:40 +02:00
Tomasz Sowa f651df6e1f update htmx to 1.8.0 2022-08-10 12:42:24 +02:00
Tomasz Sowa 6266eac729 use std::wstring_view in SessionIdManager::DecodeToken(...) method 2022-08-10 12:42:16 +02:00
Tomasz Sowa de972de948 fix: remove sourcedialog plugin from ckeditor 2022-08-06 04:21:53 +02:00
Tomasz Sowa 55f48e4f3a update jquery to 3.6.0
while here do a check: [if not winix_has_jquery]...[end]
2022-07-31 02:03:39 +02:00
Tomasz Sowa 39ab07508f update translations 2022-07-30 18:41:59 +02:00
Tomasz Sowa 968660e8ca fix: set correctly request->session
The session cookie was not created because request->session pointed at
a temporary session.

While here:
- do some cleaning in App
- set request->mount too
- add fcgi_cannot_create_request_delay to the config
- fix: in mailregister plugin get model_connector from env (and not from the request)
2022-07-30 18:37:50 +02:00
Tomasz Sowa 4b46ba1fe3 update uikit to 3.15.1 2022-07-30 15:37:52 +02:00
Tomasz Sowa a164e6e21e fix: remove not needed Http::clear() 2022-07-30 04:14:04 +02:00
Tomasz Sowa 82281b4363 add a debug mode - fill a Space structure with some info from CURLOPT_DEBUGFUNCTION
while here:
- allow to set headers from a string
- add a seek function (CURLOPT_SEEKFUNCTION)
2022-07-30 04:00:35 +02:00
Tomasz Sowa 9d8d35b64f save logs after a job has finished 2022-07-30 03:35:00 +02:00
Tomasz Sowa 33f6a9a213 make depend 2022-07-30 03:33:45 +02:00
Tomasz Sowa e5ed1d6ae8 fix: do not use cur if login winix function if config.use_internal_loggin_mechanism is false
In the login winix function cur pointer will be null if config.use_internal_loggin_mechanism
is false, in such a case those objects are not registered as winix functions
but we have a public api
(the public api should be moved somewhere e.g. make a service layer)
2022-07-27 01:25:49 +02:00
Tomasz Sowa 9e6a5b2d37 add use_internal_session_mechanism and use_internal_loggin_mechanism config options 2022-07-26 21:54:33 +02:00
Tomasz Sowa c85a724fec fix(SessionIdManager): take a correct algorithm when decoding a token 2022-07-26 21:09:44 +02:00
Tomasz Sowa 2e8f4d1a26 allow the SessionIdManager to use only two keys 2022-07-26 05:18:42 +02:00
Tomasz Sowa 522b57ade4 fix(Jobs): change request state to prepare_to_finish in case of an error 2022-07-25 18:37:39 +02:00
Tomasz Sowa d4da6aa518 let System::PutUrlProto takes a stream by a reference to pt::Stream 2022-07-25 18:36:28 +02:00
Tomasz Sowa 979ef907fe allow a request to be processed in a job
Now we allow a request to be passed into a job queue,
and after the job finishes the request is passed into
a controller again. In order to achieve this we have
a requests queue in System, when we put a request
to the job this Request structure is preserved in the
queue and for a new request a new Request is added to
the queue.

while here:
- remove App::Lock()/Unlock(), use scoped locking
- fix: Plugin now has a Call method which takes ModelConnector
  and a logger (used in multithreaded environment)
- BaseThread has a main_model_connector pointer
  to the main (from the main thread) model connector
- the FastCGI structure fcgi_request moved from App to Request
- some methods for handling requests moved from App to Request
- small refactoring in main.cpp
- add Http class (a http client)
2022-07-25 14:21:21 +02:00
Tomasz Sowa b2d92b85a0 make depend 2022-07-11 17:52:05 +02:00
Tomasz Sowa 8d6d0ddbf8 update to the new morm::Finder interface 2022-07-11 17:51:50 +02:00
Tomasz Sowa 8da76134ce make depend 2022-07-05 19:52:40 +02:00
Tomasz Sowa 179daf743e make depend 2022-07-03 14:25:53 +02:00
Tomasz Sowa bcb009b606 print version information if running with -v parameter 2022-07-03 14:25:23 +02:00
Tomasz Sowa 327c215e5d add LICENSE file 2022-07-03 12:17:26 +02:00
Tomasz Sowa b484071818 print components versions in uname winix function 2022-07-03 12:17:14 +02:00
Tomasz Sowa 31e826d893 put a log message before opening the FastCGI connection socket
FCGX_OpenSocket will call exit() if there was a problem with creating the socket.
2022-06-27 20:52:09 +02:00
Tomasz Sowa e29f912358 add core/postparser.cpp with implementation from core/postparser.h
now we can remove -lfcgi from winix in winixd/Makefile
2022-06-26 06:45:53 +02:00
Tomasz Sowa 26226de865 global winixd/Makefile uses now 'find' for looking for *.cpp files
and we don't need Makefiles in subdirectories anymore (except plugins)
2022-06-26 06:22:27 +02:00
Tomasz Sowa 56d87c4410 update uikit to 3.14.3 2022-06-19 16:06:16 +02:00
Tomasz Sowa ebfa5f7405 do not try to load sessions if session_file config parameter is empty 2022-05-31 07:49:51 +02:00
Tomasz Sowa ba16cf41fe move the javascript for autodeleting to a separate winix.js file 2022-05-30 05:35:49 +02:00
Tomasz Sowa 01c10bad0e add use_antispam_mechanism_for_not_logged_users config option 2022-05-30 05:35:05 +02:00
Tomasz Sowa 7d1fb3c04e remove Request::post_tab and add Request::http_status
Instead of Reqest::post_tab we use now Request::post_in (pt::Space).

Request::http_status will be used instead Request::status,
but at the moment is not changed in all places.
Request::status has been marked as depracated.

While here:
- Check for root dir in App and not in FunctionParser,
let FunctionParser only log the root dir.
- Read post variables after parsing url parameters,
this allows winix functions to set limits
for post input.
- Set limits when parsing input json format, new
options added to config: post_max_object_items, post_max_table_items,
post_max_all_items, post_max_nested_objects.
There are similar options in each winix function (they are in
FunctionBase).
- Some refactoring in App.
- Add config option: log_whole_http_post if true
then the whole parsed post input is logged.
- Add config option: post_json_max - max length of input stream
for parsing json.
- Add config option: templates_request_status, default request_status.html
this is an ezc template used as [content] when the request status
is not 200_ok.
- Fix: Sort winix function didn't show items to sort (fix and do some
refactoring as well)
- Properly sort items in: ImgCrop, Ls, Sort, Upload
- Remove ezc templates: err_404.html, err_per_denied.html - now
request_status.html is used.
2022-05-30 01:29:18 +02:00
Tomasz Sowa 9e222f5b80 do not print white characters in log for the first migration 2022-05-28 06:10:39 +02:00
Tomasz Sowa 3b5658ff8f fix: correctly sort post variables when they have the same name
In PostParser we add some prefix with a number if the name of a variable is the same,
we should use zero padding for the number to be correctly sorted.
2022-05-28 06:07:38 +02:00
Tomasz Sowa 5e89c4004a make depend 2022-05-26 00:35:24 +02:00
Tomasz Sowa 9602c28d96 allow lang ezc function get more than one parameter 2022-05-11 14:22:46 +02:00
Tomasz Sowa 0fd680b496 update uikit to 3.14.1 2022-05-08 17:00:26 +02:00
Tomasz Sowa 37d3a44b24 update uikit to 3.14.0 2022-04-30 20:23:37 +02:00
Tomasz Sowa da2dec447b allow to specify how many times we can try to connect to the database at startup
add config options:
db_startup_connection_max_attempts - default 0 (infinite)
db_startup_connection_attempt_delay - delay in seconds between attempts (default 5)

BREAKING CHANGE: WINIX_PLUGIN_INIT plugin message requires to set result status,
you have to set the result status to true (env.res) if your
plugin was initialized correctly, otherwise winix will not start
2022-04-29 06:17:16 +02:00
Tomasz Sowa c6c50a5d23 allow to use host database connection parameter
Add config option:
db_host (default empty) - name of host to connect to
2022-04-28 06:12:44 +02:00
Tomasz Sowa 98c1e8daad allow to not change fast cgi socket permissions
New config options:
fcgi_set_socket_chmod (bool) - default true
fcgi_set_socket_owner (bool) - default true
2022-04-27 23:31:50 +02:00
Tomasz Sowa f99191aa6f make depend 2022-04-26 23:46:57 +02:00
Tomasz Sowa df04075f1c add methods to Request for adding and removing parameters
Added methods:
void AddParam(const std::wstring & param_name, const std::wstring & param_value);
void AddParam(const wchar_t * param_name, const wchar_t * param_value);
void RemoveParam(const wchar_t * param_name);
void RemoveParam(const std::wstring & param_name);

This is only temporarily, we will be using the pt::Space structure in the future.
2022-04-26 23:41:56 +02:00
Tomasz Sowa 3d2a635e34 fix: use TextStreamBase::to_str() instead of to_string() 2022-04-25 22:05:34 +02:00
Tomasz Sowa aad5db9a6a let Functions::Add() returns info whether the functions/controller has been added 2022-04-25 16:35:14 +02:00
Tomasz Sowa 43ebbdaa33 add WINIX_PLUGIN_QUIT and WINIX_QUIT plugins messages
While here:
- rename WINIX_CLOSE to WINIX_PREPARE_TO_CLOSE
2022-04-25 16:34:26 +02:00
Tomasz Sowa 92c7f90b95 fix: correctly propagate a migration status when the migration failed 2022-04-25 15:19:02 +02:00
Tomasz Sowa aae93d018b allow to use db_hostaddr, db_port or db_conn_string config parameters to connect to PostgreSQL 2022-04-20 18:37:52 +02:00
Tomasz Sowa 7a115a3970 fix(Log): treat pt::Log::Manipulators as enum and not as int 2022-04-16 21:52:53 +02:00
Tomasz Sowa 64e5114947 allow to read environment variables as config parameters
Environment variables must be prefixed with winix_ to be loaded by winix.
The winix_ prefix is then removed and the key value converted to lowercase.

Sample:
evn WINIX_MY_OPTION=TEST123test winix -c config_file

This will add my_option to the config with value TEST123test.
Environment variables are read last so they will overwrite the values
from the configuration files.
2022-04-16 21:50:23 +02:00
Tomasz Sowa 4f8b5e649a recognize startup parameters
Usage: winix [options]
  -c             : a path to the config file
  --config       : a path to the config file
  -h             : print usage information
  --help         : print usage information
  -?             : print usage information

While here:
- let it be possible to parse multiple configs,
- fix: some error messages were not printed at startup.
2022-04-16 18:38:30 +02:00
Tomasz Sowa e0d9989d74 fix(Item): id should be of type serial 2022-04-11 23:27:49 +02:00
Tomasz Sowa 0fe680ef4a fix: migration to version 2 in User model 2022-04-11 23:19:30 +02:00
Tomasz Sowa e182c0a21b fix: create core schema before making a first select request
Migration uses Finder to get the current table version.
2022-04-11 23:11:00 +02:00
Tomasz Sowa c8edd241d5 create core schema as a first migration 2022-04-11 20:57:49 +02:00
Tomasz Sowa a544ccd1a7 fix: User model initial column name: aenv 2022-04-11 20:44:58 +02:00
Tomasz Sowa 7df2205b40 update flatpickr to 4.6.11 2022-04-05 17:37:24 +02:00
Tomasz Sowa 265e843d02 update uikit to 3.13.7 2022-04-05 16:59:57 +02:00
Tomasz Sowa 22a8a97389 update htmx to 1.7.0 2022-04-05 16:53:46 +02:00
Tomasz Sowa bb74f2a423 update uikit to 3.11.1 2022-02-08 14:13:33 +01:00
Tomasz Sowa 2033168db2 Merge branch 'cli' into ajax 2022-02-08 14:01:50 +01:00
Tomasz Sowa e377f144fd fix: do not send headers again after binary content 2022-02-04 18:46:46 +01:00
Tomasz Sowa 234ebf8ce8 change HtmlTextStream iterators type to pt::WTextStream::iterator 2022-02-03 20:57:38 +01:00
Tomasz Sowa 09cf3c9fa9 add some comments in AcceptBaseParser 2022-02-02 18:34:56 +01:00
Tomasz Sowa df32899581 move AcceptEncodingParser to utils 2022-02-02 18:34:22 +01:00
Tomasz Sowa 33e8df11c5 parse Accept-Language header to Request::accept_languages table 2022-02-02 18:20:32 +01:00
Tomasz Sowa 75daf37bbd improve AcceptBaseParser parsing algorithm
remove AcceptParser - not needed now, AcceptBaseParser can prepare a table now
2022-02-02 17:58:27 +01:00
Tomasz Sowa d0d2cfb22c move AcceptBaseParser to utils directory 2022-02-02 17:11:46 +01:00
Tomasz Sowa f7b5ac0dc8 change the way how winix answer is created
Now we can return ezc content and models serialized in the same json structure,
Xml and Csv are not implemented yet.
Ezc frames are returned in 'ezc_frames' field.
Main ezc stream is returned in 'main_stream' field.
Frame url parameter can take more than one frame (names separated by commas).
Honor Accept http header (AcceptParser).

Samples:
--------
http://domain.tld/dir/controller
returns html answer from the main ezc stream

http://domain.tld/dir/controller/container:raw
returns html answer from the main ezc stream (the same as above)

http://domain.tld/dir/controller/frame:abc
returns "abc" frame as html

http://domain.tld/dir/controller/container:json
returns all serialized models to json and no ezc streams

http://domain.tld/dir/controller/container:xml
returns all serialized models to xml and no ezc streams (not implemented yet)

http://domain.tld/dir/controller/container:json/frame:abc,xyz
returns all serialized models to json and two frames in 'ezc_frames' object

http://domain.tld/dir/controller/container:json/all_frames
returns all serialized models to json and all frames in 'ezc_frames' object

http://domain.tld/dir/controller/container:json/main_stream
returns all serialized models and the main ezc stream in 'main_stream' field

http://domain.tld/dir/controller/container:json/main_stream/all_frames
returns all serialized models to json, all frames and the main stream
2022-02-01 18:44:23 +01:00
Tomasz Sowa 227dd923d6 fix: correctly escape ezc stream to json/xml/csv 2022-01-28 15:54:11 +01:00
Tomasz Sowa f6cb9a8aed set correct timetable dst for 'Sarajevo, Skopje, Warsaw, Zagreb'
year: 2022 and 2023
2022-01-26 22:34:13 +01:00
Tomasz Sowa b615dc7e6e add cmp ezc function 2022-01-22 04:35:42 +01:00
Tomasz Sowa 944560dd2b update uikit to 3.10.1 2022-01-19 15:47:11 +01:00
Tomasz Sowa 1d6d29e24d add winixcli/src/winix to .gitignore 2022-01-18 19:46:12 +01:00
Tomasz Sowa ff8e9e6b32 start working on winixcli
winixcli can now read a PGModeler file
and is able to generate a template through ezc

winixcli parameters:
--input-mode pgmodeler (only one parameter at the moment)
--input-file file (pgmodeler file)
--templates-dir dir_path (a path to templates directory)
--template file (template file)
2022-01-18 19:40:57 +01:00
Tomasz Sowa 557555c4b3 htmx updated to 1.6.1 2021-12-08 15:19:35 +01:00
Tomasz Sowa f8e1037476 uikit updated to 3.9.4 2021-11-26 21:51:01 +01:00
Tomasz Sowa 35cb54324f added a new item content type: markdown
- emacs editor has an option to select markdown, now it has two planes: one for content editing and the other to show preview
- CodeMirror editor updated to 5.64.0
- to convert markdown to html we use showdown https://github.com/showdownjs/showdown (conversion is done on the client side)
2021-11-26 21:49:21 +01:00
Tomasz Sowa 119497bb01 added winix_frame_is ezc winix function 2021-10-24 22:27:52 +02:00
Tomasz Sowa dfd6475a81 uikit updated to 3.7.6 2021-10-24 22:27:35 +02:00
Tomasz Sowa d6d5236a03 added fil_json_escape filter 2021-10-21 13:42:41 +02:00
Tomasz Sowa a327a26bd5 added winix_uikit_version parameter to index_head_adder.html 2021-10-13 23:48:30 +02:00
Tomasz Sowa d5ebb7ca12 changed the way how the request's answer is created,
now winix can return json, xml, csv from out_main_stream or from frames and json from models

removed from Request:
  bool send_bin_stream
  bool return_json
  bool return_info_only
  pt::Space info
  bool page_generated
  bool out_main_stream_use_html_filter
  bool out_streams_use_html_filter

added to Request:
  enum AnswerSource
  enum AnswerContainer
  AnswerSource answer_source
  AnswerContainer answer_container
  bool use_ezc_engine
  std::wstring frame
  bool send_all_frames
  bool use_html_filter

added to Config:
 // the name of the url parameter for returning all frames, e.g. https://domain.tld/mydir/myfunction/allframes
 // default: allframes
 std::wstring request_all_frames_parameter;

 // the name of the root element when serializing request answer to xml
 // default: winix
 std::wstring xml_root;

algorithm (the whole algorithm is described in core/request.h):
at the beginning of a request winix sets
   answer_source to models
   answer_container to text
   use_ezc_engine to true

next answer_container and use_ezc_engine can be changed in the following way:

1. winix will look for 'Accept' http header and depending on the header winix will set:
   (not implemented yet)

             Accept | answer_container | use_ezc_engine
	     ------------------------------------|-----------------
	     application/json | json             | false
	      application/xml | xml              | false
	              text/csv | csv              | false

2. next answer_container is set depending on 'container' url parameter
       container | answer_container
 ---------------------------------------------------------
     not present | don't change the value
            text | text
            json | json
             xml | xml
             csv | csv

use_ezc_engine is set depending on 'answer' url parameter:
          answer | use_ezc_engine
 ---------------------------------
     not present | don't change the value
            html | true
            data | false

if 'answer' is html then we take into account two more parameters:
 frame: frame_name (empty default) - if set then winix returns this specific frame
 allframes: (if present then winix returns all frames)
2021-10-13 01:27:14 +02:00
Tomasz Sowa 3e46c5674c htmx updated to 1.6.0 2021-10-08 17:44:34 +02:00
Tomasz Sowa c4b5565995 don't check for request->is_htmx_request for sending frames, check only "frame" url paremeter
added config parameter: request_frame_parameter, default: "frame"
2021-10-08 03:08:11 +02:00
Tomasz Sowa 3f5eabeaa1 uikit updated to 3.7.5 2021-10-07 05:02:24 +02:00
Tomasz Sowa 9b8e48e7b2 added static libraries: clocklet (timepicker), flatpickr and litepicker (data pickers) 2021-10-07 04:42:46 +02:00
Tomasz Sowa c3122fb82f added [lang] ezc function for returning a localized string 2021-10-07 04:41:06 +02:00
Tomasz Sowa 1741597d52 uikit updated to 3.7.4 2021-09-27 02:53:16 +02:00
Tomasz Sowa 9c5c74ba84 added: setting a correct mime type for static files - using magic library
added: std::wstring file_mime_type to ItemContent - a mime type for static file
added: Header (core/header.h) - there will be header names defined, at the moment only content_type
added: FuncionsBase::Finish() - it is called at the end when the winix finishes
2021-09-22 00:23:25 +02:00
Tomasz Sowa 26ed7b80be changed values for send_file_mode config parameter:
0 - winix will read the content of the file and send it back to the webserver
  1 - winix will use send_file_header header with a full path to the file
  2 - winix will use send_file_header header with a relative path to the file
2021-09-17 03:35:56 +02:00
Tomasz Sowa 55ac9a61ed added possibility to send static files to nginx via X-Accel-Redirect header
added to config:
int send_file_mode;
    // 0 - full path to a file in send_file_header header
    // 1 - relative path to a file in send_file_header (need http_send_file_relative_prefix set) (used for nginx)
std::wstring send_file_header;
    // default: X-SENDFILE
    // for Apache set: X-SENDFILE
    // for Lighttpd set: X-LIGHTTPD-send-file
    // for Nginx set: X-Accel-Redirect
std::wstring send_file_relative_prefix;
    // relative prefix used for sending static files if send_file_mode is 1
    // default: "upload-files-internal"
2021-09-15 20:28:34 +02:00
Tomasz Sowa 7673264fe1 make depend 2021-08-12 21:57:03 +02:00
Tomasz Sowa 42dc43b036 added WINIX_MAKE_DATABASE_MIGRATION plugin message for making migrations from plugins 2021-08-11 22:18:14 +02:00
Tomasz Sowa ef22d951a0 fixed: base class of System should be derived as public 2021-08-10 22:06:53 +02:00
Tomasz Sowa e95dc834a3 uikit updated to 3.7.2 2021-08-07 21:23:47 +02:00
Tomasz Sowa b424988d1b updated to the new pikotools api (api2021): HTMLFilter renamed to HTMLParser
added to config: int html_filter_white_char_mode;
  how white characters between html tags are treated
  0 - WHITE_MODE_ORIGIN - they are copied from input to output
  1 - WHITE_MODE_SINGLE_LINE - new line characters are removed
  2 - WHITE_MODE_TREE - try to create a tree (some kind of pretty printing)
  default: 2
2021-08-07 02:16:48 +02:00
Tomasz Sowa 22134b6cc0 commented some method calls to html_filter 2021-07-26 03:54:02 +02:00
Tomasz Sowa f861c0761e make depend 2021-07-17 13:57:39 +02:00
Tomasz Sowa 1899d5ee17 BBCODEParser has been moved to pikotools library 2021-07-17 13:56:37 +02:00
Tomasz Sowa 17bd48ece3 HTMLFilter has been moved to pikotools library 2021-07-17 13:42:04 +02:00
Tomasz Sowa c5c02d7f44 HtmlTextStream has now pt::Stream as a based class and uses pt::WTextStream as a buffer 2021-07-16 18:17:57 +02:00
Tomasz Sowa ba6159964b htmx updated to 1.5.0 2021-07-16 13:16:02 +02:00
Tomasz Sowa b834971f5e uikit updated to 3.7.1 2021-07-16 12:28:38 +02:00
Tomasz Sowa 9dc15d536c Makefile: removed macros: EZC_GENERATOR_HAS_PT_STREAM and EZC_GENERATOR_HAS_WINIX_STREAM 2021-07-13 01:49:58 +02:00
Tomasz Sowa 2e45cb6ac9 updated to the new ezc api (Generator has three additional parameters now) 2021-07-13 01:46:07 +02:00
Tomasz Sowa 2dcfeaa688 fixed: in Item do_migration_to_3(...) admin meta was called admin_meta (not meta_admin) 2021-07-07 01:04:48 +02:00
Tomasz Sowa 9d65d931d0 moved some ezc functions from templates/item.cpp to Item and ItemContent
removed: templates/item.cpp
updated: some html templates which use [item] or [item_tab]
removed some old html templates: item_info.html and itam_tab_info.html
2021-07-06 21:52:29 +02:00
Tomasz Sowa 746aa41111 renamed: ItemContent::meta_admin -> ItemContent::admin_meta 2021-07-03 01:18:28 +02:00
Tomasz Sowa 175dd17416 added request.last_item ezc function 2021-07-03 01:14:53 +02:00
Tomasz Sowa 619936c12e make depend 2021-07-01 23:35:08 +02:00
Tomasz Sowa 732144df01 updated to the new morm api - models methods which take 'morm::ModelWrapper ** model_wrapper' now take 'morm::Wrapper & wrapper' 2021-07-01 23:34:49 +02:00
Tomasz Sowa df3f04a951 added to misc: timespec_to_stream_with_unit() for printing times either is seconds or miliseconds 2021-06-30 16:30:11 +02:00
Tomasz Sowa 0f78968579 updated ticket plugin to the new ezc api (child spaces were removed) 2021-06-29 23:42:57 +02:00
Tomasz Sowa 66173c7a31 removed old meta ezc functions from gallery plugin 2021-06-28 21:34:41 +02:00
Tomasz Sowa 3f934d9aec removed old meta ezc functions from menu plugin 2021-06-28 21:34:22 +02:00
Tomasz Sowa df0cc131fe fixed in thread winix function: answers were not sorted correctly 2021-06-28 21:33:33 +02:00
Tomasz Sowa ba60f9da8a updated group plugin to the new pikotools api (child spaces were removed) 2021-06-28 20:58:39 +02:00
Tomasz Sowa 4569198b9d fixed in index_head_adder.html: winix_function_is "emacs" should be in parentheses 2021-06-27 23:43:01 +02:00
Tomasz Sowa ccbbb59af7 make depend 2021-06-27 23:34:06 +02:00
Tomasz Sowa 3a5af25eaf updated some html templates 2021-06-27 23:33:10 +02:00
Tomasz Sowa 1d18b7fa12 - updated to the new pikotools api (child spaces were removed)
some plugins need to be fixed yet: ticket, gallery, group, menu
- added current user to default models as "user"
- renamed in User: super_user -> is_super_user, env -> admin_env, pass_hash_salted -> is_pass_hash_salted
- now Users class has a WinixModel as a base class
  some plugin calls have to be fixed yet
- added UserWrapper model with a pointer to User class
- removed from ItemContent: methods for accessing 'meta' and 'admin_meta', now ezc can iterate through Space classes
- fixed in env winix function: if there is "changeuser" parameter then we should only switch the user (not save anything)
2021-06-27 23:31:50 +02:00
Tomasz Sowa 472490c239 make depend 2021-06-24 21:17:11 +02:00
Tomasz Sowa b6340a30d2 updated to the new pikotools api (changes in Log) 2021-06-24 21:17:03 +02:00
Tomasz Sowa bf1f0954b9 fixed: changed "%g" to "%f" when printing request/ezc times
SetNonZeroDigitsAfterComma() incorrectly terminated the string if the format was "%g" (in the case where it was used as %e)
2021-06-24 16:11:02 +02:00
Tomasz Sowa 2f1cdcf379 added printing info how much time winix spent in the ezc engine
added to Request:
timespec timespec_req_stop;
timespec timespec_req_diff;
timespec timespec_ezc_engine_start;
timespec timespec_ezc_engine_stop;
2021-06-24 15:33:44 +02:00
Tomasz Sowa 443c2023d9 make depend 2021-06-23 17:04:21 +02:00
Tomasz Sowa 2c5062ba22 UrlEncode() methods from core/misc.h are now thread safe 2021-06-23 17:04:07 +02:00
Tomasz Sowa 99df807095 Makefile: added new macros to CFLAGS 2021-06-21 20:22:15 +02:00
Tomasz Sowa 8ab07d11b1 fixed: cur.request->function->fun didn't have a model connector set when a request started 2021-06-21 16:51:35 +02:00
Tomasz Sowa a1c0f6f7f0 added config option: add_header_cache_no_store_in_htmx_request
send "Cache-Control: no-store, max-age=0" http header if a request is made by htmx library (ajax)
if a webbrowser get a page from the cache then it will render just the last request without the whole html page (css, js, etc)
https://github.com/bigskysoftware/htmx/issues/497
2021-06-21 11:43:59 +02:00
Tomasz Sowa 672737a0d8 added a comment in ItemContent 2021-06-20 22:27:06 +02:00
Tomasz Sowa ade96bf6d3 some methods from templates/item.cpp moved to ItemContent 2021-06-20 21:22:08 +02:00
Tomasz Sowa 801fc062ef added FunctionBase::Clear() which is called at the end of a request 2021-06-20 20:47:59 +02:00
Tomasz Sowa f35840e7de some work in html templates: changed some functions from item_* to item.* 2021-06-20 18:12:43 +02:00
Tomasz Sowa 79eda7abb0 - added to FunctionBase: bool register_default_models (default true)
if true then winix will add default models for ezc templates such as "request", "item", etc.
- some methods from templates/item.cpp moved to Item
2021-06-20 18:04:50 +02:00
Tomasz Sowa e7c7324058 ItemContent::user_name(EzcEnv & env) changed to ItemContent::user(morm::ModelWrapper ** model_wrapper) and we return a User class
ItemContent::group_name(EzcEnv & env) changed to ItemContent::group(morm::ModelWrapper ** model_wrapper) and we return a Group class
added ItemContent::display_user_name(EzcEnv & env)
some functions in templates/item.cpp moved to Item
2021-06-19 23:48:12 +02:00
Tomasz Sowa d8c1a81bcb removed config options: ezc_error_prefix and ezc_error_postfix
Ezc::PatternParser and Ezc::Generator use only pt::Log as a logger now
2021-06-19 20:33:35 +02:00
Tomasz Sowa 94f96c11cb make depend 2021-06-18 19:18:46 +02:00
Tomasz Sowa ec94dff7d7 some ezc functions from templates/item.cpp moved to Item and ItemContent
methods HasAccess() HasReadAccess() and similar moved from System to Item and ItemContent
2021-06-18 19:18:13 +02:00
Tomasz Sowa ebd791a256 changed: now Request class is a model class - we have fields() method there to map fields for ezc templates (currently only dir_tab)
removed: [dir_tab] ezc statement
changed: Ls winix function loads its own dir_tab container (beforehand it was loaded by [dir_tab] ezc statement)
         it's available by [child_dirs] name
2021-06-17 21:44:29 +02:00
Tomasz Sowa 4db421d6c3 make depend 2021-06-16 23:43:57 +02:00
Tomasz Sowa ab89ffe096 fixed in Item: void Item::link(Ezc::FunInfo<HtmlTextStream> & env) now returns a correct directory for the item (before the current directory was returned)
added to Item: void Item::dir_link(Ezc::FunInfo<HtmlTextStream> & env)
added to WinixModel:
  Dirs * get_dirs();
  Mounts * get_mounts();
  Users * get_users();
  Groups * get_groups();
  SLog * get_session_logger(); // not finished yet
2021-06-16 23:42:23 +02:00
Tomasz Sowa 53fe5c35b9 added .editorconfig file 2021-06-16 18:09:18 +02:00
Tomasz Sowa f2f2c851df make depend 2021-06-16 18:09:01 +02:00
Tomasz Sowa 6dddc5e948 renamed: WinixModel -> WinixModelDeprecated (this class will be removed)
added: WinixModel (models/winixmodel.h|cpp) - a class inheriting from morm::WinixModel, we have methods such as: get_config(), get_logger(), get_request()
       and this class will be a base class for our models
added: WinixModelConnector (models/winixmodelconnector.h|cpp) - a class inheriting from morm::WinixModelConnector
       this connector we are using instead of morm::ModelConnector - there are pointers to winix objects there (config, request, log)
added to Request: Ezc::Models models
removed from TemplatesFunctions: Ezc::Models ezc_models;
changed: ImgCrop winix functions is using its own item_tab vector now (not finished yet)
added: Item::is(), Item::link(), ItemContent::print_content()
2021-06-16 18:07:44 +02:00
Tomasz Sowa 9688b1a26a htmx updated to 1.4.1 2021-06-09 01:56:47 +02:00
Tomasz Sowa 81df52f6ca make depend 2021-05-31 18:59:49 +02:00
Tomasz Sowa 6e4f8f5191 start adding support for Models objects from Ezc 2021-05-31 18:59:20 +02:00
Tomasz Sowa 22de3322ae - added to Request: is_htmx_request (bool) - true if the request is made by htmx library (ajax)
- commented out using mount_page_arg_is "subject" and "info" from fun_cat.html and fun_run.html - they will be removed soon
- some improvements in fun_reply.html, fun_showthreads.html and fun_thread.html (scrolling)
2021-05-31 10:58:34 +02:00
Tomasz Sowa e6fae4598c updated to the new pikotools api: [ezc out] and [out] changed to [ezc frame] or just [frame]
- when returning json streams changed "out" field to "frames"
- renamed config parameter: allow_ezc_out_in_executable_items -> allow_ezc_frames_in_executable_items
- added basic support for ajax requests in thread plugin
2021-05-28 18:36:19 +02:00
Tomasz Sowa ba331dea4a added basic support for htmx (ajax)
- if there is HX-Request header present we sent only a part of the whole html
- we return only specific stream defined by [out ...] ezc statement
- the name of the stream is passed in the 'frame' parameter
  (if not present then 'content' is assumed)
- added ezc function: winix_is_htmx_request
2021-05-27 19:36:04 +02:00
Tomasz Sowa 1292a56d1b added htmx 1.4.0 loaded by default in html/index_head_adder.html 2021-05-27 13:41:29 +02:00
Tomasz Sowa 6a452ffed0 version changed to 0.7.3 2021-05-27 12:21:59 +02:00
Tomek fc24570062 fixed compilation: pikotools is in src subdirectory now 2021-05-27 12:04:41 +02:00
Tomasz Sowa aa71abd725 some workarounds in Thread plugin (don't show stale info in html forms) 2021-05-27 10:29:26 +02:00
Tomasz Sowa fb64f5e456 fixed: reply winix function (from thread plugin) didn't add a reply - system->Add() didn't set the model_connector to the item 2021-05-26 19:55:50 +02:00
Tomasz Sowa 61fe6ea219 updated to the new api from ezc: changed semantic of [def] and Vars moved outside of Generator 2021-05-23 10:14:08 +02:00
Tomasz Sowa d30c7254eb updated uikit to 3.6.22 2021-05-22 13:03:15 +02:00
Tomasz Sowa 06be33ba5f make depend 2021-05-21 23:06:57 +02:00
Tomasz Sowa b2cffa39e1 added models Thread and ThreadFiles in thread plugin 2021-05-21 23:06:48 +02:00
Tomasz Sowa 86ef2529b1 fixed in some places: system->AddFile() returns bool now instead of Error 2021-05-21 17:41:16 +02:00
Tomasz Sowa f1b9d1b870 updated to the new pikotools api: changed the way how child_spaces are created in Space class 2021-05-21 17:17:17 +02:00
Tomasz Sowa fe67b5d72a updated to the new pikotools api: snake_case names of methods from SpaceParser 2021-05-21 04:51:58 +02:00
Tomasz Sowa 27720afaf2 updated to the new pikotools api: SpaceParser::SetSpace(...) methods have been removed 2021-05-21 01:37:42 +02:00
Tomasz Sowa 8bb585d97d updated to the new pikotools api: changed utf8 functions PascalCase to snake_case 2021-05-21 00:41:27 +02:00
Tomasz Sowa 8c523ce8b9 make depend 2021-05-21 00:32:58 +02:00
Tomasz Sowa e48a28a5c8 namespace PT renamed to pt 2021-05-20 20:59:12 +02:00
Tomasz Sowa d66a36cf21 make depend 2021-05-14 03:32:03 +02:00
Tomasz Sowa a94e09f0aa added support for Model migrations
now we have a table core.migration and each model (User, Group, Item, ItemContent and a new Migration) have its own
row in the table with a version number

added to config:
db_make_migration_if_needed and db_stop_if_migration_fails (need description yet)
2021-05-14 03:31:29 +02:00
Tomasz Sowa 4df10de6b7 methods eq() from finder can have now a table name 2021-05-13 19:33:19 +02:00
Tomasz Sowa 6d07535dad updated uikit to 3.6.21 version 2021-05-13 06:24:44 +02:00
Tomasz Sowa ee354d2ded renamed in Models: map_fields() to fields(), prepare_table() to table() 2021-05-13 03:29:41 +02:00
Tomasz Sowa e64bd1fba8 added more html tags to extraAllowedContent (ckeditor) 2021-05-13 03:24:37 +02:00
Tomasz Sowa 031e673c51 fixed: passwd winix function: pass_encrypted was not cleared if we are not using rsa for encrypting passwords anymore 2021-05-13 02:02:15 +02:00
Tomasz Sowa 801c9a2cda make depend 2021-05-11 22:22:10 +02:00
Tomasz Sowa 685b3ca5ee Makefile: source files from pikotools are now in pikotools/src 2021-05-11 22:22:03 +02:00
Tomasz Sowa f1af7e2eeb updated to the current pikotools api from branch api2021 2021-05-11 22:20:46 +02:00
Tomasz Sowa 85f9fda984 fixed: in passwd winix function: clear password hash when using rsa encoding 2021-05-11 22:15:52 +02:00
Tomasz Sowa bb513b0187 make depend 2021-04-30 01:35:40 +02:00
Tomasz Sowa 4277f90bad start working on User and Group classes
- User and Group has been moved to 'models' directory
- removed UserPass struct (passwords fields were put to User struct)
not working yet, we need support for binary blobs in morm
2021-04-30 01:34:48 +02:00
Tomasz Sowa ccda2bc2fd added option do_migration_to_winix_fullmorm do the config (only temporarily)
if true then we make Item::do_migration() and exit
2021-04-14 14:13:47 +02:00
Tomasz Sowa 4b71530f4c added to Config:
bool Config::HasValue(const wchar_t * name, const wchar_t * value)
2021-04-12 18:55:04 +02:00
Tomasz Sowa a8a9db53be remove some Lock() and Unlock() from Plugin 2021-04-11 12:09:42 +02:00
Tomasz Sowa 634cf07d44 using Winix::Lock object instead of Lock() method in ThreadManager 2021-04-10 21:12:28 +02:00
Tomasz Sowa 0e0c006d5a fixed: thread locking problem in Image: method Lock() was used instead of Winix::Lock object 2021-04-10 19:46:50 +02:00
Tomasz Sowa 486067a4b2 clang thread sanitizer reported a data race in App::Start()
synchro.was_stop_signal was read without locking

==================
WARNING: ThreadSanitizer: data race (pid=13831)
  Write of size 1 at 0x000000dc4d18 by thread T1 (mutexes: write M44):
    #0 Winix::App::SpecialThreadForSignals(void*) /disk2Tc/home/tomek/roboczy/prog/winix/winixd/core/app.cpp:2226:31 (winix.so+0x1f7465)

  Previous read of size 1 at 0x000000dc4d18 by main thread:
    #0 Winix::App::Start() /disk2Tc/home/tomek/roboczy/prog/winix/winixd/core/app.cpp:651:18 (winix.so+0x1ee9af)
    #1 main /disk2Tc/home/tomek/roboczy/prog/winix/winixd/main/main.cpp:222:6 (winix+0x2d74c1)

  Location is global 'Winix::app' of size 65840 at 0x000000db5908 (winix+0x000000dc4d18)

  Mutex M44 (0x000000dc4d10) created at:
    #0 pthread_mutex_lock /disk2Tb/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:4153:3 (winix+0x2ac204)
    #1 Winix::Synchro::Lock() /disk2Tc/home/tomek/roboczy/prog/winix/winixd/core/synchro.cpp:68:12 (winix.so+0x2e5822)
    #2 Winix::Lock::Lock(Winix::Synchro*) /disk2Tc/home/tomek/roboczy/prog/winix/winixd/core/lock.cpp:53:11 (winix.so+0x295522)
    #3 Winix::FileLog::get_local_date(PT::Date const&) /disk2Tc/home/tomek/roboczy/prog/winix/winixd/core/filelog.cpp:98:8 (winix.so+0x261183)
    #4 Winix::Log::PrintDate(PT::Date const&) /disk2Tc/home/tomek/roboczy/prog/winix/winixd/core/log.cpp:80:30 (winix.so+0x295a21)
    #5 Winix::LogInfo(Winix::Log&, Winix::LogManipulators, char const*, bool, char const*) /disk2Tc/home/tomek/roboczy/prog/winix/winixd/main/main.cpp:104:6 (winix+0x2d69ec)
    #6 main /disk2Tc/home/tomek/roboczy/prog/winix/winixd/main/main.cpp:190:2 (winix+0x2d7363)

  Thread T1 (tid=100187, running) created by main thread at:
    #0 pthread_create /disk2Tb/usr/src/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:962:3 (winix+0x295bb3)
    #1 Winix::App::StartThreads() /disk2Tc/home/tomek/roboczy/prog/winix/winixd/core/app.cpp:2246:2 (winix.so+0x1f7549)
    #2 main /disk2Tc/home/tomek/roboczy/prog/winix/winixd/main/main.cpp:212:6 (winix+0x2d743e)

SUMMARY: ThreadSanitizer: data race /disk2Tc/home/tomek/roboczy/prog/winix/winixd/core/app.cpp:2226:31 in Winix::App::SpecialThreadForSignals(void*)
==================
2021-04-10 17:14:51 +02:00
Tomasz Sowa 35e10ed469 updated to the new Pikotools api (new Space struct) 2021-04-09 17:50:58 +02:00
Tomasz Sowa 00b980e74b make depend 2021-04-09 16:02:54 +02:00
Tomasz Sowa efdc0e7c97 etc/time_zones.conf changed values: "true" -> true, "false" -> false 2021-04-09 10:25:10 +02:00
Tomasz Sowa 8b64d2066f changed: new space characters in etc/time_zones.conf:
( -> {
 ) -> }
2021-03-31 20:26:30 +02:00
Tomasz Sowa 8d87d9a875 changed in Makefile: we have now one lib pikotools/pikotools.a
make depend
2021-03-31 20:25:09 +02:00
Tomasz Sowa 8fc1848ecc uikit updated to 3.6.18 2021-03-31 20:21:24 +02:00
Tomasz Sowa bbc0a67153 added support for new morm api
- field(...) methods from Model take now FT structure instead of insertable/updatable/primary_key boolean flags
- table name is set in a prepare_table() method now
- added meta and admin_meta from ItemContent (morm has a field() method with PT::Space argument now)
2021-03-11 18:48:18 +01:00
Tomasz Sowa e8ba2a7bd1 fixed: incorrect status was set when editing a file
now System::EditFile() returns boolean
2021-03-11 18:42:26 +01:00
Tomasz Sowa 23f1c112a4 make depend 2021-03-10 16:40:22 +01:00
Tomasz Sowa 4d76e53554 in after_insert() methods: changed get_last_sequence -> get_last_sequence_for_primary_key 2021-03-09 18:16:29 +01:00
Tomasz Sowa 73352e680e Make depend 2021-03-08 21:10:33 +01:00
Tomasz Sowa 57aad8b454 removed from Item: update() and save() methods which take the 'url_was_changed' argument
and added ItemModelData (based on morm::ModelData) class which has 'prepare_unique_url' field,
an object of this class is passed to update(), insert() and save() methods

fixed: Dirs::CheckRootDir(): update should update childs too (privileges)

WIP: #4
2021-03-08 21:06:50 +01:00
Tomasz Sowa ab5c44a2cb removed some old methods for adding/editing Item from Db 2021-02-25 00:17:07 +01:00
Tomasz Sowa 3e84eb9dbf Makefile deps 2021-02-25 00:15:03 +01:00
Tomasz Sowa afbe82e9f4 changed the way how prefixes are added to urls
instead at the end we adding a prefix before an extension, e.g: filename_(2).jpg
2021-02-25 00:12:45 +01:00
Tomasz Sowa 51b1aed483 removed DbItemQuery and DbItemColumns which were used for database accessing for Item class 2021-02-24 22:54:36 +01:00
Tomasz Sowa 32e93a04c5 Item class has been moved to a new directory 'models', a new class has been added: ItemContent
and same fields from Item were moved to ItemContent

Item
- id
- parent_id
- type (file, dir, symlink)
- url
- subject
- template (html template)
- sort_index
- content_id

ItemContent
- id
- ref -> references (renamed)
- user_id
- modification_user_id
- group_id
- privileges
- date_creation
- date_modification
- guest_name
- link_to
- link_redirect
- file_path
- file_fs
- file_type
- file_size
- has_thumb -> file_has_thumb (renamed)
- hash -> file_hash (renamed)
- hash_type -> file_hash_type (renamed)
- content -> content_raw (renamed)
- content_type -> content_raw_type (renamed)
- content_parsed
- content_parsed_type
- meta
- ameta -> meta_admin (renamed)
- modify_index (removed)

WIP: #4
2021-02-24 01:19:47 +01:00
Tomasz Sowa 3d7ece15f8 changed version to 0.7.2 2021-02-18 21:07:05 +01:00
Tomasz Sowa 541597f355 fixed: in TimeZone::SetTzDst() was used operator && instead of || 2021-02-17 18:36:50 +01:00
Tomasz Sowa 5fe843d76b set -std=c++20 in Makefile 2021-02-17 18:07:05 +01:00
Tomasz Sowa 3191369ece added 'using PT::FileLog::init' to FileLog to suppress clang warning:
warning: 'Winix::FileLog::init' hides overloaded virtual function [-Woverloaded-virtual]
2021-02-17 18:06:00 +01:00
Tomasz Sowa a4de11d69c fixed: Image did not use 'savelog' when creating logs
before commit 4832c7db4b the logs were lost, but after 4832c7db4b
the logs were printed when winix shuts down

in 4832c7db4b at the end of BaseThread::StartRoutine()
has been added a call to save_log()
2021-02-17 16:17:36 +01:00
Tomasz Sowa 4832c7db4b fixed: clang address sanitizer reports that there is an use after free bug at the end when winix shuts down:
==3859==ERROR: AddressSanitizer: heap-use-after-free on address 0x61b0000053e0 at pc 0x000800697160 bp 0x7fffffffcfb0 sp 0x7fffffffcfa8
READ of size 8 at 0x61b0000053e0 thread T0
    #0 0x80069715f in PT::MemBuffer<wchar_t, 256ul, 4096ul>::empty() const /usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/membuffer/membuffer.h:675:9
    #1 0x80069700d in PT::TextStreamBase<wchar_t, 256ul, 4096ul>::empty() const /usr/home/tomek/roboczy/prog/web.ttmath.org/../pikotools/textstream/textstream.h:161:16
    #2 0x8009af0e3 in PT::FileLog::save_log(PT::TextStreamBase<wchar_t, 256ul, 4096ul>*) /usr/home/tomek/roboczy/prog/pikotools/log/filelog.cpp:105:14
    #3 0x8009b3f8a in PT::Log::save_log() /usr/home/tomek/roboczy/prog/pikotools/log/log.cpp:461:13
    #4 0x8009b3d72 in PT::Log::save_log_and_clear() /usr/home/tomek/roboczy/prog/pikotools/log/log.cpp:448:2
    #5 0x8009b0627 in PT::Log::~Log() /usr/home/tomek/roboczy/prog/pikotools/log/log.cpp:62:2
    #6 0x8007288e7 in Winix::Log::~Log() /usr/home/tomek/roboczy/prog/winix/winixd/core/log.cpp:56:1
    #7 0x8007eac96 in Winix::WinixBase::~WinixBase() /usr/home/tomek/roboczy/prog/winix/winixd/core/winixbase.cpp:51:1
    #8 0x8007eb097 in Winix::WinixModel::~WinixModel() /usr/home/tomek/roboczy/prog/winix/winixd/core/winixmodel.cpp:52:1
    #9 0x80069e552 in Winix::BaseThread::~BaseThread() /usr/home/tomek/roboczy/prog/winix/winixd/core/basethread.cpp:54:1
    #10 0x2f8132 in Winix::Job::~Job() /usr/home/tomek/roboczy/prog/web.ttmath.org/../winix/winixd/core/job.h:54:7
    #11 0x2e0c8a in Winix::System::~System() /usr/home/tomek/roboczy/prog/web.ttmath.org/../winix/winixd/core/system.h:67:7
    #12 0x2df017 in Winix::App::~App() /usr/home/tomek/roboczy/prog/web.ttmath.org/../winix/winixd/core/app.h:70:7
    #13 0x800cc9f50 in __cxa_finalize /hddraidzfs/usr/src/lib/libc/stdlib/atexit.c:238:5
    #14 0x800c5ef10 in exit /hddraidzfs/usr/src/lib/libc/stdlib/exit.c:74:2
    #15 0x25c935 in _start /hddraidzfs/usr/src/lib/csu/amd64/crt1.c:76:2

0x61b0000053e0 is located 1632 bytes inside of 1656-byte region [0x61b000004d80,0x61b0000053f8)
freed by thread T0 here:
    #0 0x2dc07d in operator delete(void*) /hddraidzfs/usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:160:3
    #1 0x8007c3b2c in Winix::ThreadManager::StopAll() /usr/home/tomek/roboczy/prog/winix/winixd/core/threadmanager.cpp:189:3
    #2 0x800647474 in Winix::App::WaitForThreads() /usr/home/tomek/roboczy/prog/winix/winixd/core/app.cpp:2122:24
    #3 0x800647311 in Winix::App::Close() /usr/home/tomek/roboczy/prog/winix/winixd/core/app.cpp:340:2
    #4 0x2dec7c in main /usr/home/tomek/roboczy/prog/winix/winixd/main/main.cpp:224:6
    #5 0x25c92e in _start /hddraidzfs/usr/src/lib/csu/amd64/crt1.c:76:7
    #6 0x80033efff  (<unknown module>)

previously allocated by thread T0 here:
    #0 0x2db81d in operator new(unsigned long) /hddraidzfs/usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0x8007c17c3 in Winix::ThreadManager::Add(Winix::BaseThread*, wchar_t const*) /usr/home/tomek/roboczy/prog/winix/winixd/core/threadmanager.cpp:77:26
    #2 0x8007b0b81 in Winix::System::Init() /usr/home/tomek/roboczy/prog/winix/winixd/core/system.cpp:170:17
    #3 0x8006468d4 in Winix::App::Init() /usr/home/tomek/roboczy/prog/winix/winixd/core/app.cpp:295:9
    #4 0x2deb7e in main /usr/home/tomek/roboczy/prog/winix/winixd/main/main.cpp:206:11
    #5 0x25c92e in _start /hddraidzfs/usr/src/lib/csu/amd64/crt1.c:76:7
    #6 0x80033efff  (<unknown module>)

in ThreadManager::StopAll() there is item.thread_item_data pointer which was freed (the pointer was pointing to an object with a log_buffer)
but internal Log buffer from item.object was pointing to that object and when thread_tab.clear() was called then the d-ctor was called
and then save_log_and_clear() method was called and tried to use the freed object.
2021-02-17 15:58:05 +01:00
Tomasz Sowa be83d62f96 changed html in index templates: [include "index_head_functions_add.html"] -> [include "index_head_adder.html"] 2021-02-16 20:10:29 +01:00
Tomasz Sowa 3fd2ef1da4 renamed: html/index_head_functions_add.html -> html/index_head_adder.html 2021-02-16 20:01:38 +01:00
Tomasz Sowa d861384889 Merge pull request 'uikit' (#3) from uikit into master
Reviewed-on: #3
2021-02-16 19:52:36 +01:00
Tomasz Sowa cfd8e88e57 changed markup in fun_thread.html, removed item_options.html (was not used by winix)
WIP: #2
2021-02-16 19:44:57 +01:00
Tomasz Sowa 8169cb5a7e added uikit markup for uname winix function
WIP: #2
2021-02-16 19:28:42 +01:00
Tomasz Sowa 8c85cd7346 added uikit markup for stat winix function
WIP: #2
2021-02-16 19:25:36 +01:00
Tomasz Sowa 4e202833b2 added uikit markup for rmuser winix function
WIP: #2
2021-02-16 19:21:53 +01:00
Tomasz Sowa 4a163bd170 added uikit markup for pw winix function
WIP: #2
2021-02-16 19:12:15 +01:00
Tomasz Sowa 85fbc1b882 added uikit markup for man winix function
WIP: #2
2021-02-16 19:03:01 +01:00
Tomasz Sowa 61810ff6f9 added uikit markup for last winix function
WIP: #2
2021-02-16 18:56:18 +01:00
Tomasz Sowa 3a4a29f56d added uikit markup for ipban winix function
WIP: #2
2021-02-16 18:53:12 +01:00
Tomasz Sowa 1fb7ece1b3 fixed: in imgcrop: data-uk-lightbox interfere with menu buttons
WIP: #2
2021-02-16 18:46:39 +01:00
Tomasz Sowa f3879dd3a4 added lightbox effect on images in imgcrop winix function
WIP: #2
2021-02-16 18:40:48 +01:00
Tomasz Sowa 561014886f added uikit markup for imgcrop winix function
WIP: #2
2021-02-16 18:35:55 +01:00
Tomasz Sowa a2b19547a3 fixed: in Functions::CheckSpecialFile() after parsing new mount points
the cur->mount pointer was pointing at the old mount object
(which may no longer exists)
2021-02-16 17:23:36 +01:00
Tomasz Sowa 93477091d1 added uikit markup for gallery winix funcion (gallery plugin)
- the main gallery is now 'uikit'
- lightbox updated to version 2.11.3 (now it is using jQuery, beforehand prototype.js was used)
- aino-gallery is called galleriajs now (and updated to 1.6.1)
- themes from galleriajs were removed and some new themes has been added (azur, twelve, folio, fullscreen)
- removed some old mount types for galleries (galleriathumb, galleria1.2.9, galleriathumb1.2.9)

WIP: #2
2021-02-16 16:31:52 +01:00
Tomasz Sowa 64d3c62945 added uikit markup for export winix function (plugin export)
WIP: #2
2021-02-16 13:11:39 +01:00
Tomasz Sowa 134e27f70a modified login template - removed uk-border-pill class
WIP: #2
2021-02-16 12:56:15 +01:00
Tomasz Sowa 5205aa089b modified index templates
some meta information moved to index_head_functions_add.html

WIP: #2
2021-02-16 12:55:35 +01:00
Tomasz Sowa b5b9655c1e modified buttons in thread winix function
WIP: #2
2021-02-16 12:54:05 +01:00
Tomasz Sowa 173d0894fa modified buttons in showthreads winix function
WIP: #2
2021-02-16 12:52:49 +01:00
Tomasz Sowa de6b050fb5 fixed comment in ls html template 2021-02-16 12:51:06 +01:00
Tomasz Sowa 37da5e81c5 added uikit markup for createticket, showtickets, ticket winix functions (plugin ticket)
WIP: #2
2021-02-15 19:52:03 +01:00
Tomasz Sowa ae8637d455 added uikit markup for: createthread, reply, showthreads and thread winix functions 2021-02-12 18:57:14 +01:00
Tomasz Sowa 22a45697fa added uikit markup for subject winix function 2021-02-09 18:48:48 +01:00
Tomasz Sowa 55462fca9f added uikit markup for uptime winix function 2021-02-09 18:26:30 +01:00
Tomasz Sowa 2799a66c16 added uikit markup for who winix function 2021-02-09 18:11:37 +01:00
Tomasz Sowa 9832b17fc2 updated uikit to 3.6.16 2021-02-09 18:10:01 +01:00
Tomasz Sowa 8146f42492 added uikit markup for seo winix function 2021-02-08 02:01:37 +01:00
Tomasz Sowa 9df146af3b added: to 'sort' winix function: 'renumerate' button if 'index' param is present
WIP: #2
2021-01-29 08:35:17 +01:00
Tomasz Sowa a7629f638f added uikit markup for sort winix function
WIP: #2
2021-01-28 20:16:44 +01:00
Tomasz Sowa e75918f5ed added uikit markup for rm winix function
WIP: #2
2021-01-28 15:36:39 +01:00
Tomasz Sowa 9698c25bc4 added uikit markup for ln winix function
WIP: #2
2021-01-28 12:41:43 +01:00
Tomasz Sowa bbe2bd48d8 added uikit markup for meta winix function
WIP: #2
2021-01-28 11:49:10 +01:00
Tomasz Sowa 0cc565ae80 added uikit markup for env winix function
WIP: #2
2021-01-28 11:11:34 +01:00
Tomasz Sowa aa74d96fed included index_bottom_adder.html in index.html and index_generic.html 2021-01-27 18:50:03 +01:00
Tomasz Sowa ac6ede6aef added uikit markup for template winix function
WIP: #2
2021-01-27 18:44:58 +01:00
Tomasz Sowa 10e291bb39 added: generic html template: index_generic.html
(config option: templates_index_generic)
this is a generic template without additional site-css (only uikit),
at the moment used only in ckeditor file browser

added: to Request class: index_template (std::wstring) - a name of an index html template
2021-01-27 18:31:48 +01:00
Tomasz Sowa 7a25e333db added uikit markup for ls winix function
WIP: #2
2021-01-27 17:55:48 +01:00
Tomasz Sowa a9b9d0badf fixed: mv winix function didn't move a file correctly
- if a file was moved (renamed) into the same directory and a file with the new name
already existed then nothing was done (now a message is shown that such a file already exists)
- if a file was moved to another directory and there was a file wich such a name there
then the moved file had its original name (now a message is shown that such a file already exists)
2021-01-27 17:30:55 +01:00
Tomasz Sowa a69e160f85 added uikit markup for nicedit winix function and nicedit updated to 0.9_r25 version
WIP: #2
2021-01-26 17:24:48 +01:00
Tomasz Sowa 56d53a455d added uikit markup for cp winix function
WIP: #2
2021-01-26 16:52:11 +01:00
Tomasz Sowa 572afd360a added uikit markup for mv winix function
WIP: #2
2021-01-26 16:37:11 +01:00
Tomasz Sowa ec6f946b97 added uikit markup for mkdir winix function
WIP: #2
2021-01-26 16:26:34 +01:00
Tomasz Sowa acfd87e548 added uikit markup for 'default' winix function
WIP: #2
2021-01-26 16:19:20 +01:00
Tomasz Sowa aa228732e3 added uk-table-responsive attribute to mount winix function markup
WIP: #2
2021-01-26 16:11:09 +01:00
Tomasz Sowa 840c222190 added uikit markup for mount winix function
WIP: #2
2021-01-26 16:05:15 +01:00
Tomasz Sowa 4408957770 changed form width for locale template
WIP: #2
2021-01-26 15:57:55 +01:00
Tomasz Sowa 89814cbc2e updated uikit to 3.6.14 version
WIP: #2
2021-01-26 15:51:57 +01:00
Tomasz Sowa fdcefae264 added uikit markup for priv, chmod, chown winix functions
WIP: #2
2021-01-26 15:46:47 +01:00
Tomasz Sowa 0139919d14 added uikit markup for passwd winix function 2021-01-25 19:19:45 +01:00
Tomasz Sowa 9476bcc7b6 Merge branch 'master' into uikit 2021-01-25 18:45:07 +01:00
Tomasz Sowa 4625451c85 fixed: messages about password validity in adduser function were not shown,
slog and locale for functions->fun_passwd were not set
2021-01-25 18:41:28 +01:00
Tomasz Sowa 1e345f5010 changed: locale files 2021-01-25 18:19:30 +01:00
Tomasz Sowa 31befcba44 added uikit markup for slog.html 2021-01-25 18:15:26 +01:00
Tomasz Sowa f6077da614 Merge branch 'master' into uikit 2021-01-25 17:59:14 +01:00
Tomasz Sowa 499db7e3eb fixed: session logger didn't have 'cur' and 'locale' pointers set
but this is a temporary fix, the session logger will be moved to Session class
2021-01-25 17:55:07 +01:00
Tomasz Sowa 50da49a3ed added uikit markup for adduser winix function 2021-01-25 17:17:54 +01:00
Tomasz Sowa 6afd5c637e added: in account winix function: links to locale and timezone 2021-01-25 16:23:13 +01:00
Tomasz Sowa 31a6aac9d3 added uikit markup for locale winix function 2021-01-25 16:15:55 +01:00
Tomasz Sowa 3c3660914f added uikit markup for timezone winix function 2021-01-25 16:10:42 +01:00
Tomasz Sowa cd0ae231dc added uikit markup for account winix function 2021-01-25 15:57:37 +01:00
Tomasz Sowa a8bc741883 added uikit markup for vim editor (wymeditor) 2021-01-25 14:34:35 +01:00
Tomasz Sowa 05b3525863 changed: version to 0.7.1 2021-01-25 13:14:16 +01:00
Tomasz Sowa 337f563bd4 changed html markup for tinymce and added support for 5.6.2 version 2021-01-22 16:56:51 +01:00
Tomasz Sowa c9fe09ebe3 updated locale files 2021-01-22 14:18:50 +01:00
Tomasz Sowa db1c63a350 added html/index_bottom_adder.html template - at the moment empty,
will be used at the bottom of an index template - before </body> tag
2021-01-22 11:50:37 +01:00
Tomasz Sowa 7cc2dcd1fc jquery-file-upload updated to 10.31.0 version 2021-01-22 11:50:28 +01:00
Tomasz Sowa bcde392ce3 updated translations 2021-01-21 19:22:26 +01:00
Tomasz Sowa 8d046f6280 added UIkit markup for ckeditor winix function 2021-01-21 19:17:33 +01:00
Tomasz Sowa 9a6696699f added UIkit markup for emacs winix function 2021-01-21 19:17:06 +01:00
Tomasz Sowa 56f2eec597 CodeMirror editor updated to version 5.59.2 - it is used in emacs winix function 2021-01-21 19:08:48 +01:00
Tomasz Sowa d29b33532d added UIkit markup for login winix function 2021-01-21 17:13:27 +01:00
Tomasz Sowa a16e82bf54 updated .gitignore 2021-01-21 17:12:56 +01:00
Tomasz Sowa 46c17cc441 added UIkit https://getuikit.com front-end framework to index_head_functions_add.html and index.html 2021-01-21 17:10:04 +01:00
Tomasz Sowa 2099092e16 updated .gitignore 2021-01-21 17:08:05 +01:00
Tomasz Sowa 88b7517337 dodany plik .gitignore 2021-01-21 11:35:40 +01:00
Tomasz Sowa 619236329c Makefile.dep
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1223 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-09-26 18:25:21 +00:00
Tomasz Sowa 76160a5ba6 Makefile deps
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1219 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-09-25 16:25:44 +00:00
Tomasz Sowa e95f32231a fixed: FileLog::get_local_date we need to synchronize when using time_zones pointer
(FileLog::get_local_date is used by Log::PrintDate() and Log of course can be used from different threads)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1218 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-09-25 16:25:20 +00:00
Tomasz Sowa be81307faa Makefiles deps
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1199 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-08-20 12:24:22 +00:00
Tomasz Sowa 177e58da4e changed: if there is no body we do not parse application/json to space
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1183 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-03-25 00:51:51 +00:00
Tomasz Sowa 4c2efc08fd fixed: permissions to symlinks and directories with redirect flag were incorrectly checked
(there was no session set and the request was treated the same as from a not logged user)
fixed: in BaseThread there was used 'log' in the main thread (this logger is only for the other thread)
added: in BaseThread we have a main_log now - logger which puts to the main log buffer from the main thread




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1182 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-03-19 18:08:09 +00:00
Tomasz Sowa ae03922491 seo plugin: added calling WINIX_FILE_CHANGED
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1180 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-03-14 13:46:40 +00:00
Tomasz Sowa ab005118ba added: a new plugin: seo
new winix function: "seo", it allowes to edit subject, description and keywords for a page
description and keywords are stored in meta



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1179 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-03-14 13:33:40 +00:00
Tomasz Sowa eec8635af4 changed: templates/item.cpp to use last_item instead of item
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1178 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-03-14 13:31:35 +00:00
Tomasz Sowa 5060997d2a Makefile.dep
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1176 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-03-07 18:02:52 +00:00
Tomasz Sowa 0ac5a21a14 Makefile.dep
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1172 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-03-06 18:19:29 +00:00
Tomasz Sowa def0f8d144 merge from branch 0.7.x:
- initial support for morm
- added: WinixBase, WinixModel, WinixSystem, WinixRequest
- logger moved to pikotools




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1171 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-03-06 11:53:28 +00:00
Tomasz Sowa 8895f0dcac - json_generic_serializer was not set when there was a redirect
- if there is a redirect and the json return answer is requested
  then we send 'redirect_to' field in 'info' space




git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1169 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-02-19 10:36:20 +00:00
Tomasz Sowa 4f8db81c85 added to Locale:
const std::wstring & GetReplace(const wchar_t * key, Types ... types)
key is a string pattern which has %0, %1 parameters which will be replaced with 'types'




git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1164 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-01-07 03:32:17 +00:00
Tomasz Sowa aa388e248d fixed: crash in thread plugin
ThreadInfo was not correctly initialized (plugin pointer was null)
added to PluginInfo: set_dependency_for(WinixModel * winix_model)




git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1162 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-01-02 11:33:19 +00:00
Tomasz Sowa e5d7403c54 Makefile.dep
git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1161 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-01-02 09:12:42 +00:00
Tomasz Sowa 4f57d6134c fixed: in Templates: TemplatesFunctions::plugin was not set
git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1160 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-01-02 04:36:24 +00:00
Tomasz Sowa 03f6b54a5b Makefile dep
git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1158 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-24 17:09:48 +00:00
Tomasz Sowa 63ef007ca1 changed: class Cur -> struct Cur in plugin.h
git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1154 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-23 18:34:01 +00:00
Tomasz Sowa 603e0679e7 Makefiles: added path to morm/src to -I flags
git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1152 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-23 18:28:15 +00:00
Tomasz Sowa b90445de4a updated to the new pikotools api - we have a logger for morm and ezc
pikotools has now Log and FileLog classes
which are base classes for winix Log and FileLog classes




git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1151 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-23 17:53:43 +00:00
Tomasz Sowa 491dd27ebf some work in the new api:
- log_level and save_each_line moved from Log to FileLog
- other fixes in loggers
- DirContainer from Dirs and LoadAvg had no dependencies set




git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1148 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-21 22:53:24 +00:00
Tomasz Sowa 89d303f375 some work on dependency injection
git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1147 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-21 17:51:15 +00:00
Tomasz Sowa a2ffc1e81c start working on 0.7.x branch
- added FileLog which stores content to the file log
- now Log is only a wrapper - it puts messages to the local buffer and when logsave is used then the buffer is put to FileLog
- new base classes:
  WinixBase (Log, Config*, Synchro*)
  WinixModel : public WinixBase (morm::ModelConnector*, Plugin*)
  WinixSystem : public WinixModel (System*)
  WinixRequest : public WinixSystem (SLog, Cur*)
- singletons: log, slog, plugin are depracated - now references to them are in base classses (WinixBase, WinixModel)
- DbBase,  DbConn and Db are depracated - now we are using Morm project (in WinixModel there is a model_connector pointer)
  each thread will have its own ModelConnector





git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1146 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-21 11:03:53 +00:00
Tomasz Sowa a7c47140ae creating branch 0.7.x
git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1145 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-21 10:50:34 +00:00
Tomasz Sowa ebd7f85fdb updated: html files for jquery-file-upload
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1143 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-15 17:01:40 +00:00
Tomasz Sowa 833c04776f changed Makefile.dep
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1141 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-14 17:15:03 +00:00
Tomasz Sowa 919c2f62f5 using PT::IsSubString* methods from pikotools
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1138 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-11-01 00:46:44 +00:00
Tomasz Sowa 8f6004d444 removed some IsSubstring* functions
(they are in Pikotools in text/convert.h now)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1135 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-29 23:51:11 +00:00
Tomasz Sowa 1b8f5dc673 added to HTMLFilter:
- possibility to remove html entities
  method: SkipEntity(bool)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1132 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-24 16:31:42 +00:00
Tomasz Sowa 027a8ec428 added to HTMLFilter:
- now we can parse " and ' in html attributes
- we can skip html tags and commentaries, added method:
  void SkipAllTags(bool skip_all_tags, bool skip_commentaries);
- there is virtual method: virtual void ItemFound();
  which is called when a html tag is parsed




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1129 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-23 23:28:45 +00:00
Tomasz Sowa d1e7765e98 backend winix
dodanie opisu strefy czasowej dla Warszawy na 2018 rok




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1128 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-10-23 21:00:36 +00:00
Tomasz Sowa 2d1b2e6b6e Makefile.dep
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1123 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-07-05 11:15:42 +00:00
Tomasz Sowa 350fc551e5 fixed: a default winix function was selected before the mount point was calculated
also a mount point should be cleared (set to an empty mount point) at the
       end of a request




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1117 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-07-02 12:02:19 +00:00
Tomasz Sowa 1c05c31721 added: antispam mechanism
each html form has a hidden form_id and counter_id
counter_id on the client side is generated through javascript code
on the server the form_id and counter_id is stored in the session
after sending the html form the server checks the form_id and counter_id




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1116 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-07-02 11:16:36 +00:00
Tomasz Sowa 08123fe6ac changed the algorithm how sessions work:
- if the IP is banned or there is no a winix function then we set a temporary session
- else
  if there is a session's cookie sent by the client then:
   - if the cookie is a correct session's cookie then we set the session from the cookie
   - or if the cookie is not a correct session's cookie (e.g. session expired) and the winix function
     requires a cookie then we set a new session
   - or if there is no cookie sent then if a winix function requires a session we create a new session

  if there was an error creating a new session or event counters reach a ban limit then a temporary session will be used





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1115 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-06-20 15:00:02 +00:00
Tomasz Sowa 35b93b1655 changed: now we are parsing directories and functions before checking a session
added:   need_session to FunctionBase (true if the functions requires a session)
         default: true
         



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1114 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-06-19 13:52:08 +00:00
Tomasz Sowa 436a198c36 changed: using PT::ToLower instead of ToSmall
using PT::ToUpper instead of ToCapital
         using PT::EqualNoCase instead of EqualNoCase
         



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1112 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-05-25 17:22:12 +00:00
Tomasz Sowa aa58faf145 some work on integrating ckeditor4
added ezc blocks: ckeditor_old_browsers_support, ckeditor, ckeditor_small
defined in ckeditor.html



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1109 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-05-10 17:21:39 +00:00
Tomasz Sowa dcc6d35cba added: start integrating CKEditor4
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1108 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-05-09 22:48:14 +00:00
Tomasz Sowa 3f29cdc01e changed: config parameters: log_check_proxy_ip_header -> check_proxy_ip_header and log_proxy_ip_header -> proxy_ip_header
added: Request::ip_str (std::wstring) (string of the client's IP address)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1105 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-05-01 11:22:55 +00:00
Tomasz Sowa ba7d55b7c1 added: config parameters:
bool log_check_proxy_ip_header;
       // check whether there is a 'log_proxy_ip_header' header
       // and if so then log the IP address from it
       // default: false

       std::wstring log_proxy_ip_header;
       // proxy header representing the real IP address of a client
       // default: X-Real-IP





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1104 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-05-01 10:43:20 +00:00
Tomasz Sowa 6252a0e732 added: Request::post_in (PT::Space) for input when application/json content type is used
from the client




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1102 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-26 18:56:31 +00:00
Tomasz Sowa ca14b1a427 added: Request::header_in (Space) http input headers (without cookies)
added: config parameter: log_env_http_variables (bool) (for logging http headers)
added: support for DELETE http method, added method FunctionBase::MakeDelete()
changed: winix version incremented to 0.6.6




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1100 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-25 19:48:47 +00:00
Tomasz Sowa b01db89942 added config parameter: db_postgresql_smaller_than_10
default false
if true then we are not using ROW() statements in sql queries




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1099 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-25 09:37:56 +00:00
Tomasz Sowa fd421c54e3 changed: Makefile (added Logger from pikotools)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1096 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-23 14:29:58 +00:00
Tomasz Sowa 55992b5066 added: std::wstring * Request::ParamValuep(const wchar_t * param_name)
for taking a pointer (can be null) to a parameter value
added: bool System::IsSSLRequired(bool try_to_use_ssl)
       returns true if we should use ssl
       try_to_use_ssl is to be meant: config->use_ssl, config->use_ssl_static, config->use_ssl_common
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1094 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-22 21:26:56 +00:00
Tomasz Sowa a5dfc9974f added: a virtual dctor() for BaseThread class
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1080 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-04-16 22:44:59 +00:00
Tomasz Sowa 7b4a17c934 changed: makefile dep
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1076 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-03-23 19:27:32 +00:00
Tomasz Sowa c2a1097dd5 added: dependency on the morm project
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1074 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-03-13 22:34:59 +00:00
Tomasz Sowa ccf78dcb02 updated to the new Pikotools API
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1071 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-01-06 18:12:53 +00:00
Tomasz Sowa 3eff400d88 added: "assume_connection_is_through_ssl" config parameter
winix is testing an environment variable "HTTPS" for the value "on"
       to think that the connection is made via SSL
       you can set assume_connection_is_through_ssl to true for the winix
       to not testing any environment variables but just think the connection
       was made by https (useful when using proxy)
       default: false




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1069 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-01-01 00:14:02 +00:00
Tomasz Sowa 5ab816b5be fixed: in progresql 10 we have to use ROW() expression to construct
a row where only one item is given



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1068 e52654a7-88a9-db11-a3e9-0013d4bc506e
2018-01-01 00:12:33 +00:00
Tomasz Sowa e57840faed fixed: static files loaded to /var such as /var/ckeditor_winix.js were not properly returned
(html filter was used but they are mostly javascript files)
added: new Item::ContentType: ct_other
       if an item has ct_other then the html filter is not used for the content





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1040 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-07-13 13:13:56 +00:00
Tomasz Sowa 240bf4dc5d changed: the way how raw template is set
option for setting raw template from 'emacs' function has been removed
         now we have index_raw.html template and it can be set from 'template' function
removed: template index_fullscreen.html
changed: some work in miscspace (changed: space_list_tab, space_list_tab_value and space_list_tab_has_next)
fixed:   main index template could not be set through 'template' function





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1039 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-04-04 16:02:36 +00:00
Tomasz Sowa abd1500f07 changed: some refactoring in miscspace
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1036 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-23 15:20:42 +00:00
Tomasz Sowa 42144bb31c some refactoring in miscspace(.h|.cpp)
space() renamed to space_value() and takes a third parameter: escape (bool)
space_noescape() removed

space_tab() renamed to space_list_tab()
space_tab_value() renamed to space_list_tab_value()
space_tab_has_next() renamed to space_list_tab_has_next()





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1035 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-22 14:53:43 +00:00
Tomasz Sowa 7ed41a03ae fixed: some paths in Makefile.dep were not relative
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1031 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-18 08:56:19 +00:00
Tomasz Sowa 1286ceeddf changed: winix project has been moved to 'winixd' subdirectory
in Makefiles we are caltulating relative paths now (by using relative_path program)
	 



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1030 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-17 13:46:20 +00:00
Tomasz Sowa 145efe937c moved winix directories to winixdsubdirectory
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1028 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-17 08:26:02 +00:00
Tomasz Sowa ed5adb3f23 moved winix directories to winixd subdirectory
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1027 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-17 08:24:59 +00:00
Tomasz Sowa 7d0508961e added: log info about what html template is used
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1026 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-03-16 14:11:47 +00:00
Tomasz Sowa e53e2e6af9 added: some work in RegisterMail plugin
(added looking for files in a config directory)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1024 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-02-03 18:10:40 +00:00
Tomasz Sowa 4fafd2a478 changed: Makefile
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1023 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-02-01 11:12:54 +00:00
Tomasz Sowa f15da4d049 fixed: in FunctionParser we do not treat '+' as a space
added: some work in MailRegister plugin
       (adding mails to db, showing mails)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1021 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-02-01 10:15:23 +00:00
Tomasz Sowa 057607f9e5 start working on a new plugin: mailregister
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1020 e52654a7-88a9-db11-a3e9-0013d4bc506e
2016-01-31 19:52:17 +00:00
Tomasz Sowa c433b3fd41 updated to the new Ezc API
[ezc stream] has gone, now we have [ezc out] and [out]
the output streams have names now: it's a std::map, before we have a std::vector
and the streams are serialized to "out" space in json
Request::out_streams[] are split into Request::out_main_stream and Request::out_streams class



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1017 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-11-15 22:23:36 +00:00
Tomasz Sowa 632b49ab90 fixed: meta and admin meta information were not saved in memory (in system.dirs)
when 'meta' winix function was used
added: to DbItemsQuery
       sort_index_asc and sort_index_date
       different sort type can be made by 'index' and by 'date'
		     



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1013 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-06-16 02:37:07 +00:00
Tomasz Sowa f54df8d600 updated: to the new EZC api (ezc functions can be methods of some special objects)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1012 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-06-14 18:24:08 +00:00
Tomasz Sowa d8451ceaa0 fixed: checking for ssl redirect
we should take into account cur.request->function->need_ssl too



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1010 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-05-29 09:46:29 +00:00
Tomasz Sowa 62f178c2ee fixed: in App::CheckIfNeedSSLredirect()
winix made an incorrect redirect from/to SSL



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1009 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-05-29 09:24:43 +00:00
Tomasz Sowa eb4e7343e7 changed: now 'emacs' winix function uses CodeMirror editor
currently only htmlmixed mode is implemented


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1008 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-04-18 18:50:39 +00:00
Tomasz Sowa 5274e8e8ff added: "server_mode" config option (std::wstring)
you can assign any string to it such as "production" "dev"
       this value is not used by winix itself
       you can refer to it from [server_mode] and [server_mode_is] ezc functions





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1007 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-04-16 14:43:52 +00:00
Tomasz Sowa ae2a885d6c fixed: rm winix function returned incorrectly formated json when using jquery upload (delete file button)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1006 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-03-20 11:00:22 +00:00
Tomasz Sowa 901663b145 updated: to the new ezc api
added:   following ezc functions: ezc_and_not, ezc_any_not, ezc_or_not, ezc_one_not, is, is_not, is_empty, is_not_empty





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1005 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-03-08 23:22:05 +00:00
Tomasz Sowa dc301d4c50 changed: editors (emacs, ckeditor...) doesn't set an item's title now (if it was empty)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1003 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-03-02 21:23:29 +00:00
Tomasz Sowa 34f0535a26 added: some ezc functions for displaying current date
current_sec, current_min, current_hour, current_year, ...



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1002 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-02-22 10:23:52 +00:00
Tomasz Sowa af0e2a778d changed: some refactoring in System: in IsMemberOfGroup method
changed: some log messages at startup (about non existing empty group for uploads directory)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1001 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-01-02 08:18:06 +00:00
Tomasz Sowa 904f1e70f2 fixed: compiling on Debian (it has no MSG_EOF flag)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1000 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-01-02 07:15:22 +00:00
Tomasz Sowa ddf7ef30ad fixed: compiling od Debian
sockaddr_un has no sun_len member



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@999 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-01-02 07:14:15 +00:00
Tomasz Sowa 0a43870e76 fixed: the way how winix is closing
beforehand we made a http connection from the special thread
       now we just send a fastcgi packet to the unix socket

       the old way was broken because it requires the http server to work
       and if the operating system is going to shutdown/reboot then the http server
       can be first closed and consequently the winix cannot wake up from
       the main thread (and will be terminated SIGKILL by the os)
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@998 e52654a7-88a9-db11-a3e9-0013d4bc506e
2015-01-02 07:01:08 +00:00
Tomasz Sowa f875bd2944 changed: when a client doesn't send a session cookie we can instead of ban just use a temporary session
added: config option:
	// the way we behave when no_session_cookie_treshold limit is exceeded
 	// 0 - if a client doesn't send a session cookie again then use a temporary session
 	//     (other sessions from this IP address are not affected)
 	// 1 - add this IP address to ban list and create a temporary session
 	//     (this will block other sessions from this IP address too)
 	// default: 0
 	int no_session_cookie_ban_mode;




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@996 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-25 12:02:22 +00:00
Tomasz Sowa c9bf20201b added: possibility to ban if a session cookie is incorrect (when we are using encoded cookies)
added:   possibility to ban if a client tries to hijack the session cookie
added:   possibility to ban if a client did not send a session cookie
renamed: ezc functions:
         login_cannot_login -> ipban_is_login_allowed_from_this_ip  (and the return value was changed)
         login_when_available_login -> ipban_current_ip_expires_time
added: config options:
       // after how many broken encoded cookie we should ban the current IP
       // default: 2 (value in the range <0 - 65535>)
       size_t broken_encoded_cookie_treshold;

       // after how many incorrect session identifiers (or session indices) we should ban the current IP
       // do not set this value too low, as people connecting from the same IP address (from behind a NAT)
       // would be banned if they have an old session cookie remembered in the browser
       // default: 128 (value in the range <0 - 65535>)
       size_t session_hijacking_treshold;

       // after how many times a client will be banned if it did not send a session cookie
       // default: 1000 (value in the range <0 - 65535>)
       size_t no_session_cookie_treshold;








git-svn-id: svn://ttmath.org/publicrep/winix/trunk@995 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-24 20:22:30 +00:00
Tomasz Sowa 76314aab10 added: possibility to encode the session cookie (added files core/sessionidmanager.h and core/sessionidmanager.cpp)
added: config options:
       // whether or not we should encode the session cookie
       // (we have a special algorithm)
       // default: false
       bool session_cookie_encode;

       // if session_cookie_encode is true then you should provide
       // a file where AES keys will be stored
       std::wstring session_keys_file;

       // each session has an index -- an unsigned int value
       // this value is sent in the cookie string (is encoded)
       // and is incremented when session_index_time_increment time is passed since the last incrementing
       // if a client sent the cookie back the difference between
       // current index and the index in the cookie should be less than or equal to session_allow_index_difference
       // default: 8
       size_t session_allow_index_difference;

       // the time which should pass after the session index is incremented
       // default: 30
       // (session_allow_index_difference + 1) * session_index_time_increment should be less than a time
       // load of a page and all elements on it such as images (of course it depends on client's download too)
       time_t session_index_time_increment;

       // time in seconds after a new AES key pair should be generated
       // we have 256 pairs of keys so this time multiplied by 256 should not be less than
       // the max time of a session (session_remember_max_idle),
       // by default: 256 * 2 days = 512 days = 1.4 year > 3 months (session_remember_max_idle)
       // default: 172800 = 2 days (max: 2678400 = 1 month, min: 10)
       size_t session_key_renew_time;

changed: when printing the time of a request we print only two non-zero digits






git-svn-id: svn://ttmath.org/publicrep/winix/trunk@994 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-22 15:30:56 +00:00
Tomasz Sowa 3547d326b8 define AR macro in the main Makefile
this is for pikotools and tito libraries



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@993 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-12 04:14:16 +00:00
Tomasz Sowa 0ecb2ac70e added: to HtmlTextStream: Escape(bool) method
now the output html streams can be turn into no-escaping mode
       default true (set when a request is clearing)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@990 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-06 21:17:41 +00:00
Tomasz Sowa 8f8defe0de updated: to the new Ezc API
removed statements: [if-index ...] [is ...] [is-no ...]
added:   generic ezc functions:
         and, any (the same as and), or, one (the same as or), not, cmp, trim
         to_lower, to_upper, index
changed: in misc:
         added treat_new_line_as_white flag to IsWhite() SkipWhite() and TrimWhite()
         TrimWhite(), TrimFirst(), TrimLast(), Trim() are using only wide characters now
         (they were templates before)
         added: IsInt(), IsSize(), IsFloat()
changed: version to 0.6.4






git-svn-id: svn://ttmath.org/publicrep/winix/trunk@989 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-02 17:47:34 +00:00
Tomasz Sowa db5572e864 removed: svn:executable attribute from files
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@984 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-11-01 17:05:20 +00:00
Tomasz Sowa 1100cf75d7 updated: to the new Ezc API
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@983 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-28 19:14:46 +00:00
Tomasz Sowa 4fda06b547 fixed: PatternCacher incorrectly rebuilt the cache
some new Ezc::Pattern objects were inserted
       the storage container is std::map<long,...>
       but we traverse it as a std::vector e.g.:
       for(size_t i=0 ; i<pattern_tab.size() ; ++i)
           RebuildCache(pattern_tab[i].pattern);
       so eventually new patterns were added to the map
       (operator [])




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@980 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-21 07:27:21 +00:00
Tomasz Sowa fb18b2238e added: two options to the config:
ezc_error_prefix (string)
        ezc_error_postfix (string)
        // prefix and postfix used when there is an error in Ezc patterns
        // default:
        // prefix:  "<!-- "
        // postfix: " -->"
added:  Ezc::Blocks to templates
added:  although patterns have pointers to functions and blocks cached
        the Ezc::Generator should use SetFunctions() and SetBlocks() method
        in order to correctly recognize variables (aliases)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@978 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-19 21:20:09 +00:00
Tomasz Sowa 5266a7e4e5 updated: to the new Ezc API
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@974 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-18 18:12:04 +00:00
Tomasz Sowa 8196fb77d1 changed: now we do not use std::string and char* in the Winix API
everywhere we are using std::wstring and wchar_t*
         (std::string and char* is used only locally in some places
         especially when creating a path to OS file system etc.)
added:   to the special thread when winix closes:
         a write function for curl: FetchPageOnExitCurlCallback()
         without this function the curl library will print
         the page's content to the standart output
changed: TextStream<> class from core can make
         UTF8<->wide strings conversions
removed: from config: utf8 option
         now winix expects UTF8 from the user's input (html forms, url-es)
         and outputs strings in the UTF8 format




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@965 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-09 20:44:56 +00:00
Tomasz Sowa 4abf6642f7 setting a Winix Licence: 2 Clause BSD Licence
changed: version to 0.6.2



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@963 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-10-04 18:04:03 +00:00
Tomasz Sowa e3284dcfbc fixed: winix incorrectly used config options: upload_dirs_chmod and upload_files_chmod
added: to config: upload_group
       a group name for newly uploaded files (and created necessary directories in the file system)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@961 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-09-28 17:30:05 +00:00
Tomasz Sowa f064ff6b3d added: htmltextstream escapes more characters now:
added characters:
          "  -> &#quot;
          '  -> &#39; (&apos; but IE8 has a problem with &apos;)
          10 -> &#10;
          13 -> &#13;
added: two ezc filters:
       fil_html_quote
          "  -> &#quot;
          '  -> &#39; (&apos; but IE8 has a problem with &apos;)
       fil_html_newline
          10 -> &#10;
          13 -> &#13;
changed: fun_subject.html uses <div class="winix_input_a"> now





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@959 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-09-22 23:54:24 +00:00
Tomasz Sowa bfa5d8cc05 changed: plugin jQuery File Upload has been updated to version 9.7.0
(changed 'upload' and 'rm' winix functions)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@958 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-08-06 20:14:10 +00:00
Tomasz Sowa 6614919c13 added: possibility to save a pid file
new config option: pid_file (a full path to a pid file)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@957 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-08-04 21:11:14 +00:00
Tomasz Sowa 8379acdb7f fixed: item content should not be escaped in 'raw' mode
(it was not escaped only when execute bits were set)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@956 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-08-03 18:33:07 +00:00
Tomasz Sowa 160ddc258d added: to htmlfilter: the filter is able to recognize a special tag, default called: <nofilter>
content between <nofilter>...</nofilter> will not be filtered



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@955 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-06-18 23:18:28 +00:00
Tomasz Sowa 01892d2766 added: flag has_pass to User structure
if false that means the user has not set a password yet 
       (this can be used by a plugins to create a new account without a password set)
       in order to login the user first has to set a new password
       (this can be done from a some kind of activation link send via email etc)
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@954 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-06-07 11:20:44 +00:00
Tomasz Sowa 222955a2e7 fixed: in Synchro: we should have a table (map) of reference counters
each one for each thread
fixed: on Linux: pthread mutexes by default behaves differently than on FreeBSD
       we have to set PTHREAD_MUTEX_ERRORCHECK attribute 
       when creating a mutex
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@953 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-14 11:20:22 +00:00
Tomasz Sowa 37b22c3559 added: some debug logs to export plugin
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@952 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-12 22:32:06 +00:00
Tomasz Sowa afbd522362 fixed: in Makefile: 'cp' in Linux behaves differently
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@951 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-12 20:49:50 +00:00
Tomasz Sowa a4bed3ab14 fixed: compiling on Debian with GCC 4.8
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@950 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-12 17:21:42 +00:00
Tomasz Sowa 7468e7a36c added: namespace Winix over all *.h/*.cpp files
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@948 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-12 16:30:49 +00:00
Tomasz Sowa 145445c713 changed: now we use curl to fetch a page from the special thread when winix quits
(before we were using BSD's fetch)
fixed:   we didn't use FCGX_Finish_r() on the request made from the special thread
         so the thread hangs (now we can use pthread_join correctly from the main thread)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@947 e52654a7-88a9-db11-a3e9-0013d4bc506e
2014-02-11 21:00:32 +00:00
Tomasz Sowa 7fa9314c6b changed: in ClearOutputStreams() referencing 'config' only if not null
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@946 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-23 03:29:33 +00:00
Tomasz Sowa 5d37b6c6ae fixed: winix incorrectly sent the binary stream
headers and cookies were not sent
       (instead of headers the content was sent, so the client's browser was unable to open it correctly)
added: standard http headers are added by winix only if there are not such headers already
       e.g. if a plugin adds "Content-Type" header then winix will not overwrite it 
       (headers names are case sensitive)


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@945 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-19 17:19:47 +00:00
Tomasz Sowa fe1f84e29d added: -O0 -g for CXXFLAGS for temporarily debugging
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@944 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-18 12:13:28 +00:00
Tomasz Sowa 83e27a6653 fixed: problem with building
added #include <utility> to App (for std::move)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@943 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-09 16:03:45 +00:00
Tomasz Sowa ee9c68b04e added: generating Content-Length header when text answer is sent to the client
added:   now we are able to use the html filter for the whole out_streams (when ajax is used the output is filtered too)
         splitted FilterCompressSend() function -- first we are making the filtering
         (after filtering we know the size of the content to send)
added:   to Compress:
         Compressing(const char * source, size_t source_len, BinaryPage & out_stream, int encoding);
changed: some refactoring in App




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@942 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-04 01:21:57 +00:00
Tomasz Sowa c04874397b fixed: security vulnerability in 'ln' winix function
a user could create a hardlink to any file and the new link 
       had user_id, group_id and permissions the same as for new generated files,
       this allowes to overwrite any existing file in the filesystem,
       now user_id, group_id, permissions are the same as from the oryginal file



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@941 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-12-03 12:33:41 +00:00
Tomasz Sowa 375604edd6 removed: Request::debug all stream used for debugging info
some environment variables were put there
removed: config variable: debug_info
removed: Request::role (responder, authorizer)
         now we have only one role: responder
added:   new config variables:
         log_env_variables (default false) - when true then fastcgi environment
         variables are logged to the log file
         log_http_answer_headers (default false) - when true all http headers
         created by winix ale logged (note that the www server can add/adjust other headers)
changed: some refactoring in Request struct
changed: CookieTab to std::map<std::wstring, std::wstring>
         beforehand std::string was used
         (changed CookieParser as well)
changed: Request::SetCookie() to AddCookie()
added:   Request::out_headers (a PT::Space struct)
         http headers (without cookies) send back to the client
added:   Request::out_cookies (a PT::Space struct)
         cookies send to the client
changed: App class to use Request::out_headers and Request::out_cookies
         some SendHeaders...() methods were renamed to PrepareHeaders...()
         and they create output in Request::out_headers first (and out_cookies)
         and later it is sent
added:   two plugin messages:
         // http headers (without cookies) were created and are ready to send
         // here you can make some changes to them
         // in p1 you have a pointer to the PT::Space (Request::out_headers)
         #define WINIX_PREPARE_TO_SEND_HTTP_HEADERS		31070

         // http cookies were created and are ready to send
         // here you can make some changes to them
         // in p1 you have a pointer to the PT::Space (Request::out_cookies)
         #define WINIX_PREPARE_TO_SEND_HTTP_COOKIES		31080
added:   config variable:
         // how many output streams do we have in Request class
         // default: 16 (64 maximum)
         size_t ezc_out_streams_size;




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@940 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-29 21:39:23 +00:00
Tomasz Sowa 3e32f3784f removed: -O0 -g from production Makefile
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@939 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-25 23:44:01 +00:00
Tomasz Sowa 5c4a54d998 added: -O0 -g to the production Makefile
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@938 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-25 23:37:52 +00:00
Tomasz Sowa 3af3ac3f6f removed: ezn patterns for rawcontent and ajaxcontent:
index_rawcontent.html, index_ajaxcontent.html
         now we have out_streams in Request and some special
         keyword in ezc templates for sending content to the 
         specified streams
changed: the way how winix answers to the client's browsers:
         info from Request class:
	                                   winix answer send to the client's browser
	                                                       |
	                                                       |
	                                          depending on send_bin_stream
	                               -------------------------------------------------
	                               |                                               |
	                          text answer                                     binary answer
	                               |                                               |
	                   depending on return_json                          sending out_bin_stream
	             ------------------------------------
	             |                                  |
	       normal request                     ajax request
	             |                                  |
	   sending out_streams[0]           depending on return_info_only
	                              ------------------------------------------------------
	                              |                                                    |
	                 generating JSON object from:                   generating JSON object only from info
	                 out_streams and info, e.g.:                    e.g.:
	                 {                                              { info object serialized here }
	                  "stream_1": "some html content",
	                  "stream_2": "some other html content",
	                  "info": { info object serialized here }
	                 }
	                 note that out_streams[0] is not sent
	                 in JSON answers
	
	




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@937 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-11-14 20:59:23 +00:00
Tomasz Sowa d801f53154 changed: now we are using the C++ 11 language (-std=c++11) and we are using
the clang compiler by default
changed: Makefile files have been a little cleaned
         the main Makefile now will not compile winix and winix.so if there
         were not any changes to source files (it's faster)
         (added Makefile.dep in the global directory with list of all source/header files)
changed: winix version to 0.5.5




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@933 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-10-15 21:57:51 +00:00
Tomasz Sowa a6b06f82e9 fixed: compiling in the clang (new version of c++ std lib)
(added some header files)
added: three messsages in ticket plugin:
       // send by showtickets winix function when tickets are loaded (and sorted)
       // in p1 you have a pointer to the ticket tab: std::vector<Ticket::Ticket> (include "ticket.h")
       // in p2 you have a pointer to the sort tab:   std::vector<Item*>
       // those tables don't have to be equal in size (in the case when there is no some tickets in the database)
       #define WINIX_PL_TICKET_TICKETS_LOADED                 4106
       
       // a new ticket has been added
       // in p1 you have a pointer to the Ticket::Ticket structure (include "ticket.h")
       // in p2 you have a pointer to the Item structure
       #define WINIX_PL_TICKET_ADDED_NEW                              4107
       
       // a ticket has been changed
       // in p1 you have a pointer to the Ticket::Ticket structure (include "ticket.h")
       // in p2 you have a pointer to the Item structure
       #define WINIX_PL_TICKET_CHANGED                                        4108

added: two ezc functions for tickets:
       ticket_does_param_id_have_value()
       tickets_tab_does_param_id_have_value()
       (they take two integer arguments -- testing whether a specified param_id has the given value)
changed: some more minor additions in tickets templates




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@932 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-10-10 11:59:21 +00:00
Tomasz Sowa b7f3f84080 changed: in 'showtickets' winix function
now tickets are sorted by the sort_index and then by date
changed: html in 'sort' winix function (added items' subjects to the item lists)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@931 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-07-08 14:42:14 +00:00
Tomasz Sowa 26715bdd4c changed: html for 'upload' winix function
all static files (css/js) are downloaded from our server now



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@930 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-07-02 07:14:19 +00:00
Tomasz Sowa 083fa7857f fixed: in notify/notify.cpp: a correct locale id should be taken
(we were not able to send: a mail with an activation link and 
        a mail with the reset password link when we didn't have a locale with id 0 loaded)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@929 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-05-16 21:02:17 +00:00
Tomasz Sowa 9ffda3e070 changed: in passwd: a redirect make only if a password has been changed
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@928 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-05-16 20:11:27 +00:00
Tomasz Sowa 81160dbbe9 fixed: a passwd winix function should allow a non loged person to reset his password (permission fix)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@927 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-05-16 20:08:07 +00:00
Tomasz Sowa 7c266b85e2 added: winix function 'account'
code for activating an account has been moved here from Pw
changed: the form for reseting a user's password has been moved
         to 'passwd' winix function (it was in Pw before)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@926 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-05-16 19:26:44 +00:00
Tomasz Sowa 48cdca7549 changed: in fun_gallery.html: added js code to get the proper image id from url
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@925 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-05-14 08:37:22 +00:00
Tomasz Sowa 1c401eae3b added: to Rm function:
bool Rm::RemoveFileOrSymlink(long item_id, bool check_access)
added: in ticket plugin: possibility to remove a file/image
       (not finished yet)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@924 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-05-06 07:23:44 +00:00
Tomasz Sowa 0e9eb30b5d added: some ezc function to ticket plugin:
ticket_param_value_for_param_id
       tickets_tab_param_value_for_param_id
       tickets_tab_conf_tab_param_name
       tickets_tab_conf_tab_file_tab
       tickets_tab_conf_tab_file_tab_index
       tickets_tab_conf_tab_file_tab_path
       tickets_tab_conf_tab_file_tab_itemid
       tickets_tab_conf_tab_file_tab_meta




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@923 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-04-24 01:21:19 +00:00
Tomasz Sowa c10c9393c0 changed: plugin 'export': export winix function
the checkbox is now selected when we want to export static files too 
         (default it is not checked)
         



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@922 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-04-17 00:37:39 +00:00
Tomasz Sowa 8705b3437c fixed: imgcrop winix function should load only images
(when called in a directory)
added: to reload winix function:
       reloading (clearing) the cache from 'menu' plugin
added: to 'menu' plugin
       possibility to read 'meta' information from files 
       third argument 'withmeta' to menu_dir_tab ezc function
       e.g. [for menu_dir_tab "/directory" "..." "withmeta"]...[end]
       and some ezc functions to retrieve the meta values




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@921 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-04-16 09:51:36 +00:00
Tomasz Sowa aed891764a added: to config: HasValue() methods
for checking if a value exists (useful for checking lists -- they don't have to be copied out)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@920 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-04-02 22:24:30 +00:00
Tomasz Sowa 495499d12f added: a new winix function: imgcrop
for cropping images (and thumbnails)
       www.domain.com/dir/file.jpg/imgcrop  -- crop an image
       www.domain.com/dir/file.jpg/imgcrop/thumb  -- crop an image's thumbnail
       www.domain.com/dir/file.jpg/imgcrop/newthumb  -- crop and create a new thumbnail (from an original image)
       www.domain.com/dir/imgcrop -- show images' list with above options
added: to Image class: some methods for cropping




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@919 e52654a7-88a9-db11-a3e9-0013d4bc506e
2013-03-29 22:03:28 +00:00
814 changed files with 84771 additions and 45320 deletions

21
.editorconfig Normal file
View File

@ -0,0 +1,21 @@
# EditorConfig
# https://editorconfig.org/
# https://editorconfig-specification.readthedocs.io/
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# 4 space indentation
[*.{h,cpp,html,css,js,conf,txt}]
indent_style = tab
indent_size = 4
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
indent_size = 4

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
.cproject
.project
.settings/
*.o
*.so
winixd/winix
winixcli/src/winix
winixcli/m
.clangd
.qtc_clangd/
winix.cflags
winix.config
winix.creator
winix.creator.user
winix.cxxflags
winix.files
winix.includes

24
LICENSE Normal file
View File

@ -0,0 +1,24 @@
Copyright (c) 2012-2022, Tomasz Sowa
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

128
Makefile
View File

@ -1,128 +0,0 @@
# Makefile for GNU make
ifndef CXX
CXX = g++
endif
ifndef CXXFLAGS
CXXFLAGS = -fPIC -Wall -O2 -pthread -I/usr/local/include -I/home/tomek/roboczy/prog/winix -I/home/tomek/roboczy/prog/ezc/src -I/home/tomek/roboczy/prog/tito/src -I/home/tomek/roboczy/prog/pikotools -DEZC_USE_WINIX_LOGGER -DEZC_HAS_SPECIAL_STREAM
endif
ifndef LDFLAGS
LDFLAGS = -L/usr/local/lib
endif
export CXX
export CXXFLAGS
export LDFLAGS
all: winix.so plugins winix
winix.so: FORCE
@cd core ; $(MAKE) -e
@cd db ; $(MAKE) -e
@cd functions ; $(MAKE) -e
@cd notify ; $(MAKE) -e
@cd templates ; $(MAKE) -e
@cd ../ezc/src ; $(MAKE) -e
@cd ../tito/src ; $(MAKE) -e
@cd ../pikotools ; $(MAKE) -e
$(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) core/*.o db/*.o functions/*.o templates/*.o notify/*.o ../ezc/src/ezc.a ../tito/src/tito.a ../pikotools/utf8/utf8.a ../pikotools/space/space.a ../pikotools/mainparser/mainparser.a ../pikotools/date/date.a $(LDFLAGS) -lfcgi -lpq -lz -lfetch -lpthread -Wl,-no-whole-archive
winix: winix.so FORCE
@cd main ; $(MAKE) -e
# use the full path with winix.so
$(CXX) -o winix $(CXXFLAGS) $(LDFLAGS) main/*.o /home/tomek/roboczy/prog/winix/winix.so
plugins: FORCE
@cd plugins/stats ; $(MAKE) -e
@cd plugins/thread ; $(MAKE) -e
@cd plugins/ticket ; $(MAKE) -e
@cd plugins/gallery ; $(MAKE) -e
@cd plugins/group ; $(MAKE) -e
@cd plugins/menu ; $(MAKE) -e
@cd plugins/export ; $(MAKE) -e
FORCE:
clean:
@cd core ; $(MAKE) -e clean
@cd db ; $(MAKE) -e clean
@cd functions ; $(MAKE) -e clean
@cd templates ; $(MAKE) -e clean
@cd notify ; $(MAKE) -e clean
@cd plugins/stats ; $(MAKE) -e clean
@cd plugins/thread ; $(MAKE) -e clean
@cd plugins/ticket ; $(MAKE) -e clean
@cd plugins/gallery ; $(MAKE) -e clean
@cd plugins/group ; $(MAKE) -e clean
@cd plugins/menu ; $(MAKE) -e clean
@cd plugins/export ; $(MAKE) -e clean
@cd ../ezc/src ; $(MAKE) -e clean
@cd ../tito/src ; $(MAKE) -e clean
@cd ../pikotools ; $(MAKE) -e clean
@cd main ; $(MAKE) -e clean
rm -f winix.so
rm -f winix
depend:
@cd core ; $(MAKE) -e depend
@cd db ; $(MAKE) -e depend
@cd functions ; $(MAKE) -e depend
@cd templates ; $(MAKE) -e depend
@cd notify ; $(MAKE) -e depend
@cd plugins/stats ; $(MAKE) -e depend
@cd plugins/thread ; $(MAKE) -e depend
@cd plugins/ticket ; $(MAKE) -e depend
@cd plugins/gallery ; $(MAKE) -e depend
@cd plugins/group ; $(MAKE) -e depend
@cd plugins/menu ; $(MAKE) -e depend
@cd plugins/export ; $(MAKE) -e depend
@cd ../ezc/src ; $(MAKE) -e depend
@cd ../tito/src ; $(MAKE) -e depend
@cd ../pikotools ; $(MAKE) -e depend
@cd main ; $(MAKE) -e depend
install: all
# binaries
mkdir -p /usr/local/winix/bin
cp winix.so /usr/local/winix/bin
# use the full path with winix.so (we have to recompile winix with a new path to winix.so)
$(CXX) -o /usr/local/winix/bin/winix $(CXXFLAGS) main/*.o /usr/local/winix/bin/winix.so
# etc configs
mkdir -p /usr/local/winix/etc
cp -rf etc/ /usr/local/winix/etc/
find /usr/local/winix/etc/ -type d -name ".svn" | xargs -I foo rm -fr foo
# html templates
mkdir -p /usr/local/winix/html
cp -rf html/ /usr/local/winix/html/
find /usr/local/winix/html/ -type d -name ".svn" | xargs -I foo rm -fr foo
# txt templates
mkdir -p /usr/local/winix/txt
cp -rf txt/ /usr/local/winix/txt/
find /usr/local/winix/txt/ -type d -name ".svn" | xargs -I foo rm -fr foo
# locales
mkdir -p /usr/local/winix/locale
cp -rf locale/ /usr/local/winix/locale/
find /usr/local/winix/locale/ -type d -name ".svn" | xargs -I foo rm -fr foo
# plugins
mkdir -p /usr/local/winix/plugins
find plugins/ -name "*.so" | xargs -I foo cp foo /usr/local/winix/plugins/
# removed provileges for others
find /usr/local/winix -exec chmod o-r,o-x,o-w "{}" "+"

View File

@ -1,19 +0,0 @@
include Makefile.o.dep
all: $(o)
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I.. -I../../ezc/src -I../../pikotools -I../../tito/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
clean:
rm -f *.o
include Makefile.dep

View File

@ -1,883 +0,0 @@
# DO NOT DELETE
acceptbaseparser.o: acceptbaseparser.h
app.o: app.h config.h ../../pikotools/space/spaceparser.h
app.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
app.o: htmlfilter.h system.h job.h basethread.h synchro.h
app.o: ../../pikotools/space/space.h dirs.h item.h
app.o: ../../pikotools/date/date.h dircontainer.h ../db/db.h ../db/dbbase.h
app.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
app.o: requesttypes.h ../../pikotools/textstream/textstream.h
app.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
app.o: ../../pikotools/membuffer/membuffer.h
app.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
app.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
app.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
app.o: ../core/dircontainer.h ../core/ugcontainer.h log.h textstream.h
app.o: logmanipulators.h slog.h cur.h request.h error.h
app.o: ../templates/htmltextstream.h ../../pikotools/space/spacetojson.h
app.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
app.o: ../templates/locale.h ../notify/notify.h ../notify/notifypool.h
app.o: ../templates/patterns.h ../templates/locale.h
app.o: ../templates/localefilter.h ../../ezc/src/ezc.h
app.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
app.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
app.o: ../../ezc/src/stringconv.h ../notify/notifythread.h
app.o: ../core/basethread.h ../notify/templatesnotify.h ../core/config.h
app.o: ../core/users.h ugcontainer.h lastcontainer.h mounts.h mountparser.h
app.o: crypt.h run.h users.h groups.h group.h loadavg.h image.h
app.o: threadmanager.h timezones.h timezone.h sessionmanager.h
app.o: sessioncontainer.h ipbancontainer.h ../functions/functions.h
app.o: ../functions/functionbase.h ../core/request.h ../core/system.h
app.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
app.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
app.o: ../functions/privchanger.h ../functions/chown.h
app.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
app.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
app.o: ../functions/last.h ../functions/login.h ../functions/logout.h
app.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
app.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
app.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
app.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
app.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
app.o: ../functions/specialdefault.h ../functions/stat.h
app.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
app.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
app.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
app.o: ../templates/templates.h ../templates/patterncacher.h
app.o: ../templates/indexpatterns.h ../templates/patterns.h
app.o: ../templates/changepatterns.h ../templates/htmltextstream.h
app.o: ../core/sessionmanager.h compress.h postparser.h httpsimpleparser.h
app.o: plugin.h pluginmsg.h cookieparser.h postmultiparser.h
app.o: acceptencodingparser.h acceptbaseparser.h
basethread.o: basethread.h synchro.h
bbcodeparser.o: bbcodeparser.h htmlfilter.h
compress.o: compress.h requesttypes.h ../../pikotools/textstream/textstream.h
compress.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
compress.o: ../../pikotools/convert/convert.h
compress.o: ../../pikotools/convert/inttostr.h
compress.o: ../../pikotools/membuffer/membuffer.h
compress.o: ../../pikotools/textstream/types.h log.h textstream.h
compress.o: logmanipulators.h slog.h cur.h request.h item.h error.h config.h
compress.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
compress.o: ../../pikotools/textstream/types.h htmlfilter.h
compress.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
compress.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
compress.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
compress.o: ../templates/locale.h
config.o: config.h ../../pikotools/space/spaceparser.h
config.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
config.o: htmlfilter.h log.h textstream.h logmanipulators.h
config.o: ../../pikotools/textstream/textstream.h
config.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
config.o: ../../pikotools/convert/convert.h
config.o: ../../pikotools/convert/inttostr.h
config.o: ../../pikotools/membuffer/membuffer.h
config.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
config.o: requesttypes.h item.h error.h ../templates/htmltextstream.h
config.o: ../core/textstream.h misc.h ../../pikotools/utf8/utf8.h
config.o: ../../pikotools/space/spacetojson.h session.h user.h plugindata.h
config.o: rebus.h ipban.h mount.h ../templates/locale.h plugin.h pluginmsg.h
config.o: system.h job.h basethread.h synchro.h dirs.h dircontainer.h
config.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
config.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
config.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
config.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
config.o: ../notify/notifypool.h ../templates/patterns.h
config.o: ../templates/locale.h ../templates/localefilter.h
config.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
config.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
config.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
config.o: ../notify/notifythread.h ../core/basethread.h
config.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
config.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
config.o: users.h groups.h group.h loadavg.h image.h threadmanager.h
config.o: timezones.h timezone.h sessionmanager.h sessioncontainer.h
config.o: ipbancontainer.h ../functions/functions.h
config.o: ../functions/functionbase.h ../core/request.h ../core/system.h
config.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
config.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
config.o: ../functions/privchanger.h ../functions/chown.h
config.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
config.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
config.o: ../functions/last.h ../functions/login.h ../functions/logout.h
config.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
config.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
config.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
config.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
config.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
config.o: ../functions/specialdefault.h ../functions/stat.h
config.o: ../functions/subject.h ../functions/template.h
config.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
config.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
config.o: ../core/htmlfilter.h ../templates/templates.h
config.o: ../templates/patterncacher.h ../templates/indexpatterns.h
config.o: ../templates/patterns.h ../templates/changepatterns.h
config.o: ../templates/htmltextstream.h ../core/sessionmanager.h
crypt.o: crypt.h run.h config.h ../../pikotools/space/spaceparser.h
crypt.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
crypt.o: htmlfilter.h user.h ../../pikotools/utf8/utf8.h log.h textstream.h
crypt.o: logmanipulators.h ../../pikotools/textstream/textstream.h
crypt.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
crypt.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
crypt.o: ../../pikotools/membuffer/membuffer.h
crypt.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
crypt.o: requesttypes.h item.h error.h ../templates/htmltextstream.h
crypt.o: ../core/textstream.h misc.h ../../pikotools/space/spacetojson.h
crypt.o: session.h plugindata.h rebus.h ipban.h mount.h ../templates/locale.h
dircontainer.o: dircontainer.h item.h ../../pikotools/space/space.h
dircontainer.o: ../../pikotools/date/date.h log.h textstream.h
dircontainer.o: logmanipulators.h ../../pikotools/textstream/textstream.h
dircontainer.o: ../../pikotools/convert/convert.h
dircontainer.o: ../../pikotools/convert/inttostr.h
dircontainer.o: ../../pikotools/membuffer/membuffer.h
dircontainer.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
dircontainer.o: requesttypes.h error.h config.h
dircontainer.o: ../../pikotools/space/spaceparser.h
dircontainer.o: ../../pikotools/space/space.h
dircontainer.o: ../../pikotools/textstream/types.h htmlfilter.h
dircontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
dircontainer.o: ../../pikotools/utf8/utf8.h
dircontainer.o: ../../pikotools/space/spacetojson.h session.h user.h
dircontainer.o: plugindata.h rebus.h ipban.h mount.h ../templates/locale.h
dirs.o: dirs.h item.h ../../pikotools/space/space.h
dirs.o: ../../pikotools/date/date.h dircontainer.h ../db/db.h ../db/dbbase.h
dirs.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
dirs.o: requesttypes.h ../../pikotools/textstream/textstream.h
dirs.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
dirs.o: ../../pikotools/membuffer/membuffer.h
dirs.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
dirs.o: ../core/error.h ../../pikotools/space/spaceparser.h
dirs.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
dirs.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
dirs.o: ../core/user.h ../core/group.h ../core/dircontainer.h
dirs.o: ../core/ugcontainer.h log.h textstream.h logmanipulators.h slog.h
dirs.o: cur.h request.h error.h config.h htmlfilter.h
dirs.o: ../templates/htmltextstream.h ../../pikotools/space/spacetojson.h
dirs.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
dirs.o: ../templates/locale.h ../notify/notify.h ../notify/notifypool.h
dirs.o: ../templates/patterns.h ../templates/locale.h
dirs.o: ../templates/localefilter.h ../../ezc/src/ezc.h
dirs.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
dirs.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
dirs.o: ../../ezc/src/stringconv.h ../notify/notifythread.h
dirs.o: ../core/basethread.h ../notify/templatesnotify.h ../core/config.h
dirs.o: ../core/users.h ugcontainer.h lastcontainer.h
groups.o: groups.h group.h ugcontainer.h ../db/db.h ../db/dbbase.h
groups.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
groups.o: item.h ../../pikotools/space/space.h ../../pikotools/date/date.h
groups.o: requesttypes.h ../../pikotools/textstream/textstream.h
groups.o: ../../pikotools/convert/convert.h
groups.o: ../../pikotools/convert/inttostr.h
groups.o: ../../pikotools/membuffer/membuffer.h
groups.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
groups.o: ../core/error.h ../../pikotools/space/spaceparser.h
groups.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
groups.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
groups.o: ../core/user.h ../core/group.h ../core/dircontainer.h
groups.o: ../core/ugcontainer.h log.h textstream.h logmanipulators.h slog.h
groups.o: cur.h request.h error.h config.h htmlfilter.h
groups.o: ../templates/htmltextstream.h ../../pikotools/space/spacetojson.h
groups.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
groups.o: ../templates/locale.h
htmlfilter.o: htmlfilter.h
httpsimpleparser.o: httpsimpleparser.h
image.o: image.h basethread.h synchro.h textstream.h ../db/db.h
image.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
image.o: ../core/textstream.h misc.h item.h ../../pikotools/space/space.h
image.o: ../../pikotools/date/date.h requesttypes.h
image.o: ../../pikotools/textstream/textstream.h
image.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
image.o: ../../pikotools/membuffer/membuffer.h
image.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
image.o: ../core/error.h ../../pikotools/space/spaceparser.h
image.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
image.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
image.o: ../core/user.h ../core/group.h ../core/dircontainer.h
image.o: ../core/ugcontainer.h log.h logmanipulators.h slog.h cur.h request.h
image.o: error.h config.h htmlfilter.h ../templates/htmltextstream.h
image.o: ../../pikotools/space/spacetojson.h session.h user.h plugindata.h
image.o: rebus.h ipban.h mount.h ../templates/locale.h ../core/config.h
image.o: system.h job.h dirs.h dircontainer.h ../notify/notify.h
image.o: ../notify/notifypool.h ../templates/patterns.h ../templates/locale.h
image.o: ../templates/localefilter.h ../../ezc/src/ezc.h
image.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
image.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
image.o: ../../ezc/src/stringconv.h ../notify/notifythread.h
image.o: ../core/basethread.h ../notify/templatesnotify.h ../core/users.h
image.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
image.o: users.h groups.h group.h loadavg.h threadmanager.h timezones.h
image.o: timezone.h plugin.h pluginmsg.h sessionmanager.h sessioncontainer.h
image.o: ipbancontainer.h ../functions/functions.h
image.o: ../functions/functionbase.h ../core/request.h ../core/system.h
image.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
image.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
image.o: ../functions/privchanger.h ../functions/chown.h
image.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
image.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
image.o: ../functions/last.h ../functions/login.h ../functions/logout.h
image.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
image.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
image.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
image.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
image.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
image.o: ../functions/specialdefault.h ../functions/stat.h
image.o: ../functions/subject.h ../functions/template.h
image.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
image.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
image.o: ../core/htmlfilter.h ../templates/templates.h
image.o: ../templates/patterncacher.h ../templates/indexpatterns.h
image.o: ../templates/patterns.h ../templates/changepatterns.h
image.o: ../templates/htmltextstream.h ../core/sessionmanager.h
ipbancontainer.o: ipbancontainer.h ipban.h log.h textstream.h
ipbancontainer.o: logmanipulators.h ../../pikotools/textstream/textstream.h
ipbancontainer.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
ipbancontainer.o: ../../pikotools/convert/convert.h
ipbancontainer.o: ../../pikotools/convert/inttostr.h
ipbancontainer.o: ../../pikotools/membuffer/membuffer.h
ipbancontainer.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
ipbancontainer.o: requesttypes.h item.h error.h config.h
ipbancontainer.o: ../../pikotools/space/spaceparser.h
ipbancontainer.o: ../../pikotools/space/space.h
ipbancontainer.o: ../../pikotools/textstream/types.h htmlfilter.h
ipbancontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
ipbancontainer.o: ../../pikotools/utf8/utf8.h
ipbancontainer.o: ../../pikotools/space/spacetojson.h session.h user.h
ipbancontainer.o: plugindata.h rebus.h mount.h ../templates/locale.h
item.o: item.h ../../pikotools/space/space.h ../../pikotools/date/date.h
item.o: misc.h requesttypes.h ../../pikotools/textstream/textstream.h
item.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
item.o: ../../pikotools/membuffer/membuffer.h
item.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
item.o: crypt.h run.h config.h ../../pikotools/space/spaceparser.h
item.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
item.o: htmlfilter.h user.h
job.o: job.h basethread.h synchro.h ../../pikotools/space/space.h plugin.h
job.o: pluginmsg.h log.h textstream.h logmanipulators.h
job.o: ../../pikotools/textstream/textstream.h ../../pikotools/date/date.h
job.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
job.o: ../../pikotools/membuffer/membuffer.h
job.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
job.o: requesttypes.h item.h error.h config.h
job.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
job.o: ../../pikotools/textstream/types.h htmlfilter.h
job.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
job.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
job.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
job.o: ../templates/locale.h system.h dirs.h dircontainer.h ../db/db.h
job.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
job.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
job.o: ../core/user.h ../core/group.h ../core/dircontainer.h
job.o: ../core/ugcontainer.h ../notify/notify.h ../notify/notifypool.h
job.o: ../templates/patterns.h ../templates/locale.h
job.o: ../templates/localefilter.h ../../ezc/src/ezc.h
job.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
job.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
job.o: ../../ezc/src/stringconv.h ../notify/notifythread.h
job.o: ../core/basethread.h ../notify/templatesnotify.h ../core/config.h
job.o: ../core/users.h ugcontainer.h lastcontainer.h mounts.h mountparser.h
job.o: crypt.h run.h users.h groups.h group.h loadavg.h image.h
job.o: threadmanager.h timezones.h timezone.h sessionmanager.h
job.o: sessioncontainer.h ipbancontainer.h ../functions/functions.h
job.o: ../functions/functionbase.h ../core/request.h ../core/system.h
job.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
job.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
job.o: ../functions/privchanger.h ../functions/chown.h
job.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
job.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
job.o: ../functions/last.h ../functions/login.h ../functions/logout.h
job.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
job.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
job.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
job.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
job.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
job.o: ../functions/specialdefault.h ../functions/stat.h
job.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
job.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
job.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
job.o: ../templates/templates.h ../templates/patterncacher.h
job.o: ../templates/indexpatterns.h ../templates/patterns.h
job.o: ../templates/changepatterns.h ../templates/htmltextstream.h
job.o: ../core/sessionmanager.h
lastcontainer.o: lastcontainer.h ../../pikotools/date/date.h log.h
lastcontainer.o: textstream.h logmanipulators.h
lastcontainer.o: ../../pikotools/textstream/textstream.h
lastcontainer.o: ../../pikotools/space/space.h
lastcontainer.o: ../../pikotools/convert/convert.h
lastcontainer.o: ../../pikotools/convert/inttostr.h
lastcontainer.o: ../../pikotools/membuffer/membuffer.h
lastcontainer.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
lastcontainer.o: requesttypes.h item.h error.h config.h
lastcontainer.o: ../../pikotools/space/spaceparser.h
lastcontainer.o: ../../pikotools/space/space.h
lastcontainer.o: ../../pikotools/textstream/types.h htmlfilter.h
lastcontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
lastcontainer.o: ../../pikotools/utf8/utf8.h
lastcontainer.o: ../../pikotools/space/spacetojson.h session.h user.h
lastcontainer.o: plugindata.h rebus.h ipban.h mount.h ../templates/locale.h
loadavg.o: loadavg.h log.h textstream.h logmanipulators.h
loadavg.o: ../../pikotools/textstream/textstream.h
loadavg.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
loadavg.o: ../../pikotools/convert/convert.h
loadavg.o: ../../pikotools/convert/inttostr.h
loadavg.o: ../../pikotools/membuffer/membuffer.h
loadavg.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
loadavg.o: requesttypes.h item.h error.h config.h
loadavg.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
loadavg.o: ../../pikotools/textstream/types.h htmlfilter.h
loadavg.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
loadavg.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
loadavg.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
loadavg.o: ../templates/locale.h
lock.o: lock.h synchro.h
log.o: log.h textstream.h logmanipulators.h
log.o: ../../pikotools/textstream/textstream.h ../../pikotools/space/space.h
log.o: ../../pikotools/date/date.h ../../pikotools/convert/convert.h
log.o: ../../pikotools/convert/inttostr.h
log.o: ../../pikotools/membuffer/membuffer.h
log.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
log.o: requesttypes.h item.h error.h config.h
log.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
log.o: ../../pikotools/textstream/types.h htmlfilter.h
log.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
log.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
log.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
log.o: ../templates/locale.h timezones.h timezone.h
misc.o: misc.h item.h ../../pikotools/space/space.h
misc.o: ../../pikotools/date/date.h requesttypes.h
misc.o: ../../pikotools/textstream/textstream.h
misc.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
misc.o: ../../pikotools/membuffer/membuffer.h
misc.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h log.h
misc.o: textstream.h logmanipulators.h slog.h cur.h request.h error.h
misc.o: config.h ../../pikotools/space/spaceparser.h
misc.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
misc.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
misc.o: ../../pikotools/space/spacetojson.h session.h user.h plugindata.h
misc.o: rebus.h ipban.h mount.h ../templates/locale.h
misc.o: ../templates/templates.h ../../ezc/src/ezc.h
misc.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
misc.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
misc.o: ../../ezc/src/stringconv.h ../templates/patterncacher.h
misc.o: ../core/item.h ../templates/indexpatterns.h ../templates/patterns.h
misc.o: ../templates/locale.h ../templates/changepatterns.h
misc.o: ../templates/htmltextstream.h ../templates/localefilter.h
misc.o: ../core/config.h ../core/cur.h ../core/system.h
misc.o: ../core/sessionmanager.h ../core/htmlfilter.h ../db/db.h
misc.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
misc.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
misc.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
mount.o: mount.h misc.h item.h ../../pikotools/space/space.h
mount.o: ../../pikotools/date/date.h requesttypes.h
mount.o: ../../pikotools/textstream/textstream.h
mount.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
mount.o: ../../pikotools/membuffer/membuffer.h
mount.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
mountparser.o: mountparser.h mount.h item.h ../../pikotools/space/space.h
mountparser.o: ../../pikotools/date/date.h dirs.h dircontainer.h ../db/db.h
mountparser.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
mountparser.o: ../core/textstream.h misc.h requesttypes.h
mountparser.o: ../../pikotools/textstream/textstream.h
mountparser.o: ../../pikotools/convert/convert.h
mountparser.o: ../../pikotools/convert/inttostr.h
mountparser.o: ../../pikotools/membuffer/membuffer.h
mountparser.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
mountparser.o: ../core/error.h ../../pikotools/space/spaceparser.h
mountparser.o: ../../pikotools/space/space.h
mountparser.o: ../../pikotools/textstream/types.h ../db/dbitemquery.h
mountparser.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h
mountparser.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
mountparser.o: log.h textstream.h logmanipulators.h slog.h cur.h request.h
mountparser.o: error.h config.h htmlfilter.h ../templates/htmltextstream.h
mountparser.o: ../../pikotools/space/spacetojson.h session.h user.h
mountparser.o: plugindata.h rebus.h ipban.h ../templates/locale.h
mountparser.o: ../notify/notify.h ../notify/notifypool.h
mountparser.o: ../templates/patterns.h ../templates/locale.h
mountparser.o: ../templates/localefilter.h ../../ezc/src/ezc.h
mountparser.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
mountparser.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
mountparser.o: ../../ezc/src/stringconv.h ../notify/notifythread.h
mountparser.o: ../core/basethread.h ../notify/templatesnotify.h
mountparser.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
mounts.o: mounts.h mount.h error.h dirs.h item.h
mounts.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
mounts.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
mounts.o: ../db/dbtextstream.h ../core/textstream.h misc.h requesttypes.h
mounts.o: ../../pikotools/textstream/textstream.h
mounts.o: ../../pikotools/convert/convert.h
mounts.o: ../../pikotools/convert/inttostr.h
mounts.o: ../../pikotools/membuffer/membuffer.h
mounts.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
mounts.o: ../core/error.h ../../pikotools/space/spaceparser.h
mounts.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
mounts.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
mounts.o: ../core/user.h ../core/group.h ../core/dircontainer.h
mounts.o: ../core/ugcontainer.h log.h textstream.h logmanipulators.h slog.h
mounts.o: cur.h request.h config.h htmlfilter.h ../templates/htmltextstream.h
mounts.o: ../../pikotools/space/spacetojson.h session.h user.h plugindata.h
mounts.o: rebus.h ipban.h ../templates/locale.h ../notify/notify.h
mounts.o: ../notify/notifypool.h ../templates/patterns.h
mounts.o: ../templates/locale.h ../templates/localefilter.h
mounts.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
mounts.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
mounts.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
mounts.o: ../notify/notifythread.h ../core/basethread.h
mounts.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
mounts.o: ugcontainer.h lastcontainer.h mountparser.h plugin.h pluginmsg.h
mounts.o: system.h job.h basethread.h synchro.h crypt.h run.h users.h
mounts.o: groups.h group.h loadavg.h image.h threadmanager.h timezones.h
mounts.o: timezone.h sessionmanager.h sessioncontainer.h ipbancontainer.h
mounts.o: ../functions/functions.h ../functions/functionbase.h
mounts.o: ../core/request.h ../core/system.h ../core/synchro.h
mounts.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
mounts.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
mounts.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
mounts.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
mounts.o: ../functions/env.h ../functions/last.h ../functions/login.h
mounts.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
mounts.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
mounts.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
mounts.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
mounts.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
mounts.o: ../functions/sort.h ../functions/specialdefault.h
mounts.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
mounts.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
mounts.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
mounts.o: ../core/htmlfilter.h ../templates/templates.h
mounts.o: ../templates/patterncacher.h ../templates/indexpatterns.h
mounts.o: ../templates/patterns.h ../templates/changepatterns.h
mounts.o: ../templates/htmltextstream.h ../core/sessionmanager.h
plugin.o: plugin.h pluginmsg.h log.h textstream.h logmanipulators.h
plugin.o: ../../pikotools/textstream/textstream.h
plugin.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
plugin.o: ../../pikotools/convert/convert.h
plugin.o: ../../pikotools/convert/inttostr.h
plugin.o: ../../pikotools/membuffer/membuffer.h
plugin.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
plugin.o: requesttypes.h item.h error.h config.h
plugin.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
plugin.o: ../../pikotools/textstream/types.h htmlfilter.h
plugin.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
plugin.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
plugin.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
plugin.o: ../templates/locale.h system.h job.h basethread.h synchro.h dirs.h
plugin.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
plugin.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
plugin.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
plugin.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
plugin.o: ../notify/notifypool.h ../templates/patterns.h
plugin.o: ../templates/locale.h ../templates/localefilter.h
plugin.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
plugin.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
plugin.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
plugin.o: ../notify/notifythread.h ../core/basethread.h
plugin.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
plugin.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
plugin.o: users.h groups.h group.h loadavg.h image.h threadmanager.h
plugin.o: timezones.h timezone.h sessionmanager.h sessioncontainer.h
plugin.o: ipbancontainer.h ../functions/functions.h
plugin.o: ../functions/functionbase.h ../core/request.h ../core/system.h
plugin.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
plugin.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
plugin.o: ../functions/privchanger.h ../functions/chown.h
plugin.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
plugin.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
plugin.o: ../functions/last.h ../functions/login.h ../functions/logout.h
plugin.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
plugin.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
plugin.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
plugin.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
plugin.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
plugin.o: ../functions/specialdefault.h ../functions/stat.h
plugin.o: ../functions/subject.h ../functions/template.h
plugin.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
plugin.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
plugin.o: ../core/htmlfilter.h ../templates/templates.h
plugin.o: ../templates/patterncacher.h ../templates/indexpatterns.h
plugin.o: ../templates/patterns.h ../templates/changepatterns.h
plugin.o: ../templates/htmltextstream.h ../core/sessionmanager.h
plugindata.o: plugindata.h plugin.h pluginmsg.h log.h textstream.h
plugindata.o: logmanipulators.h ../../pikotools/textstream/textstream.h
plugindata.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
plugindata.o: ../../pikotools/convert/convert.h
plugindata.o: ../../pikotools/convert/inttostr.h
plugindata.o: ../../pikotools/membuffer/membuffer.h
plugindata.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
plugindata.o: requesttypes.h item.h error.h config.h
plugindata.o: ../../pikotools/space/spaceparser.h
plugindata.o: ../../pikotools/space/space.h
plugindata.o: ../../pikotools/textstream/types.h htmlfilter.h
plugindata.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
plugindata.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
plugindata.o: session.h user.h rebus.h ipban.h mount.h ../templates/locale.h
plugindata.o: system.h job.h basethread.h synchro.h dirs.h dircontainer.h
plugindata.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
plugindata.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
plugindata.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
plugindata.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
plugindata.o: ../notify/notifypool.h ../templates/patterns.h
plugindata.o: ../templates/locale.h ../templates/localefilter.h
plugindata.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
plugindata.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
plugindata.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
plugindata.o: ../notify/notifythread.h ../core/basethread.h
plugindata.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
plugindata.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h
plugindata.o: run.h users.h groups.h group.h loadavg.h image.h
plugindata.o: threadmanager.h timezones.h timezone.h sessionmanager.h
plugindata.o: sessioncontainer.h ipbancontainer.h ../functions/functions.h
plugindata.o: ../functions/functionbase.h ../core/request.h ../core/system.h
plugindata.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
plugindata.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
plugindata.o: ../functions/privchanger.h ../functions/chown.h
plugindata.o: ../functions/ckeditor.h ../functions/cp.h
plugindata.o: ../functions/default.h ../functions/download.h
plugindata.o: ../functions/emacs.h ../functions/env.h ../functions/last.h
plugindata.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
plugindata.o: ../functions/ls.h ../functions/man.h ../functions/meta.h
plugindata.o: ../functions/mkdir.h ../functions/mv.h ../functions/nicedit.h
plugindata.o: ../functions/node.h ../functions/passwd.h ../functions/priv.h
plugindata.o: ../functions/pw.h ../functions/reload.h ../functions/rm.h
plugindata.o: ../functions/rmuser.h ../functions/sort.h
plugindata.o: ../functions/specialdefault.h ../functions/stat.h
plugindata.o: ../functions/subject.h ../functions/template.h
plugindata.o: ../functions/tinymce.h ../functions/uname.h
plugindata.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
plugindata.o: ../functions/vim.h ../core/htmlfilter.h
plugindata.o: ../templates/templates.h ../templates/patterncacher.h
plugindata.o: ../templates/indexpatterns.h ../templates/patterns.h
plugindata.o: ../templates/changepatterns.h ../templates/htmltextstream.h
plugindata.o: ../core/sessionmanager.h
postmultiparser.o: postmultiparser.h error.h requesttypes.h
postmultiparser.o: ../../pikotools/textstream/textstream.h
postmultiparser.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
postmultiparser.o: ../../pikotools/convert/convert.h
postmultiparser.o: ../../pikotools/convert/inttostr.h
postmultiparser.o: ../../pikotools/membuffer/membuffer.h
postmultiparser.o: ../../pikotools/textstream/types.h config.h
postmultiparser.o: ../../pikotools/space/spaceparser.h
postmultiparser.o: ../../pikotools/space/space.h
postmultiparser.o: ../../pikotools/textstream/types.h htmlfilter.h misc.h
postmultiparser.o: item.h ../../pikotools/utf8/utf8.h log.h textstream.h
postmultiparser.o: logmanipulators.h slog.h cur.h request.h
postmultiparser.o: ../templates/htmltextstream.h ../core/textstream.h
postmultiparser.o: ../../pikotools/space/spacetojson.h session.h user.h
postmultiparser.o: plugindata.h rebus.h ipban.h mount.h ../templates/locale.h
rebus.o: log.h textstream.h logmanipulators.h
rebus.o: ../../pikotools/textstream/textstream.h
rebus.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
rebus.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
rebus.o: ../../pikotools/membuffer/membuffer.h
rebus.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
rebus.o: requesttypes.h item.h error.h config.h
rebus.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
rebus.o: ../../pikotools/textstream/types.h htmlfilter.h
rebus.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
rebus.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
rebus.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
rebus.o: ../templates/locale.h
request.o: request.h requesttypes.h ../../pikotools/textstream/textstream.h
request.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
request.o: ../../pikotools/convert/convert.h
request.o: ../../pikotools/convert/inttostr.h
request.o: ../../pikotools/membuffer/membuffer.h
request.o: ../../pikotools/textstream/types.h item.h error.h config.h
request.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
request.o: ../../pikotools/textstream/types.h htmlfilter.h textstream.h
request.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
request.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
request.o: log.h logmanipulators.h slog.h cur.h session.h user.h plugindata.h
request.o: rebus.h ipban.h mount.h ../templates/locale.h plugin.h pluginmsg.h
request.o: system.h job.h basethread.h synchro.h dirs.h dircontainer.h
request.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
request.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
request.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
request.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
request.o: ../notify/notifypool.h ../templates/patterns.h
request.o: ../templates/locale.h ../templates/localefilter.h
request.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
request.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
request.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
request.o: ../notify/notifythread.h ../core/basethread.h
request.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
request.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
request.o: users.h groups.h group.h loadavg.h image.h threadmanager.h
request.o: timezones.h timezone.h sessionmanager.h sessioncontainer.h
request.o: ipbancontainer.h ../functions/functions.h
request.o: ../functions/functionbase.h ../core/request.h ../core/system.h
request.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
request.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
request.o: ../functions/privchanger.h ../functions/chown.h
request.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
request.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
request.o: ../functions/last.h ../functions/login.h ../functions/logout.h
request.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
request.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
request.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
request.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
request.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
request.o: ../functions/specialdefault.h ../functions/stat.h
request.o: ../functions/subject.h ../functions/template.h
request.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
request.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
request.o: ../core/htmlfilter.h ../templates/templates.h
request.o: ../templates/patterncacher.h ../templates/indexpatterns.h
request.o: ../templates/patterns.h ../templates/changepatterns.h
request.o: ../templates/htmltextstream.h ../core/sessionmanager.h
run.o: run.h log.h textstream.h logmanipulators.h
run.o: ../../pikotools/textstream/textstream.h ../../pikotools/space/space.h
run.o: ../../pikotools/date/date.h ../../pikotools/convert/convert.h
run.o: ../../pikotools/convert/inttostr.h
run.o: ../../pikotools/membuffer/membuffer.h
run.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
run.o: requesttypes.h item.h error.h config.h
run.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
run.o: ../../pikotools/textstream/types.h htmlfilter.h
run.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
run.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
run.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
run.o: ../templates/locale.h
session.o: session.h item.h ../../pikotools/space/space.h
session.o: ../../pikotools/date/date.h error.h user.h plugindata.h rebus.h
session.o: textstream.h ipban.h misc.h requesttypes.h
session.o: ../../pikotools/textstream/textstream.h
session.o: ../../pikotools/convert/convert.h
session.o: ../../pikotools/convert/inttostr.h
session.o: ../../pikotools/membuffer/membuffer.h
session.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
sessioncontainer.o: sessioncontainer.h session.h item.h
sessioncontainer.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
sessioncontainer.o: error.h user.h plugindata.h rebus.h textstream.h ipban.h
sessioncontainer.o: cur.h request.h requesttypes.h
sessioncontainer.o: ../../pikotools/textstream/textstream.h
sessioncontainer.o: ../../pikotools/convert/convert.h
sessioncontainer.o: ../../pikotools/convert/inttostr.h
sessioncontainer.o: ../../pikotools/membuffer/membuffer.h
sessioncontainer.o: ../../pikotools/textstream/types.h config.h
sessioncontainer.o: ../../pikotools/space/spaceparser.h
sessioncontainer.o: ../../pikotools/space/space.h
sessioncontainer.o: ../../pikotools/textstream/types.h htmlfilter.h
sessioncontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessioncontainer.o: ../../pikotools/utf8/utf8.h
sessioncontainer.o: ../../pikotools/space/spacetojson.h mount.h log.h
sessioncontainer.o: logmanipulators.h slog.h ../templates/locale.h
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h item.h
sessionmanager.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
sessionmanager.o: error.h user.h plugindata.h rebus.h textstream.h ipban.h
sessionmanager.o: cur.h request.h requesttypes.h
sessionmanager.o: ../../pikotools/textstream/textstream.h
sessionmanager.o: ../../pikotools/convert/convert.h
sessionmanager.o: ../../pikotools/convert/inttostr.h
sessionmanager.o: ../../pikotools/membuffer/membuffer.h
sessionmanager.o: ../../pikotools/textstream/types.h config.h
sessionmanager.o: ../../pikotools/space/spaceparser.h
sessionmanager.o: ../../pikotools/space/space.h
sessionmanager.o: ../../pikotools/textstream/types.h htmlfilter.h
sessionmanager.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessionmanager.o: ../../pikotools/utf8/utf8.h
sessionmanager.o: ../../pikotools/space/spacetojson.h mount.h
sessionmanager.o: ipbancontainer.h lastcontainer.h system.h job.h
sessionmanager.o: basethread.h synchro.h dirs.h dircontainer.h ../db/db.h
sessionmanager.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
sessionmanager.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
sessionmanager.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
sessionmanager.o: ../core/dircontainer.h ../core/ugcontainer.h log.h
sessionmanager.o: logmanipulators.h slog.h ../templates/locale.h
sessionmanager.o: ../notify/notify.h ../notify/notifypool.h
sessionmanager.o: ../templates/patterns.h ../templates/locale.h
sessionmanager.o: ../templates/localefilter.h ../../ezc/src/ezc.h
sessionmanager.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
sessionmanager.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
sessionmanager.o: ../../ezc/src/stringconv.h ../notify/notifythread.h
sessionmanager.o: ../core/basethread.h ../notify/templatesnotify.h
sessionmanager.o: ../core/config.h ../core/users.h ugcontainer.h mounts.h
sessionmanager.o: mountparser.h crypt.h run.h users.h groups.h group.h
sessionmanager.o: loadavg.h image.h threadmanager.h timezones.h timezone.h
sessionmanager.o: sessionparser.h plugin.h pluginmsg.h
sessionmanager.o: ../functions/functions.h ../functions/functionbase.h
sessionmanager.o: ../core/request.h ../core/system.h ../core/synchro.h
sessionmanager.o: ../functions/functionparser.h ../core/cur.h
sessionmanager.o: ../functions/adduser.h ../functions/cat.h
sessionmanager.o: ../functions/chmod.h ../functions/privchanger.h
sessionmanager.o: ../functions/chown.h ../functions/ckeditor.h
sessionmanager.o: ../functions/cp.h ../functions/default.h
sessionmanager.o: ../functions/download.h ../functions/emacs.h
sessionmanager.o: ../functions/env.h ../functions/last.h ../functions/login.h
sessionmanager.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
sessionmanager.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
sessionmanager.o: ../functions/mv.h ../functions/nicedit.h
sessionmanager.o: ../functions/node.h ../functions/passwd.h
sessionmanager.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
sessionmanager.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
sessionmanager.o: ../functions/specialdefault.h ../functions/stat.h
sessionmanager.o: ../functions/subject.h ../functions/template.h
sessionmanager.o: ../functions/tinymce.h ../functions/uname.h
sessionmanager.o: ../functions/upload.h ../functions/uptime.h
sessionmanager.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
sessionmanager.o: ../templates/templates.h ../templates/patterncacher.h
sessionmanager.o: ../templates/indexpatterns.h ../templates/patterns.h
sessionmanager.o: ../templates/changepatterns.h ../templates/htmltextstream.h
sessionmanager.o: ../core/sessionmanager.h
sessionparser.o: sessionparser.h session.h item.h
sessionparser.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
sessionparser.o: error.h user.h plugindata.h rebus.h textstream.h ipban.h
sessionparser.o: sessioncontainer.h cur.h request.h requesttypes.h
sessionparser.o: ../../pikotools/textstream/textstream.h
sessionparser.o: ../../pikotools/convert/convert.h
sessionparser.o: ../../pikotools/convert/inttostr.h
sessionparser.o: ../../pikotools/membuffer/membuffer.h
sessionparser.o: ../../pikotools/textstream/types.h config.h
sessionparser.o: ../../pikotools/space/spaceparser.h
sessionparser.o: ../../pikotools/space/space.h
sessionparser.o: ../../pikotools/textstream/types.h htmlfilter.h
sessionparser.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessionparser.o: ../../pikotools/utf8/utf8.h
sessionparser.o: ../../pikotools/space/spacetojson.h mount.h users.h log.h
sessionparser.o: logmanipulators.h slog.h ../templates/locale.h
slog.o: slog.h cur.h request.h requesttypes.h
slog.o: ../../pikotools/textstream/textstream.h ../../pikotools/space/space.h
slog.o: ../../pikotools/date/date.h ../../pikotools/convert/convert.h
slog.o: ../../pikotools/convert/inttostr.h
slog.o: ../../pikotools/membuffer/membuffer.h
slog.o: ../../pikotools/textstream/types.h item.h error.h config.h
slog.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
slog.o: ../../pikotools/textstream/types.h htmlfilter.h textstream.h
slog.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
slog.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
slog.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
slog.o: logmanipulators.h ../templates/locale.h
synchro.o: synchro.h
system.o: system.h job.h basethread.h synchro.h ../../pikotools/space/space.h
system.o: dirs.h item.h ../../pikotools/date/date.h dircontainer.h ../db/db.h
system.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
system.o: ../core/textstream.h misc.h requesttypes.h
system.o: ../../pikotools/textstream/textstream.h
system.o: ../../pikotools/convert/convert.h
system.o: ../../pikotools/convert/inttostr.h
system.o: ../../pikotools/membuffer/membuffer.h
system.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
system.o: ../core/error.h ../../pikotools/space/spaceparser.h
system.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
system.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
system.o: ../core/user.h ../core/group.h ../core/dircontainer.h
system.o: ../core/ugcontainer.h log.h textstream.h logmanipulators.h slog.h
system.o: cur.h request.h error.h config.h htmlfilter.h
system.o: ../templates/htmltextstream.h ../../pikotools/space/spacetojson.h
system.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
system.o: ../templates/locale.h ../notify/notify.h ../notify/notifypool.h
system.o: ../templates/patterns.h ../templates/locale.h
system.o: ../templates/localefilter.h ../../ezc/src/ezc.h
system.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
system.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
system.o: ../../ezc/src/stringconv.h ../notify/notifythread.h
system.o: ../core/basethread.h ../notify/templatesnotify.h ../core/config.h
system.o: ../core/users.h ugcontainer.h lastcontainer.h mounts.h
system.o: mountparser.h crypt.h run.h users.h groups.h group.h loadavg.h
system.o: image.h threadmanager.h timezones.h timezone.h
system.o: ../templates/templates.h ../templates/patterncacher.h
system.o: ../templates/indexpatterns.h ../templates/patterns.h
system.o: ../templates/changepatterns.h ../templates/htmltextstream.h
system.o: ../core/cur.h ../core/system.h ../core/sessionmanager.h
system.o: ../core/htmlfilter.h ../functions/functions.h
system.o: ../functions/functionbase.h ../core/request.h ../core/synchro.h
system.o: ../functions/functionparser.h ../functions/adduser.h
system.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
system.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
system.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
system.o: ../functions/env.h ../functions/last.h ../functions/login.h
system.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
system.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
system.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
system.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
system.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
system.o: ../functions/sort.h ../functions/specialdefault.h
system.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
system.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
system.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
system.o: plugin.h pluginmsg.h sessionmanager.h sessioncontainer.h
system.o: ipbancontainer.h
threadmanager.o: threadmanager.h basethread.h synchro.h log.h textstream.h
threadmanager.o: logmanipulators.h ../../pikotools/textstream/textstream.h
threadmanager.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
threadmanager.o: ../../pikotools/convert/convert.h
threadmanager.o: ../../pikotools/convert/inttostr.h
threadmanager.o: ../../pikotools/membuffer/membuffer.h
threadmanager.o: ../../pikotools/textstream/types.h slog.h cur.h request.h
threadmanager.o: requesttypes.h item.h error.h config.h
threadmanager.o: ../../pikotools/space/spaceparser.h
threadmanager.o: ../../pikotools/space/space.h
threadmanager.o: ../../pikotools/textstream/types.h htmlfilter.h
threadmanager.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
threadmanager.o: ../../pikotools/utf8/utf8.h
threadmanager.o: ../../pikotools/space/spacetojson.h session.h user.h
threadmanager.o: plugindata.h rebus.h ipban.h mount.h ../templates/locale.h
timezone.o: timezone.h ../../pikotools/date/date.h
timezone.o: ../../pikotools/space/space.h misc.h item.h requesttypes.h
timezone.o: ../../pikotools/textstream/textstream.h
timezone.o: ../../pikotools/convert/convert.h
timezone.o: ../../pikotools/convert/inttostr.h
timezone.o: ../../pikotools/membuffer/membuffer.h
timezone.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
timezones.o: timezones.h timezone.h ../../pikotools/date/date.h
timezones.o: ../../pikotools/space/space.h
timezones.o: ../../pikotools/space/spaceparser.h
timezones.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h
timezones.o: misc.h item.h requesttypes.h
timezones.o: ../../pikotools/textstream/textstream.h
timezones.o: ../../pikotools/convert/convert.h
timezones.o: ../../pikotools/convert/inttostr.h
timezones.o: ../../pikotools/membuffer/membuffer.h
timezones.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
timezones.o: log.h textstream.h logmanipulators.h slog.h cur.h request.h
timezones.o: error.h config.h htmlfilter.h ../templates/htmltextstream.h
timezones.o: ../core/textstream.h ../../pikotools/space/spacetojson.h
timezones.o: session.h user.h plugindata.h rebus.h ipban.h mount.h
timezones.o: ../templates/locale.h
user.o: user.h
users.o: users.h sessionmanager.h sessioncontainer.h session.h item.h
users.o: ../../pikotools/space/space.h ../../pikotools/date/date.h error.h
users.o: user.h plugindata.h rebus.h textstream.h ipban.h cur.h request.h
users.o: requesttypes.h ../../pikotools/textstream/textstream.h
users.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
users.o: ../../pikotools/membuffer/membuffer.h
users.o: ../../pikotools/textstream/types.h config.h
users.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
users.o: ../../pikotools/textstream/types.h htmlfilter.h
users.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
users.o: ../../pikotools/utf8/utf8.h ../../pikotools/space/spacetojson.h
users.o: mount.h ipbancontainer.h lastcontainer.h system.h job.h basethread.h
users.o: synchro.h dirs.h dircontainer.h ../db/db.h ../db/dbbase.h
users.o: ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
users.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
users.o: ../core/user.h ../core/group.h ../core/dircontainer.h
users.o: ../core/ugcontainer.h log.h logmanipulators.h slog.h
users.o: ../templates/locale.h ../notify/notify.h ../notify/notifypool.h
users.o: ../templates/patterns.h ../templates/locale.h
users.o: ../templates/localefilter.h ../../ezc/src/ezc.h
users.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
users.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
users.o: ../../ezc/src/stringconv.h ../notify/notifythread.h
users.o: ../core/basethread.h ../notify/templatesnotify.h ../core/config.h
users.o: ../core/users.h ugcontainer.h mounts.h mountparser.h crypt.h run.h
users.o: groups.h group.h loadavg.h image.h threadmanager.h timezones.h
users.o: timezone.h plugin.h pluginmsg.h ../functions/functions.h
users.o: ../functions/functionbase.h ../core/request.h ../core/system.h
users.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
users.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
users.o: ../functions/privchanger.h ../functions/chown.h
users.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
users.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
users.o: ../functions/last.h ../functions/login.h ../functions/logout.h
users.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
users.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
users.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
users.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
users.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
users.o: ../functions/specialdefault.h ../functions/stat.h
users.o: ../functions/subject.h ../functions/template.h
users.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
users.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
users.o: ../core/htmlfilter.h ../templates/templates.h
users.o: ../templates/patterncacher.h ../templates/indexpatterns.h
users.o: ../templates/patterns.h ../templates/changepatterns.h
users.o: ../templates/htmltextstream.h ../core/sessionmanager.h

View File

@ -1 +0,0 @@
o = acceptbaseparser.o app.o basethread.o bbcodeparser.o compress.o config.o crypt.o dircontainer.o dirs.o groups.o htmlfilter.o httpsimpleparser.o image.o ipbancontainer.o item.o job.o lastcontainer.o loadavg.o lock.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionmanager.o sessionparser.o slog.o synchro.o system.o threadmanager.o timezone.o timezones.o user.o users.o

View File

@ -1,113 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "acceptbaseparser.h"
bool AcceptBaseParser::IsWhite(int c)
{
if( c==' ' || c=='\t' )
return true;
return false;
}
void AcceptBaseParser::SkipWhite()
{
while( IsWhite(*text) )
++text;
}
void AcceptBaseParser::RemoveWhiteFromEnd(std::string & str)
{
if( str.empty() )
return;
size_t i = str.size() - 1;
for( ; i!=0 && IsWhite(str[i]) ; --i);
if( !IsWhite(str[i]) )
++i;
if( i < str.size() )
str.erase(i); // erasing until the end of the string
}
void AcceptBaseParser::ReadParameter()
{
param.clear();
SkipWhite();
while( *text!=0 && *text!=',' && *text!=';' )
{
param += *text;
++text;
}
RemoveWhiteFromEnd(param);
}
void AcceptBaseParser::ReadQ()
{
q = 1.0;
SkipWhite();
if( *text != ';' )
return;
++text; // skipping a semicolon
while( *text!=0 && *text!=',' && *text!='=' )
// skipping until ',' or '='
++text;
if( *text==0 || *text==',' )
return;
++text; // skipping '='
SkipWhite();
q = strtod(text, (char**)&text);
}
void AcceptBaseParser::SkipParam()
{
SkipWhite();
if( *text == ',' )
++text;
}
void AcceptBaseParser::Parse(const char * str)
{
text = str;
Init();
while( *text != 0 )
{
ReadParameter();
ReadQ();
SkipParam();
Param(param, q);
}
}

View File

@ -1,47 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_acceptbaseparser
#define headerfile_winix_core_acceptbaseparser
#include <string>
// sample (you must create your own class derived from this one):
// object.Parse(" text/html ; , ; q = 45, application / xhtml+xml ; q = 0.4 , application/xml ; q = 0.9 , */* ; q = 0.8 ");
class AcceptBaseParser
{
public:
void Parse(const char * str);
private:
virtual void Init() {} ;
virtual void Param(const std::string & param, double q) = 0;
bool IsWhite(int c);
void SkipWhite();
void RemoveWhiteFromEnd(std::string & str);
void ReadParameter();
void ReadQ();
void SkipParam();
const char * text;
std::string param;
double q;
};
#endif

View File

@ -1,85 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_acceptencodingparser
#define headerfile_winix_core_acceptencodingparser
#include "acceptbaseparser.h"
#include "log.h"
class AcceptEncodingParser : public AcceptBaseParser
{
public:
bool AcceptDeflate()
{
return accept_deflate;
}
bool AcceptGzip()
{
return accept_gzip;
}
void ParseAndLog(const char * str)
{
Parse(str);
if( accept_deflate || accept_gzip )
{
log << log3 << "AEP: ";
if( accept_deflate )
{
log << "accept deflate";
if( accept_gzip )
log << ", ";
}
if( accept_gzip )
log << "accept gzip";
log << logend;
}
}
private:
void Init()
{
accept_deflate = false;
accept_gzip = false;
}
void Param(const std::string & param, double q)
{
if( param=="deflate" && q!=0.0 )
{
accept_deflate = true;
}
if( param=="gzip" && q!=0.0 )
{
accept_gzip = true;
}
}
bool accept_deflate;
bool accept_gzip;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,193 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2013, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_app
#define headerfile_winix_core_app
#include <iostream>
#include <ctime>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
#include <errno.h>
#include <fcgiapp.h>
#include "config.h"
#include "system.h"
#include "mounts.h"
#include "request.h"
#include "synchro.h"
#include "sessionmanager.h"
#include "db/db.h"
#include "functions/functions.h"
#include "templates/templates.h"
#include "compress.h"
#include "postparser.h"
#include "cookieparser.h"
#include "postmultiparser.h"
#include "acceptencodingparser.h"
class App
{
public:
App();
bool InitFCGI();
bool DropPrivileges();
bool Init();
void Start();
void Close();
void LogUserGroups();
bool Demonize();
void SetStopSignal();
bool WasStopSignal();
bool Lock();
void Unlock();
void StartThreads();
void WaitForThreads();
// configuration read from a config file
Config config;
// pointers to the current request and a session
Cur cur;
// temporary one request object
// current request
Request req;
// users sessions
SessionManager session_manager;
// database
Db db;
DbConn db_conn;
/*
model
*/
// ...
System system;
// functions (ls, cat, emacs, ...)
Functions functions;
// false at the beginning
// !! moze to do loggera dac?
bool stdout_is_closed;
/*
view
*/
Templates templates;
private:
enum Header
{
h_200,
h_404,
h_403
};
PostParser post_parser;
PostMultiParser post_multi_parser;
CookieParser cookie_parser;
AcceptEncodingParser accept_encoding_parser;
Compress compress;
std::wstring clean_html, html_with_debug;
FCGX_Request fcgi_request;
int fcgi_socket;
Synchro synchro;
pthread_t signal_thread;
std::string url_to_fetch_on_exit;
std::string source_a;
std::string sendh_t, sendh_t2, sendh_t3;
std::string sendfilea, sendfile2a;
std::string send_data_buf;
PT::SpaceToJSON ajax_generic_serializer;
bool CheckAccessFromPlugins();
void ProcessRequestThrow();
void ProcessRequest();
void BaseUrlRedirect(int code, bool add_subdomain);
bool BaseUrlRedirect();
void CheckIfNeedSSLredirect();
void SetLocale();
void CheckPostRedirect();
void MakePage();
void Make();
void SaveSessionsIfNeeded(); // !! wywalic do menagera sesji??
void LogAccess();
void SendData(const BinaryPage & page, FCGX_Stream * out);
void ReadRequest();
void SendTextAnswer();
void SendBinaryAnswer();
void SendAnswer();
void PrintEnv();
void SetEnv(const char * & env, const char * name);
void ReadEnvVariables();
void ReadGetPostVars();
void CheckIE();
void CheckKonqueror();
void CheckRequestMethod();
void CheckFCGIRole();
void CheckSSL();
void SetSubdomain();
void PrepareSessionCookie();
void AddDebugInfo(std::wstring & out);
void FilterCompressSend(bool compressing, int compress_encoding, const std::wstring & source_ref);
bool SendHeadersStaticCreateResource();
void SendHeadersStatic();
void SendHeaderContentType();
void SendHeadersForbidden();
void SendHeadersRedirect();
void SendHeadersSendFile();
void SendHeadersCompression(int compress_encoding);
void SendHeadersNormal(Header header);
void SendHeaders(bool compressing, int compress_encoding, Header header);
int SelectDeflateVersion();
void SelectCompression(size_t source_len, bool & compression_allowed, int & compression_encoding);
bool CanSendContent(Header header);
void LogUser(const char * msg, uid_t id);
void LogGroup(const char * msg, gid_t id, bool put_logend = true);
void LogUsers();
void LogEffectiveGroups(std::vector<gid_t> & tab);
void LogGroups();
bool DropPrivileges(const std::string & user, uid_t uid, gid_t gid, bool additional_groups);
static void * SpecialThreadForSignals(void*);
void FetchPageOnExit();
void CreateStaticTree();
// !! dodac do session managera?
time_t last_sessions_save;
};
#endif

View File

@ -1,592 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "bbcodeparser.h"
bool BBCODEParser::Equal(const wchar_t * str1, const wchar_t * str2)
{
while( *str1 == *str2 && *str1 != 0 )
{
str1 += 1;
str2 += 1;
}
return *str1 == *str2;
}
bool BBCODEParser::IsValidCharForName(int c)
{
if( (c>='a' && c<='z') ||
(c>='A' && c<='Z') ||
c=='*' || c=='_')
return true;
return false;
}
bool BBCODEParser::IsOpeningTagMark()
{
return (*pchar == '[');
}
// there are no commentaries in bbcode
bool BBCODEParser::IsOpeningCommentaryTagMark()
{
return false;
}
bool BBCODEParser::SkipCommentaryTagIfExists()
{
return false;
}
bool BBCODEParser::IsClosingTagMark()
{
return (*pchar == ']');
}
bool BBCODEParser::IsClosingXmlSimpleTagMark()
{
return false;
}
// one enter will generate one <br>
// two enters or more will generate only two br (<br><br>)
void BBCODEParser::PutNormalText(const wchar_t * str, const wchar_t * end)
{
int br_len;
if( *pchar == 0 )
{
// trimming last white characters at end of the user text
while( str<end && (IsWhite(*(end-1)) || *(end-1)==10) )
--end;
}
while( str < end )
{
if( *str == 10 )
{
++str;
br_len = 1;
// skipping white characters without a new line character
while( str < end && IsWhite(*str) )
++str;
if( str < end && *str == 10 )
{
br_len = 2;
// skipping white characters with new line characters
while( str < end && (IsWhite(*str) || *str==10) )
++str;
}
if( !has_open_ol_tag && !has_open_ul_tag && !has_open_li_tag )
{
for(int i=0 ; i < br_len ; ++i)
(*out_string) += L"<br>\n";
}
}
else
{
PrintEscape(*str);
++str;
}
}
}
void BBCODEParser::ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white)
{
}
void BBCODEParser::CheckExceptions()
{
if( stack_len >= 2 )
{
if( pstack[stack_len-1].type == Item::opening &&
pstack[stack_len-2].type == Item::opening &&
IsNameEqual(L"*", pstack[stack_len-1].name) &&
IsNameEqual(L"*", pstack[stack_len-2].name) )
{
// removing the last [*] from the stack
// </li> was put automatically
PopStack();
}
}
}
/*
bbcode format:
[bbcodetag=value]some text[/bbcodetag]
the value can be quoted, e.g.
[bbcodetag="value"]some text[/bbcodetag], or
[bbcodetag='value']some text[/bbcodetag]
the third string below (in tags table) is 'html_argument' from Tags,
it can contain a special character % followed by a string which means:
%1 - "value" escaped as for html
%2 - "some text" escaped as for html
%u1 - "value" trimmed and escaped as for url-es
%u2 - "some text" trimmed and escaped as for url-es
%% - one %
if you are using %2 or %u2 then "some text" is not treated as bbcode, e.g.
[bbcodetag=value]some [b]text[/b][/bbcodetag] will produce:
<htmltag arg="value">some [b]text[/b]</htmltag> (the inner tags [b][/b] were not parsed)
also when using %2 or %u2 the closing bbcode tag is skipped
(if you want this tag then you can put it in 'html_argument')
and when using u (%u1 or %u2) the argument is trimmed from whitespaces and new lines
at the beginning and at the end
(because otherwise a space would be changed to %20 and this were probably not what you really wanted)
*/
const BBCODEParser::Tags * BBCODEParser::FindTag(const wchar_t * tag)
{
static Tags tags[] = {
{L"*", L"li", L">", false},
{L"b", L"em", L">", true},
{L"i", L"span", L" class=\"bbitalic\">", true},
{L"u", L"span", L" class=\"bbunderline\">", true},
{L"s", L"span", L" class=\"bbstrike\">", true},
{L"code", L"code", L" class=\"bbcode\">", false},
{L"list", L"ul", L" class=\"bblist\">", false},
{L"color", L"span", L" class=\"bbcol%1\">", true},
{L"url", L"a", L" href=\"%u1\">", true},
{L"img", L"img", L" alt=\"%1\" src=\"%u2\">", true},
{L"quote", L"div", L" class=\"bbquote\">\n<span class=\"bbquotewho\">%1</span><br>\n", false},
};
size_t i;
size_t len = sizeof(tags) / sizeof(Tags);
for(i=0 ; i<len ; ++i)
{
if( Equal(tag, tags[i].bbcode) )
return &tags[i];
}
return 0;
}
const BBCODEParser::Tags * BBCODEParser::FindTag(const std::wstring & tag)
{
return FindTag(tag.c_str());
}
void BBCODEParser::PrintArgumentCheckQuotes(const wchar_t * & start, const wchar_t * & end)
{
// skipping white characters from the argument
while( start<end && IsWhite(*start) )
++start;
// skipping first '=' character if exists
if( start<end && *start == '=' )
++start;
// skipping white characters from the argument
// at the beginning
while( start<end && IsWhite(*start) )
++start;
// and at the end
while( start<end && IsWhite(*(end-1)) )
--end;
if( start<end && (*start=='\'' || *start=='\"') )
{
++start;
if( start<end && *(start-1) == *(end-1) )
--end;
// skipping white characters after a first quote char [url = " ww...."]
while( start<end && IsWhite(*start) )
++start;
}
}
void BBCODEParser::PrintEncode(int c)
{
if( c == '&' )
{
(*out_string) += L"&amp;";
}
else
if( (c>='a' && c<='z') ||
(c>='A' && c<='Z') ||
(c>='0' && c<='9') ||
(c=='_' || c=='?' || c=='.' || c==',' || c=='/' || c=='-' ||
c=='+' || c=='*' || c=='(' || c==')' || c=='=' || c==':')
)
{
(*out_string) += c;
}
else
{
wchar_t buffer[20];
swprintf(buffer, 20, L"%02X", c);
(*out_string) += '%';
(*out_string) += buffer;
}
}
void BBCODEParser::PrintEscape(int c, bool change_quote)
{
if( c == '<' )
{
(*out_string) += L"&lt;";
}
else
if( c == '>' )
{
(*out_string) += L"&gt;";
}
else
if( c == '&' )
{
(*out_string) += L"&amp;";
}
else
if( c == '\"' && change_quote )
{
(*out_string) += L"&quot;";
}
else
{
(*out_string) += c;
}
}
void BBCODEParser::PrintArgumentEncode(const wchar_t * start, const wchar_t * end)
{
PrintArgumentCheckQuotes(start, end);
TrimWhiteWithNewLines(start, end);
for( ; start<end ; ++start )
PrintEncode(*start);
}
void BBCODEParser::PrintArgumentEscape(const wchar_t * start, const wchar_t * end)
{
PrintArgumentCheckQuotes(start, end);
for( ; start<end ; ++start )
PrintEscape(*start, true); // quotes are escaped as well here
}
void BBCODEParser::CheckOpeningTag(const Tags * tag, const wchar_t * tag_name, bool & condition)
{
if( Equal(tag->html_tag, tag_name) )
{
if( condition )
{
PutClosingTag(tag);
(*out_string) += '\n';
}
condition = true;
}
}
void BBCODEParser::CheckOpeningTag(const Tags * tag)
{
bool has_list_tag = has_open_ul_tag || has_open_ol_tag;
CheckOpeningTag(tag, L"li", has_open_li_tag);
CheckOpeningTag(tag, L"ul", has_open_ul_tag);
CheckOpeningTag(tag, L"ol", has_open_ol_tag);
if( has_open_li_tag && !has_list_tag )
{
(*out_string) += L"<ul>\n";
has_open_ul_tag = true;
}
}
void BBCODEParser::PrintEscape(const wchar_t * start, const wchar_t * end, bool change_quote)
{
for( ; start < end ; ++start)
PrintEscape(*start, change_quote);
}
void BBCODEParser::PrintEncode(const wchar_t * start, const wchar_t * end)
{
for( ; start < end ; ++start)
PrintEncode(*start);
}
void BBCODEParser::PutOpeningTagFromEzc()
{
// this can be a tag from Ezc templates system
(*out_string) += '[';
(*out_string) += LastItem().name;
const wchar_t * start = pchar;
while( *pchar && *pchar!=']' )
++pchar;
if( *pchar == ']' )
++pchar;
Put(start, pchar);
}
void BBCODEParser::PutHtmlArgument1(const wchar_t * arg_start, const wchar_t * arg_end, bool has_u)
{
if( has_u )
PrintArgumentEncode(arg_start, arg_end);
else
PrintArgumentEscape(arg_start, arg_end);
}
void BBCODEParser::TrimWhiteWithNewLines(const wchar_t * & start, const wchar_t * & end)
{
while( start < end && (IsWhite(*start) || *start==10) )
++start;
while( start < end && (IsWhite(*(end-1)) || *(end-1)==10) )
--end;
}
void BBCODEParser::PutHtmlArgument2(const Tags * tag, bool has_u)
{
const wchar_t * start = pchar;
const wchar_t * end = pchar;
bool first_tag_removed = false;
while( *pchar != 0 )
{
if( IsOpeningTagMark() )
{
if( IsClosingTagForLastItem() )
{
// the last tag is skipped when using patterns with %2 or %u2
PopStack(); // removing opening tag from the stack
first_tag_removed = true;
break;
}
}
else
{
pchar += 1;
end = pchar;
}
}
if( !first_tag_removed )
PopStack(); // user has forgotten to close the tag
if( has_u )
{
TrimWhiteWithNewLines(start, end);
PrintEncode(start, end);
}
else
{
PrintEscape(start, end);
}
}
void BBCODEParser::PutHtmlArgument(const Tags * tag, const wchar_t * arg_start, const wchar_t * arg_end)
{
const wchar_t * pattern = tag->html_argument;
bool has_u;
while( *pattern )
{
if( *pattern == '%' )
{
++pattern;
has_u = false;
if( *pattern == 'u' )
{
++pattern;
has_u = true;
}
if( *pattern == '1' )
{
++pattern;
PutHtmlArgument1(arg_start, arg_end, has_u);
}
else
if( *pattern == '2' )
{
++pattern;
PutHtmlArgument2(tag, has_u);
}
else
if( *pattern == '%' )
{
(*out_string) += '%';
++pattern;
}
// else unrecognized, will be printed next time as a normal character
}
else
{
(*out_string) += *pattern;
++pattern;
}
}
}
void BBCODEParser::PutOpeningTagFromBBCode(const Tags * tag)
{
CheckOpeningTag(tag);
PutOpeningTagMark();
Put(tag->html_tag);
const wchar_t * start = pchar;
while( *pchar && *pchar != ']' )
++pchar;
PutHtmlArgument(tag, start, pchar);
if( *pchar == ']' )
++pchar;
if( !tag->inline_tag )
{
Put(10);
SkipWhiteLines();
}
}
bool BBCODEParser::PutOpeningTag()
{
const Tags * tag = FindTag(LastItem().name);
if( !tag )
PutOpeningTagFromEzc();
else
PutOpeningTagFromBBCode(tag);
return false;
}
void BBCODEParser::PutClosingTag(const Tags * tag)
{
if( !tag )
return; // skipping the tag
PutOpeningTagMark();
(*out_string) += '/';
(*out_string) += tag->html_tag;
PutClosingTagMark();
if( !tag->inline_tag )
{
(*out_string) += L"\n";
SkipWhiteLines();
}
if( Equal(tag->html_tag, L"li") )
has_open_li_tag = false;
if( Equal(tag->html_tag, L"ol") )
has_open_ol_tag = false;
if( Equal(tag->html_tag, L"ul") )
has_open_ul_tag = false;
}
void BBCODEParser::PutClosingTag(const wchar_t * tag_name)
{
const Tags * tag = FindTag(tag_name);
PutClosingTag(tag);
}
void BBCODEParser::Init()
{
has_open_li_tag = false;
has_open_ol_tag = false;
has_open_ul_tag = false;
SkipWhiteLines();
}
void BBCODEParser::Uninit()
{
if( has_open_li_tag )
(*out_string) += L"</li>\n";
if( has_open_ol_tag )
(*out_string) += L"</ol>\n";
if( has_open_ul_tag )
(*out_string) += L"</ul>\n";
}

View File

@ -1,93 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_bbcodeparser
#define headerfile_winix_core_bbcodeparser
#include "htmlfilter.h"
class BBCODEParser : public HTMLFilter
{
struct Tags
{
const wchar_t * bbcode;
const wchar_t * html_tag;
const wchar_t * html_argument; // with closing '>'
bool inline_tag;
};
/*
virtual methods
(from HTMLFilter class)
*/
virtual void Init();
virtual void Uninit();
virtual bool IsOpeningTagMark();
virtual bool IsOpeningCommentaryTagMark();
virtual bool IsClosingTagMark();
virtual bool IsClosingXmlSimpleTagMark();
virtual bool IsValidCharForName(int c);
virtual void CheckExceptions();
virtual bool SkipCommentaryTagIfExists();
virtual bool PutOpeningTag();
virtual void PutClosingTag(const wchar_t * tag);
virtual void PutNormalText(const wchar_t * str, const wchar_t * end);
virtual void ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white);
/*
others
*/
bool Equal(const wchar_t * str1, const wchar_t * str2);
void PutHtmlArgument1(const wchar_t * arg_start, const wchar_t * arg_end, bool has_u);
void PutHtmlArgument2(const Tags * tag, bool has_u);
void PutHtmlArgument(const Tags * tag, const wchar_t * arg_start, const wchar_t * arg_end);
void PutOpeningTagFromEzc();
void PutOpeningTagFromBBCode(const Tags * tag);
const Tags * FindTag(const wchar_t * tag);
const Tags * FindTag(const std::wstring & tag);
void PrintArgumentCheckQuotes(const wchar_t * & start, const wchar_t * & end);
void PrintEscape(int c, bool change_quote = false);
void PrintEncode(int c);
void PrintEscape(const wchar_t * start, const wchar_t * end, bool change_quote = false);
void PrintEncode(const wchar_t * start, const wchar_t * end);
void PrintArgumentEncode(const wchar_t * start, const wchar_t * end);
void PrintArgumentEscape(const wchar_t * start, const wchar_t * end);
void PutClosingTag(const Tags * tag);
void CheckOpeningTag(const Tags * tag, const wchar_t * tag_name, bool & condition);
void CheckOpeningTag(const Tags * tag);
void TrimWhiteWithNewLines(const wchar_t * & start, const wchar_t * & end);
bool has_open_ol_tag; // has open html <ol> tag
bool has_open_ul_tag; // has open html <ul> tag
bool has_open_li_tag; // has open html <li> tag
};
#endif

View File

@ -1,70 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_compress
#define headerfile_winix_core_compress
#include <cstring>
#include <fcgiapp.h>
#include <zlib.h>
#include "requesttypes.h"
class Compress
{
public:
Compress();
~Compress();
int Init(int compress_level_ = 6);
/*
encoding:
0 - raw deflate data with no zlib header or trailer, and will not compute an adler32 check value
(for Internet Explorer)
1 - deflate
2 - gzip
*/
int CompressAndPut(const char * source, size_t source_len, FCGX_Stream * out_stream, int encoding = 2);
int Compressing(const BinaryPage & in, BinaryPage & out, int encoding = 2);
private:
bool AllocateMemory();
bool InitRawDeflate();
bool InitDeflate();
bool InitGzip();
int MakeCompress(z_stream & strm, const char * source, size_t source_len, FCGX_Stream * out_stream, int encoding);
int MakeCompress(z_stream & strm, const BinaryPage & page, BinaryPage & out, int encoding);
z_stream * SelectStream(int encoding);
void ResetStream(z_stream * pstrm, int encoding);
void PutLog(size_t source_len, int encoding);
void CopyToInputBuffer(BinaryPage::const_iterator & i, size_t len);
int compress_level;
size_t buffer_max_len;
// size of the last compressed page
size_t last_out_size;
char * buffer_in;
char * buffer_out;
z_stream strm_raw_deflate, strm_deflate, strm_gzip;
bool raw_deflate_inited, deflate_inited, gzip_inited;
bool ready_for_compress;
};
#endif

View File

@ -1,447 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2013, Tomasz Sowa
* All rights reserved.
*
*/
#include "config.h"
#include "log.h"
#include "plugin.h"
#include "misc.h"
#include "crypt.h"
Config::Config()
{
errors_to_stdout = true;
}
//!! czy tu w ogole mozemy uzywac log << ?
//!! przeciez jeszcze nie zostal przetworzony plik konfiguracyjny
void Config::ShowError()
{
switch( parser.status )
{
case PT::SpaceParser::no_space:
log << log2 << "Config: space not set" << logend;
break;
case PT::SpaceParser::ok:
log << log2 << "Config: syntax ok" << logend;
break;
case PT::SpaceParser::cant_open_file:
if( errors_to_stdout )
std::cout << "Config: cant open a config file: " << config_file << std::endl;
log << log1 << "Config: cant open a config file: " << config_file << logend;
break;
case PT::SpaceParser::syntax_error:
if( errors_to_stdout )
std::cout << "Config: syntax error, line: " << parser.line << std::endl;
log << log1 << "Config: syntax error, line: " << parser.line << logend;
break;
}
}
bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
{
errors_to_stdout = errors_to_stdout_;
if( config_file.empty() )
{
log << log2 << "Config: name of the config file is empty" << logend;
return false;
}
log << log2 << "Config: reading a config file" << logend;
parser.SplitSingle(true);
parser.UTF8(true); // config is always read in UTF-8
parser.SetSpace(space);
PT::SpaceParser::Status status = parser.Parse(config_file);
if( status == PT::SpaceParser::ok )
{
AssignValues(stdout_is_closed);
SetAdditionalVariables();
return true;
}
else
{
ShowError();
return false;
}
}
void Config::AssignValues(bool stdout_is_closed)
{
demonize = Bool(L"demonize", 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_time_zone_id = Size(L"log_time_zone_id", 34);
log_server_answer = Bool(L"log_server_answer", 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
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);
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");
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");
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");
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_only_for_logged_users = Bool(L"use_ssl_only_for_logged_users", true);
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_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 --");
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);
compression = Bool(L"compression", true);
compression_page_min_size = Size(L"compression_page_min_size", 512);
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_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_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" / ");
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_skip_root = Bool(L"editors_html_safe_mode_skip_root", true);
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);
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");
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);
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);
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_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");
use_ban_list = Bool(L"use_ban_list", true);
ban_list_soft_max_size = Size(L"ban_list_soft_max_size", 50000);
ban_list_max_size = Size(L"ban_list_max_size", 51000);
ban_level_1_delay = Size(L"ban_level_1_delay", 1800);
ban_level_2_delay = Size(L"ban_level_2_delay", 86400);
ban_level_3_delay = Size(L"ban_level_3_delay", 604800);
incorrect_login_min_time_between_get_post = Size(L"incorrect_login_min_time_between_get_post", 2);
incorrect_login_captcha_treshold = Size(L"incorrect_login_captcha_treshold", 3);
incorrect_login_cannot_login_mode = Int(L"incorrect_login_cannot_login_mode", 0);
incorrect_login_cannot_login_treshold = Size(L"incorrect_login_cannot_login_treshold", 20);
incorrect_login_cannot_login_delay = Size(L"incorrect_login_cannot_login_delay", 1800);
}
void Config::SetAdditionalVariables()
{
if( html_filter_orphans_mode_str == L"160" )
html_filter_orphans_mode = HTMLFilter::orphan_160space;
else
html_filter_orphans_mode = HTMLFilter::orphan_nbsp;
for(size_t i=0 ; i<static_dirs.size() ; ++i)
NoLastSlash(static_dirs[i]);
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;
if( locale_files.empty() )
locale_files.push_back(L"en");
}
void Config::CheckPasswd()
{
switch(pass_type)
{
case WINIX_CRYPT_HASH_NONE:
case WINIX_CRYPT_HASH_MD4:
case WINIX_CRYPT_HASH_MD5:
case WINIX_CRYPT_HASH_SHA1:
case WINIX_CRYPT_HASH_SHA224:
case WINIX_CRYPT_HASH_SHA256:
case WINIX_CRYPT_HASH_SHA384:
case WINIX_CRYPT_HASH_SHA512:
break;
default:
pass_type = WINIX_CRYPT_HASH_SHA256;
}
}
std::wstring & Config::Text(const wchar_t * name)
{
return space.Text(name);
}
std::wstring & Config::Text(const wchar_t * name, const wchar_t * def)
{
return space.Text(name, def);
}
std::wstring & Config::Text(const std::wstring & name, const wchar_t * def)
{
return space.Text(name, def);
}
std::string & Config::AText(const wchar_t * name)
{
return space.AText(name);
}
std::string & Config::AText(const wchar_t * name, const char * def)
{
return space.AText(name, def);
}
std::string & Config::AText(const std::wstring & name, const char * def)
{
return space.AText(name, def);
}
int Config::Int(const wchar_t * name)
{
return space.Int(name);
}
int Config::Int(const wchar_t * name, int def)
{
return space.Int(name, def);
}
int Config::Int(const std::wstring & name, int def)
{
return space.Int(name, def);
}
long Config::Long(const wchar_t * name)
{
return space.Long(name);
}
long Config::Long(const wchar_t * name, long def)
{
return space.Long(name, def);
}
long Config::Long(const std::wstring & name, long def)
{
return space.Long(name, def);
}
size_t Config::Size(const wchar_t * name)
{
return space.Size(name);
}
size_t Config::Size(const wchar_t * name, size_t def)
{
return space.Size(name, def);
}
size_t Config::Size(const std::wstring & name, size_t def)
{
return space.Size(name, def);
}
bool Config::Bool(const wchar_t * name)
{
return space.Bool(name);
}
bool Config::Bool(const wchar_t * name, bool def)
{
return space.Bool(name, def);
}
bool Config::Bool(const std::wstring & name, bool def)
{
return space.Bool(name, def);
}
bool Config::ListText(const wchar_t * name, std::vector<std::wstring> & list)
{
return space.ListText(name, list);
}
bool Config::ListText(const std::wstring & name, std::vector<std::wstring> & list)
{
return space.ListText(name, list);
}
void Config::Print(std::wostream & out)
{
space.Serialize(out);
}

View File

@ -1,644 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2013, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_config
#define headerfile_winix_core_config
#include <string>
#include "space/spaceparser.h"
#include "htmlfilter.h"
class Config
{
public:
// name of the config file
// this is the parameter passed to winix programm
std::string config_file;
// start as a demon (in the background)
// default: true
bool demonize;
// system user name (to which drop privileges)
// used only if winix is started as the root
std::string user;
// system group name (to which drop privileges)
// used only if winix is started as the root
std::string group;
// setting additional effective groups from /etc/group
// by using initgroups()
// used only if winix is started as the root
// default: true
bool additional_groups;
// log file name, log file name for notifications (sending emails, etc)
std::string log_file, log_notify_file;
// 1 - minimum
// 2 - (default)
// 3 - maximum - all logs
int log_level;
// logging to stdout too
// only if demonize is 'false'
// default: false
bool log_stdout;
// how many requests should be saved in the same time
// default: 1
int log_request;
// whether to save each line of the config (use it for debug purposes)
// default: false
bool log_save_each_line;
// time zone identifier used in log messages
// this affects only the first line of logs (where there is IP address, request method etc)
// see time_zone_default_id below for more info
// default: 34 (Coordinated Universal Time UTC+00:00)
size_t log_time_zone_id;
// put to log what server is sending back to the client (html/json etc)
// default: false
bool log_server_answer;
// logging db queries
// default: false
bool log_db_query;
// logging when a plugin function is called
// default: false
bool log_plugin_call;
// how many characters in values should be logged from POST parameters
// default: 80
// set to 0 to turn off
size_t log_post_value_size;
// request delimiter in the log file, default "---------"
std::wstring log_delimiter;
// 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;
std::wstring templates_dir;
std::wstring templates_dir_default; // html templates from winix
std::wstring txt_templates_dir;
std::wstring txt_templates_dir_default; // txt (notifications) templates from winix
// prefix and postfix for functions templates
// default:
// prefix: "fun_"
// postfix: ".html"
std::wstring templates_fun_prefix;
std::wstring templates_fun_postfix;
// main html template
// default: index.html
std::wstring templates_index;
// if true then only root can use 'template' function
// default: false
bool template_only_root_use_template_fun;
std::string db_database;
std::string db_user;
std::string db_pass;
std::string http_session_id_name;
// string used in a place where is a user (or group) selected
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;
// time in seconds when the user will be automatically logged out (when he selected 'remember me' option)
// this time is usually greater than session_max_idle
int session_remember_max_idle;
// this file is used when the program is starting and ending
std::string session_file;
// how many sessions can be (zero turn off this checking)
// default: 1000000 (one milion)
size_t session_max;
// allow the html output to be compressed
// default: true
bool compression;
// if the output is shorter than this value then it will not be compressed
// default: 512 bytes
size_t compression_page_min_size;
// 1 - use deflate if available (or raw deflate for Internet Explorer) or don't compress
// 2 - use gzip if available or don't compress
// 10 - prefer deflate -- use deflate (or raw deflate for IE) if both deflate and gzip are available
// 20 - prefer gzip -- use gzip if both deflate and gzip are available
// default: 20
int compression_encoding;
// plugins directory
// default: /usr/local/winix/plugins
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::wstring> plugin_file;
// should the html code be cleaned by the html filter
bool html_filter;
// should white characters be trimmed
bool html_filter_trim_white;
// when long words should be broken (a space will be inserted)
// default: after 60 non white characters will be put a space
// set zero to turn off
size_t html_filter_break_word;
// when long lines should be broken (a new line character will be inserted)
// default: 80
// set zero to turn off
size_t html_filter_wrap_line;
// how many spaces will be put at one tree level
// default: 2
size_t html_filter_tabs;
// use checking for 'orphans' for a specicic language
// default: true
bool html_filter_orphans;
// orphans mode
// either: "nbsp" or "160"
// default: "nbsp"
std::wstring html_filter_orphans_mode_str;
HTMLFilter::OrphanMode html_filter_orphans_mode;
// the url of a new empty item (if there is not the subject too)
std::wstring item_url_empty;
// maximum length of a file send by post multipart form
// 0 - not used
size_t post_file_max;
// directory for static files
std::wstring upload_dir;
// additional static directories *not* managed by winix
// you can refer to this directories by using 'static' mount point
// e.g.
// let we say in the config you have:
// static_dirs = ("/home/a", "/home/b", "/home/c")
// and in /etc/fstab (in winix) you have such a line:
// "static /my/dir simplefs static(2)"
// above line in /etc/fstab means that when a user enters http://domain.com/my/dir/file.txt
// then "file.txt" will be taken from "/home/c/file.txt"
// this is useful for some javascript files which are protected from running from other domains
std::vector<std::wstring> static_dirs;
// sometimes you can have trouble when you have set an incorrect static path in /etc/fstab
// in such a case set dont_use_static_dirs to true
// and winix will behave as there are not any static directories
// so you can correct your mistake and then set this value to false
bool dont_use_static_dirs;
// static common directory
// this is a place where there are some common javascripts, images, css files
// winix is allowed to read some files from there
// for example ckeditor config, vim config and so on
// winix read it as a ezc template and put it into database
// default: empty
std::wstring common_dir;
// chmod of newly created directories (under upload_dir)
// default: 0750
int upload_dirs_chmod;
// chmod of newly created files (under upload_dir)
// default: 0640
int upload_files_chmod;
// create a thumbnail from an image
// default: true
bool create_thumb;
// the mode of creating a thumbnail
// width means thumb_cx, height means thumb_cy
// 1: Width given, height automagically selected to preserve aspect ratio.
// 2: Height given, width automagically selected to preserve aspect ratio.
// 3: Maximum values of height and width given, aspect ratio preserved.
// 4: Minimum values of width and height given, aspect ratio preserved.
// 5: Width and height emphatically given, original aspect ratio ignored.
// 6: Change as per widthxheight (3) but only if an image dimension exceeds a specified dimension.
// 7: Change dimensions only if both image dimensions are less than specified dimensions.
// default: 2
int thumb_mode;
// width of thumbnails
// default: 150
size_t thumb_cx;
// height of thumbnails
// default: 150
size_t thumb_cy;
// quality of thumbnails
// from 0 (the worst) to 100 (the best)
// more info: http://www.imagemagick.org/script/command-line-options.php?ImageMagick=p4jtel7557hovd34ui3tgb54h6#quality
// default: 92
int thumb_quality;
// resizing images
// this not affects thumbnails
// default: true
bool image_resize;
// the mode of resizing an image
// the same as 'thumb_mode' above
// default: 6
int image_mode;
// width of images
// default: 1000
size_t image_cx;
// height of images
// default: 800
size_t image_cy;
// quality of an image (the same as in thumbnails)
// from 0 (the worst) to 100 (the best)
// default: 92
int image_quality;
// the convert program (ImageMagic) (for images and thumbnails)
// default: /usr/local/bin/convert
std::wstring convert_cmd;
// directory with locale files
std::wstring locale_dir;
// directory with default locale files (those from winix)
std::wstring locale_dir_default;
// locale files (e.g. "en", "pl")
// default: only one item: en
std::vector<std::wstring> locale_files;
// 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
size_t locale_max_id;
// locale for not logged users
// or for newly created accounts
// default: 0
size_t locale_default_id;
// url protocol
// default: http://
std::wstring url_proto;
// url protocol when using SSL
// default: https://
std::wstring url_ssl_proto;
// enables SSL
// it means this site should be accessed through SSL encrypted connection
// default: false
bool use_ssl;
// enables SSL for static content
// used mainly in templates, look at doc_base_url_static ezc function
// default: false
bool use_ssl_static;
// enables SSL for common content
// used mainly in templates, look at doc_base_url_common ezc function
// default: false
bool use_ssl_common;
// if SSL is enabled then if this is true the SSL will be used
// only for logged users
// default: true
bool use_ssl_only_for_logged_users;
// if current connection is without SSL and should be made through SSL
// or if is via SSL and should be done in plain text
// then we make a redirect
// default: 303
int use_ssl_redirect_code;
// when the HOST_HTTP environment variable is not equal to '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.
// set this option to false if you have multiple subdomains
// default: false
bool base_url_redirect;
// the HTTP code used during the base redirect
// default: 301
int base_url_redirect_code;
// the main address of the site (e.g. www.someserver.com)
// (without http:// prefix)
std::wstring base_url;
// static content not authorized by winix
// (e.g. static.someserver.com)
std::wstring base_url_static;
// additional static server for common content (not authorized)
// (e.g. common.someserver.com)
std::wstring base_url_common;
// separator used in <title> html tag
std::wstring title_separator;
// http header recognized by www server as a file to send back
// default: X-LIGHTTPD-send-file
std::wstring http_header_send_file;
// prints additional information (in the end of the html page as a commentary)
bool debug_info;
// in editors (emacs, ckeditor,...) the html will be filtered and unsafe tags
// will be dropped (script, frame, etc.)
// default: true;
bool editors_html_safe_mode;
// don't filter the html code for root
// default: true
// (if true the html code for root is not filtered)
bool editors_html_safe_mode_skip_root;
// charset used in templates, locales, logs etc.
// default: true (UTF-8)
// if false it means 8-bit ASCII
bool utf8;
// how many maximum symlinks can be followed
// (symlinks on directories as well)
// default: 20
size_t symlinks_follow_max;
// the prefix of a name of html form controls used in the ticket plugin
// default: ticketparam
std::wstring ticket_form_prefix;
// the minimal size of a user's password
// default: 5
size_t pass_min_size;
// how passwords should be stored
// 0 - plain text
// 1 - md4 hash
// 2 - md5 hash
// 10 - sha1 hash
// 11 - sha224 hash
// 12 - sha256 hash (default)
// 13 - sha384 hash
// 14 - sha512 hash
int pass_type;
// whether the passwords' hashes should be salted or not
// this affects newly created accounts
// default: false
bool pass_hash_use_salt;
// salt to a password's hash
// default empty
// !! once you set this salt don't change it any more (people wouldn't be allowed to login)
std::wstring pass_hash_salt;
// whether the passwords' hashes should be encrypted
// this affects newly created accounts
// default: false
bool pass_use_rsa;
// path to a RSA private key
// this is actually private + public key in one file
// generated by "openssl genrsa"
// default empty which means encryption will not be used
// !! once you set these keys don't change it any more (people wouldn't be allowed to login)
std::wstring pass_rsa_private_key;
// path to 'openssl'
// default: /usr/bin/openssl
std::wstring opensll_path;
// setting when we should delete patterns (EZC patterns)
// we are deleting when we have more (or equal) patterns than 'when_delete'
// and then we are deleting 'how_many_del' patterns
// those patterns comes from items (pages) with executable bit set
size_t pattern_cacher_when_delete;
size_t pattern_cacher_how_many_delete;
// header "Content-Type" send to the client
// 0 - text/html - for HTML
// 1 - application/xhtml+xml - for XHTML 1.0
// 2 - application/xml - for XHTML 1.0 or for XHTML 1.1
// default: 0
// if utf8 is true then "; charset=UTF-8" will also be appended
int content_type_header;
// global umask
// it is used when an user doesn't have your own umask or for guests (not logged users)
// default: 0222
int umask;
// maximum number for elements through the whole template
// default: 50000
size_t ezc_max_elements;
// maximum number of each [for] loop
// default: 5000 (from ezc generator)
size_t ezc_max_loop_elements;
// when true then when a user want to create a new account
// he has to provide his email and a message will be sent back to him
// with a link to activate the account
// default: true
bool account_need_email_verification;
// when a user forgot his password we are able to send an email to him
// with a link to the page where there is a html form for setting a new password
// this option tells how long (in seconds) the link is valid
// default: 86400 (24 hours)
long reset_password_code_expiration_time;
// 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)
size_t time_zone_default_id;
// a maximum value of a time zone identifier
// time zones with an id greater than this will be skipped
// default: 130 (maximum: 1000)
size_t time_zone_max_id;
// a directory in which there are some config files
// used mainly when winix starts
// default: empty (means not for using)
std::wstring etc_dir;
// a file in etc_dir with time zones info
// default: time_zones.conf
// this is a Space structure with all time zones
// with following format:
// "tz_-12:00" ( # the name of a space is also a key to the locale files
// tz_offset_str = "-12:00" # a string representing the offset from UTC in a format: [+|-]HH:MM
// tz_has_dst = "false" # whether the time zone has daylight saving time (bool)
// tz_dst_offset = "" # offset of the daylight saving time
// tz_dst_start = "" # when the daylight saving time starts, format: MM:DD HH:MM:SS
// tz_dst_end = "") # when the daylight saving time ends, format: MM:DD HH:MM:SS
// each time zone is in a seperate space
std::wstring time_zones_file;
// turn on the IP ban mechanizm
// we have got three levels of bans (level 1, level 2, and the highest level 3)
// default: true
bool use_ban_list;
// the so called 'soft' max size
// read below description for explanation
// this is introduced to avoid deleting only one record from the ban list
// default: 50000
size_t ban_list_soft_max_size;
// this is the 'hard' max size of an IP's ban list
// if there are more records than this value
// then some of them will be removed (until the size will be ban_list_soft_max_size equal)
// this value should be a little larger from ban_list_soft_max_size
// default: 51000
size_t ban_list_max_size;
// delay in seconds of the first level ban
// default: 1800 (30 minutes)
// it means withing the next 30 minutes you see only 'you are banned...' message on your webbrowser
size_t ban_level_1_delay;
// delay in seconds of the second level ban
// default: 86400 (24 hours)
size_t ban_level_2_delay;
// delay in seconds of the third level ban
// default: 604800 (7 days)
size_t ban_level_3_delay;
// the minimum time in seconds which has to pass between the first GET request
// (showing your the login form) and the second POST request (which sends the
// login and password to the server)
// if the time is shorter then the login attempt is treated as incorrect
// (the same as if you provide incorrect user/password)
// default: 2
size_t incorrect_login_min_time_between_get_post;
// how many incorrect logins there must have been passed to display a captcha
// next to the login form
// default: 3
size_t incorrect_login_captcha_treshold;
// the way how we prevent to login if there are too many incorrect login attempts
// 0 - 'block logging' - do not show the login form in 'login' winix function
// (instead a warning message will be printed)
// 1 - add to ban list (warning: people from this IP will not be able to see your site and do anything)
// default: 0
int incorrect_login_cannot_login_mode;
// after how many incorrect login attempts we do the incorrect_login_cannot_login_mode action
// default: 20
size_t incorrect_login_cannot_login_treshold;
// used when incorrect_login_cannot_login_mode is zero
// it is the time which should be passed to allow logging
// default: 1800 (30 minutes)
// if incorrect_login_cannot_login_mode is one then ban_level_X_delay times
// will be taken accordingly
size_t incorrect_login_cannot_login_delay;
Config();
bool ReadConfig(bool errors_to_stdout_, bool stdout_is_closed = true);
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 wchar_t * def);
std::string & AText(const wchar_t * name);
std::string & AText(const wchar_t * name, const char * def);
std::string & AText(const std::wstring & name, const char * def);
int Int(const wchar_t *);
int Int(const wchar_t * name, int def);
int Int(const std::wstring & name, int def);
long Long(const wchar_t *);
long Long(const wchar_t * name, long def);
long Long(const std::wstring & name, long 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);
bool ListText(const wchar_t * name, std::vector<std::wstring> & list);
bool ListText(const std::wstring & name, std::vector<std::wstring> & list);
// for debug
void Print(std::wostream & out);
// raw access to the config
PT::Space space;
private:
PT::SpaceParser parser;
std::string default_str;
bool errors_to_stdout;
void ShowError();
void AssignValues(bool stdout_is_closed);
void SetAdditionalVariables();
void CheckPasswd();
};
#endif

View File

@ -1,83 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_cookieparser
#define headerfile_winix_core_cookieparser
#include <fcgiapp.h>
#include "httpsimpleparser.h"
#include "requesttypes.h"
#include "log.h"
class CookieParser : public HttpSimpleParser
{
const char * cookie_string;
CookieTab * cookie_tab;
protected:
virtual int GetChar()
{
if( !cookie_string || *cookie_string == 0 )
return -1;
return (int)(unsigned char)*(cookie_string++);
}
virtual void Parameter(std::string & name, std::string & value)
{
// Cookie names are case insensitive according to section 3.1 of RFC 2965
ToLower(name);
std::pair<CookieTab::iterator, bool> res = cookie_tab->insert( std::make_pair(name, value) );
log << log2 << "Cookie, name: \"" << name << "\", value: \"" << value << "\"";
if( res.second == false )
{
res.first->second = value;
log << " (overwritten)";
}
log << logend;
}
public:
CookieParser()
{
HttpSimpleParser::separator = ';';
HttpSimpleParser::value_can_be_quoted = true;
HttpSimpleParser::skip_white_chars = true;
HttpSimpleParser::recognize_special_chars = false;
}
// cookie_string can be null
void Parse(const char * cookie_string_, CookieTab & cookie_tab_)
{
cookie_string = cookie_string_;
cookie_tab = &cookie_tab_;
HttpSimpleParser::Parse();
}
};
#endif

View File

@ -1,36 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_cur
#define headerfile_winix_core_cur
#include "request.h"
#include "session.h"
#include "mount.h"
/*
current request and session
*/
struct Cur
{
Request * request;
Session * session;
Mount * mount;
// those pointers are never null, if there is no a session for the user
// the 'session' pointer pointers at a special temporary session
};
#endif

View File

@ -1,95 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_dircontainer
#define headerfile_winix_core_dircontainer
#include <list>
#include <map>
#include "item.h"
class DirContainer
{
public:
typedef std::list<Item> Table;
typedef Table::iterator Iterator;
typedef Table::size_type SizeType;
typedef std::map<long, Iterator> TableId;
typedef std::multimap<long, Iterator> TableParent;
typedef TableParent::iterator ParentIterator;
typedef TableParent::size_type ParentSizeType;
DirContainer();
Iterator GetRoot();
Iterator GetEtc();
Iterator GetVar();
Iterator Begin();
Iterator End();
SizeType Size();
bool Empty();
Iterator PushBack(const Item & item);
bool ChangeParent(long dir_id, long new_parent_id);
void Clear();
Iterator FindId(long id);
bool DelById(long id);
ParentIterator ParentBegin(); // IMPROVE ME: may it should be renamed to ChildBegin() similarly as FindFirstChild() ?
ParentIterator ParentEnd();
ParentSizeType ParentSize();
bool ParentEmpty();
ParentIterator FindFirstChild(long parent);
ParentIterator NextChild(ParentIterator pi);
bool IsNameOfSpecialFolder(const std::wstring & name);
void FindSpecialFolders();
private:
void CheckSpecialFolder(const Item & item, Iterator iter);
// main table with dirs
Table table;
// true if there is a root dir in the table
bool is_root;
// root
Iterator root_iter;
// true if there is a etc dir in the table
bool is_etc;
// etc
Iterator etc_iter;
// true if there is a var dir in the table
bool is_var;
// var
Iterator var_iter;
// indexes
TableId table_id;
TableParent table_parent;
// names of folders
static std::wstring dir_etc, dir_var;
};
#endif

View File

@ -1,43 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_group
#define headerfile_winix_core_group
#include <string>
#include <vector>
struct Group
{
long id;
std::wstring name; // group name
std::vector<long> members; // users id
Group()
{
Clear();
}
void Clear()
{
id = -1;
name.clear();
members.clear();
}
};
#endif

View File

@ -1,116 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "groups.h"
Groups::Groups()
{
Clear();
}
void Groups::Clear()
{
table.Clear();
}
void Groups::ReadGroups(Db * db)
{
Clear();
db->GetGroups(table);
}
Group * Groups::GetGroup(long group_id)
{
Table::Iterator i = table.FindId(group_id);
if( i == table.End() )
return 0;
return &(*i);
}
Group * Groups::GetGroup(const std::wstring & name)
{
Table::Iterator i = table.FindName(name);
if( i == table.End() )
return 0;
return &(*i);
}
long Groups::GetGroupId(const std::wstring & name)
{
Group * pgroup = GetGroup(name);
if( !pgroup )
return -1;
return pgroup->id;
}
Groups::Iterator Groups::Begin()
{
return table.Begin();
}
Groups::Iterator Groups::End()
{
return table.End();
}
Groups::SizeType Groups::Size()
{
return table.Size();
}
bool Groups::Remove(long group_id)
{
return table.Remove(group_id);
}

View File

@ -1,53 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_groups
#define headerfile_winix_core_groups
#include <map>
#include "group.h"
#include "ugcontainer.h"
#include "db/db.h"
class Groups
{
typedef UGContainer<Group> Table;
Table table;
public:
typedef Table::Iterator Iterator;
typedef Table::SizeType SizeType;
Groups();
void Clear();
void ReadGroups(Db * db);
Group * GetGroup(long group_id);
Group * GetGroup(const std::wstring & name);
long GetGroupId(const std::wstring & name);
Iterator Begin();
Iterator End();
SizeType Size();
bool Remove(long group_id);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,299 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_htmlfilter
#define headerfile_winix_core_htmlfilter
#include <string>
#include <map>
#include <vector>
#include <algorithm>
// max length of a name of a html tag (with terminating null)
#define WINIX_HTMLFILTER_ITEM_NAME_MAXLEN 30
// max length of a html lang attribute (e.g. "en", "pl")
#define WINIX_HTMLFILTER_ITEM_LANG_MAXLEN 10
#define WINIX_HTMLFILTER_ATTR_NAME_MAXLEN 40
#define WINIX_HTMLFILTER_ATTR_VALUE_MAXLEN 500
// depth of the html tree
#define WINIX_HTMLFILTER_STACK_MAXLEN 100
// length of a buffer used for printing
// it should be at least: WINIX_HTMLFILTER_ITEM_NAME_MAXLEN+3
#define WINIX_HTMLFILTER_BUFFER_MAXLEN 2048
/*!
very lightweight filter for html
(without using any dynamic memory - some memory is allocated only at the beginning - in ctors)
this filter has O(n) complexity over the whole html string
such tags as: <script> <pre> <textarea> are treated in a special way
all characters between the opening and closing tag (<script>....</script>) are untouched
if the filter finds that there are not closed tags it will close them,
if the filter finds a closing tag which doesn't have an opening tag - it will skip it
tags which don't need to be closed: meta, input, br, img, link
look at CheckExceptions() method
the filter recognizes xml simple tags (with / at the end) such as: <br />
*/
class HTMLFilter
{
public:
enum OrphanMode
{
orphan_nbsp, // putting "&nbsp;" string
orphan_160space // putting 160 ascii code
};
HTMLFilter();
HTMLFilter(const HTMLFilter & f);
HTMLFilter & operator=(const HTMLFilter & f);
~HTMLFilter();
// main methods used for filtering
void Filter(const wchar_t * in, std::wstring & out);
void Filter(const std::wstring & in, std::wstring & out);
// insert a white space into long words
// (only between html tags)
// skipped in such tags: script, pre, textarea
// break_after - after how many characters insert a space (0 - off)
void BreakWord(size_t break_after_);
// insert a new line character into long lines
// (only between html tags)
// skipped in such tags: script, pre, textarea
// wrap_line - after how many characters wrap a line (0 - off)
// lines are wrapped only in 'body' tag (useful for text in 'title' tag which is in 'head' section)
void WrapLine(size_t wrap_line_);
// trimming white characters (with new lines)
// at the beginning, at the end and in the middle of a string
// only between html tags
// at the beginning and at the end only one space is left
// skipped in such tags: script, pre, textarea
// false by default
void TrimWhite(bool trim);
// first tabs in a tree
// default: 2 (spaces)
// set 0 to turn off
void InsertTabs(size_t tabsize);
// orphans are checked only in 'body' tag
void AssignOrphans(const wchar_t * lang_code, const std::vector<std::wstring> & otab);
void AssignOrphans(const std::wstring & lang_code, const std::vector<std::wstring> & otab);
void ClearOrphans();
// check 'orphans' for the specicic language
// if an orphan is detected then the non-break space ("&nbsp;" or ascii 160 code) will be put
// default disable (lang_none)
void OrphansMode(OrphanMode mode = orphan_nbsp);
// skipping some unsafe tags
// (script, iframe, frame, frameset, applet, head, meta, html, link, body, ...)
void SafeMode(bool safe_mode_);
protected:
// orphans for one language
struct Orphans
{
std::vector<std::wstring> tab;
size_t max_len;
};
// orphans for all languages
// map<language_code, Orphans>
typedef std::map<std::wstring, Orphans> OrphansTab;
OrphansTab orphans_tab;
struct Item
{
std::wstring name; // max size: WINIX_HTMLFILTER_ITEM_NAME_MAXLEN
enum Type
{
opening, /* sample: <h1> */
closing, /* sample: </h1> */
simple, /* sample: <br/> */
special, /* sample: <!doctype> */
none
} type;
// is there a new line after this tag
bool new_line;
// current orphans table
// (will be propagated)
Orphans * porphans;
// this item or one from its parents is a 'body' html tag
// (will be propagated)
bool has_body_tag;
void Clear();
Item();
};
/*
virtual methods
*/
virtual void Init();
virtual void Uninit();
virtual bool IsOpeningTagMark();
virtual bool IsOpeningCommentaryTagMark();
virtual bool IsClosingTagMark();
virtual bool IsClosingXmlSimpleTagMark();
virtual bool IsValidCharForName(int c);
virtual bool IsValidCharForAttrName(int c);
virtual void CheckExceptions();
virtual bool SkipCommentaryTagIfExists();
virtual void Put(wchar_t c);
virtual void Put(const wchar_t * str);
virtual void Put(const wchar_t * str, const wchar_t * end);
virtual void Put(const std::wstring & str);
virtual void PutOpeningTagMark();
virtual void PutClosingTagMark();
virtual bool PutOpeningTag();
virtual void PutClosingTag(const wchar_t * tag);
virtual void PutNormalText(const wchar_t * str, const wchar_t * end);
virtual void ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white);
/*
others
*/
Item & GetItem(size_t i);
Item & LastItem();
wchar_t ToLower(wchar_t c);
void ToLower(std::wstring & str);
bool IsNameEqual(const wchar_t * name1, const wchar_t * name2);
bool IsNameEqual(const wchar_t * name1, const std::wstring & name2);
bool IsNameEqual(const std::wstring & name1, const wchar_t * name2);
bool IsNameEqual(const std::wstring & name1, const std::wstring & name2);
bool IsNameEqual(const wchar_t * name1, const wchar_t * name2, size_t len);
bool IsNameEqual(const wchar_t * name1, const std::wstring & name2, size_t len);
bool IsNameEqual(const std::wstring & name1, const wchar_t * name2, size_t len);
bool IsNameEqual(const std::wstring & name1, const std::wstring & name2, size_t len);
bool IsLastTag(const wchar_t * name);
bool IsTagSafe(const wchar_t * tag);
bool IsTagSafe(const std::wstring & tag);
int CheckOrphan(const wchar_t * str, const wchar_t * end, const std::wstring & orphan_str);
bool CheckOrphan(const wchar_t * str, const wchar_t * end, const std::vector<std::wstring> & orphans);
bool CheckOrphan(const wchar_t * str, const wchar_t * end);
bool IsWhite(int c);
void SkipWhite();
void SkipWhiteLines();
void SkipWhiteWithFirstNewLine();
void SkipWhiteLines(const wchar_t * & str, const wchar_t * end);
bool IsClosingTagForLastItem();
size_t OpeningCommentaryTagMarkSize();
void SkipAndCheckClosingTag();
void PopStack();
bool PushStack();
void CheckNewLine();
void CheckStackPrintRest();
void AddForgottenTags();
void CheckClosingTags();
void ReadNormalText();
bool PrintRest();
bool PrintOpeningItem();
void ReadItemName();
void ReadItemAttrName();
void ReadItemAttrValue(bool has_quote);
bool ReadItemAttr();
bool CheckItemAttr();
void PrinItemAttr();
void ReadItemClosing();
void ReadItemSpecial();
void ReadItemOpening();
bool ReadItem();
void ReadLoop();
void Read();
void CheckChar(wchar_t c);
void CheckLineWrap();
bool HasSemiloconAround(const wchar_t * str, const wchar_t * end);
void PutNormalNonWhite(const wchar_t * & str, const wchar_t * end);
void PutNormalWhite(const wchar_t * & str, const wchar_t * end);
void PutLastTagWithClosingTag();
void PutTabs(size_t len);
void PutNonBreakingSpace();
void PutNewLine();
void CalcOrphansMaxLen(Orphans & orphans);
const wchar_t * pchar;
Item empty;
Item * pstack; // stack pointer
size_t stack_len; // length of the stack
wchar_t * buffer; // buffer used when printing
std::wstring * out_string;
bool last_new_line;
size_t break_after; // insert a space into long words after 'break_after' characters
size_t wrap_line; // insert a new line character into long lines
bool trim_white; // trimming white characters
size_t tab_size;
OrphanMode orphan_mode;
std::wstring attr_name;
std::wstring attr_value;
std::wstring attr_value_lower;
bool attr_has_value;
std::wstring lang_code_lower;
size_t line_len; //length of the current line (without first spaces which create the html tree)
bool safe_mode; // skipping some unsafe tags
Orphans orphans_temp;
};
#endif

View File

@ -1,235 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "httpsimpleparser.h"
void HttpSimpleParser::ToLower(std::string & s)
{
std::string::iterator i;
for(i=s.begin() ; i!= s.end() ; ++i)
{
if( *i>='A' && *i<='Z' )
*i = *i - 'A' + 'a';
}
}
bool HttpSimpleParser::IsWhite(int c)
{
if( c==' ' || c=='\t' )
return true;
return false;
}
void HttpSimpleParser::SkipWhiteChars()
{
while( IsWhite(last_c) )
last_c = GetChar();
}
void HttpSimpleParser::TrimWhiteChars(std::string & s)
{
if( s.empty() )
return;
std::string::size_type i;
for(i = 0 ; i<s.size() && IsWhite(s[i]) ; ++i);
if( i == s.size() )
{
// all characters are white
s.clear();
return;
}
if( i > 0 )
// there are some white characters at the beginning
s.erase(0, i);
// s is not empty now (i was not equal s.size())
// and we have some non white characters
// we stops at the last non white character
for(i = s.size()-1 ; i>0 && IsWhite(s[i]) ; --i);
if( i != s.size()-1 )
// there are some white characters at the end
// we're starting from i+1 even when i==0 (there are some non white characters)
s.erase(i+1, s.size() - i - 1);
}
int HttpSimpleParser::ParseHalfHex(int c)
{
if( c>='a' && c<='z' )
c += 'A' - 'a'; // to upper case
if( c >= 'A' )
c = c - 'A' + 10;
else
c = c - '0';
c &= 0xf;
return c;
}
void HttpSimpleParser::CheckSpecialChar()
{
if( last_c == '%' )
{
int c1 = GetChar();
int c2 = GetChar();
if( c1==-1 || c2==-1 )
{
last_c = -1;
}
else
{
c1 = ParseHalfHex(c1);
c2 = ParseHalfHex(c2);
last_c = (c1 << 4) + c2;
}
}
else
if( last_c == '+' )
{
last_c = ' ';
}
}
void HttpSimpleParser::ReadName()
{
// we're checking 'separator' and '=' because the string is allowed not having '=' (the value is optional)
for( ; last_c!=-1 && last_c!=separator && last_c!='=' ; last_c = GetChar() )
{
if( recognize_special_chars )
CheckSpecialChar();
if( last_c != -1 )
last_name += last_c;
}
if( last_c == '=' )
last_c = GetChar();
}
void HttpSimpleParser::ReadQuotedValue()
{
// skipping '"'
last_c = GetChar();
for( ; last_c!=-1 && last_c!='"' ; last_c = GetChar() )
{
if( recognize_special_chars )
CheckSpecialChar();
if( last_c != -1 )
last_value += last_c;
}
if( last_c == '"' )
last_c = GetChar();
// looking for a separator (skipping)
for( ; last_c!=-1 && last_c!=separator ; last_c = GetChar() );
}
void HttpSimpleParser::ReadValue()
{
if( skip_white_chars )
SkipWhiteChars();
if( value_can_be_quoted && last_c == '"' )
{
ReadQuotedValue();
}
else
{
for( ; last_c!=-1 && last_c!=separator ; last_c = GetChar() )
{
if( recognize_special_chars )
CheckSpecialChar();
if( last_c != -1 )
last_value += last_c;
}
}
if( last_c == separator )
last_c = GetChar();
}
void HttpSimpleParser::Parse()
{
for( last_c = GetChar() ; last_c != -1 ; )
{
last_name.clear();
last_value.clear();
if( read_name )
ReadName();
ReadValue();
if( skip_white_chars )
{
TrimWhiteChars(last_name);
TrimWhiteChars(last_value);
}
Parameter(last_name, last_value); // user definied function
}
}

View File

@ -1,68 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_httpsimpleparser
#define headerfile_winix_core_httpsimpleparser
#include <string>
class HttpSimpleParser
{
protected:
bool read_name;
bool value_can_be_quoted;
bool skip_white_chars;
bool recognize_special_chars;
int ParseHalfHex(int c);
void ReadName();
void ReadQuotedValue();
void ReadValue();
std::string last_name;
std::string last_value;
int last_c;
int separator;
// '-1' means end (eof)
virtual int GetChar() = 0;
virtual void Parameter(std::string & last_name, std::string & last_value) = 0;
void ToLower(std::string & s);
bool IsWhite(int c);
void SkipWhiteChars();
void TrimWhiteChars(std::string & s);
void CheckSpecialChar();
void Parse();
public:
HttpSimpleParser()
{
separator = '&';
read_name = true;
value_can_be_quoted = false;
skip_white_chars = false;
recognize_special_chars = true;
}
};
#endif

View File

@ -1,415 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include <ctime>
#include "image.h"
#include "utf8/utf8.h"
#include "log.h"
#include "system.h"
#include "plugin.h"
void Image::SetDb(Db * pdb)
{
db = pdb;
}
void Image::SetConfig(Config * pconfig)
{
config = pconfig;
}
void Image::SetSystem(System * psystem)
{
system = psystem;
}
// first thread (objects locked)
void Image::Resize(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality)
{
item_temp.type = WINIX_IMAGE_TYPE_RESIZE;
item_temp.file = item;
item_temp.cx = cx;
item_temp.cy = cy;
item_temp.aspect_mode = aspect_mode;
item_temp.quality = quality;
CheckParam(item_temp);
image_tab.insert(image_tab.end(), item_temp);
WakeUpThread();
}
// first thread (objects locked)
void Image::CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality)
{
item_temp.type = WINIX_IMAGE_TYPE_CREATE_THUMB;
item_temp.file = item;
item_temp.cx = cx;
item_temp.cy = cy;
item_temp.aspect_mode = aspect_mode;
item_temp.quality = quality;
CheckParam(item_temp);
image_tab.insert(image_tab.end(), item_temp);
WakeUpThread();
}
void Image::CheckParam(ImageItem & item)
{
if( item.aspect_mode < 1 )
item.aspect_mode = 1;
if( item.aspect_mode > 7 )
item.aspect_mode = 7;
if( item.quality < 0 )
item.quality = 0;
if( item.quality > 100 )
item.quality = 100;
if( item_temp.cx < 5 )
item_temp.cx = 5;
if( item_temp.cy < 5 )
item_temp.cy = 5;
if( item_temp.cx > 10000 )
item_temp.cx = 10000;
if( item_temp.cy > 10000 )
item_temp.cy = 10000;
}
// second thread (objects locked)
bool Image::SignalReceived()
{
return !image_tab.empty();
}
// second thread (objects not locked)
void Image::Do()
{
ImageTab::iterator i;
bool end;
Lock();
i = image_tab.begin();
Unlock();
do
{
Lock();
if( i != image_tab.end() )
{
item_work = *i;
image_tab.erase(i++);
end = false;
}
else
{
end = true;
}
Unlock();
if( !end )
CreateImage();
}
while( !end && !IsExitSignal() );
}
void Image::Add(const std::wstring & in, TextStream<std::string> & out)
{
PT::WideToUTF8(in, add_tempa);
out << add_tempa;
}
void Image::EscapePath(const std::string & path, TextStream<std::string> & out, bool clear_stream)
{
if( clear_stream )
out.Clear();
out << '"';
for(size_t i=0 ; i<path.size() ; ++i)
{
if( path[i] == '"' )
out << '\\';
out << path[i];
}
out << '\"';
}
/*
from: http://www.imagemagick.org/script/command-line-processing.php#geometry
scale% Height and width both scaled by specified percentage.
scale-x%xscale-y% Height and width individually scaled by specified percentages. (Only one % symbol needed.)
width Width given, height automagically selected to preserve aspect ratio.
xheight Height given, width automagically selected to preserve aspect ratio.
widthxheight Maximum values of height and width given, aspect ratio preserved.
widthxheight^ Minimum values of width and height given, aspect ratio preserved.
widthxheight! Width and height emphatically given, original aspect ratio ignored.
widthxheight> Change as per widthxheight but only if an image dimension exceeds a specified dimension.
widthxheight< Change dimensions only if both image dimensions exceed specified dimensions.
*/
void Image::SelectAspect()
{
switch( item_work.aspect_mode )
{
case WINIX_IMAGE_MODE_1:
command << item_work.cx;
break;
case WINIX_IMAGE_MODE_3:
command << item_work.cx << "x" << item_work.cy;
break;
case WINIX_IMAGE_MODE_4:
command << '"' << item_work.cx << "x" << item_work.cy << "^\"";
break;
case WINIX_IMAGE_MODE_5:
command << '"' << item_work.cx << "x" << item_work.cy << "!\"";
break;
case WINIX_IMAGE_MODE_6:
command << '"' << item_work.cx << "x" << item_work.cy << ">\"";
break;
case WINIX_IMAGE_MODE_7:
command << '"' << item_work.cx << "x" << item_work.cy << "<\"";
break;
case WINIX_IMAGE_MODE_2:
default:
command << "x" << item_work.cy;
break;
}
}
// second thread (objects locked)
bool Image::CreateInputFileName()
{
if( system->MakeFilePath(item_work.file, src_path) )
{
PT::WideToUTF8(src_path, input_file_name);
return true;
}
else
{
log << log1 << "Image: cannot create a source path" << logend;
return false;
}
}
// second thread (objects locked)
void Image::CreateTmpFileName()
{
stream_tmp_path.Clear();
stream_tmp_path << config->upload_dir << L"/tmp/image_" << std::time(0);
PT::WideToUTF8(stream_tmp_path.Str(), tmp_file_name);
}
// second thread (objects are not locked)
bool Image::CreateCommand()
{
Lock();
iq.SetAll(true, false);
iq.WhereId(item_work.file.id);
// !! skoro teraz i tak wczytujemy caly obiekt
// to teraz w kolejce wystarczy zapamietywac tylko samo item.id (a nie caly obiekt item)
// the file could have been changed especially when there is a long queue of files
if( db->GetItem(item_work.file, iq) != WINIX_ERR_OK )
{
Unlock();
return false;
}
if( !CreateInputFileName() )
{
Unlock();
return false;
}
command.Clear();
Add(config->convert_cmd, command);
command << " ";
EscapePath(input_file_name, command, false);
command << " -quiet -quality " << item_work.quality;
if( item_work.type == WINIX_IMAGE_TYPE_RESIZE )
command << " -resize ";
else
command << " -strip -thumbnail ";
SelectAspect();
CreateTmpFileName();
command << " ";
EscapePath(tmp_file_name, command, false);
log << log4 << "Image: running: " << command.Str() << logend;
Unlock();
return true;
}
// second thread (objects are not locked)
void Image::SaveImage()
{
bool moved = false;
Lock();
// the file could have been changed especially when creating the image lasted too long
iq.SetAll(true, false);
iq.WhereId(item_work.file.id);
if( db->GetItem(item_work.file, iq) == WINIX_ERR_OK )
{
bool thumb = (item_work.type == WINIX_IMAGE_TYPE_CREATE_THUMB);
if( system->MakeFilePath(item_work.file, dst_path, thumb, true, config->upload_dirs_chmod) )
{
if( RenameFile(stream_tmp_path.Str(), dst_path) )
{
if( thumb )
{
item_work.file.has_thumb = true;
db->EditHasThumbById(true, item_work.file.id);
log << log3 << "Image: generated a thumbnail: " << dst_path << logend;
plugin.Call((Session*)0, WINIX_CREATED_THUMB, &item_work.file);
}
else
{
log << log3 << "Image: image resized: " << dst_path << logend;
plugin.Call((Session*)0, WINIX_IMAGE_RESIZED, &item_work.file);
}
moved = true;
}
else
{
log << log1 << "Image: cannot move a temporary file: " << stream_tmp_path.Str() << ", to: " << dst_path << logend;
}
}
else
{
log << log1 << "Image: cannot create a destination path" << logend;
}
}
if( !moved )
::RemoveFile(stream_tmp_path.Str());
Unlock();
}
// second thread (objects are not locked)
void Image::CreateImage()
{
if( !CreateCommand() )
return;
int res = std::system(command.CStr());
if( res == 0 )
{
SaveImage();
}
else
{
Lock();
log << log3 << "Image: some problems with creating an image"
<< ", 'convert' process returned: " << res << logend;
Unlock();
}
}
// second thread (objects are not locked)
// !! there is a problem with GIF files
// Bus error (core dumped)
/*
#include "wand/MagickWand.h"
// compiler options:
// include: -I/usr/local/include/ImageMagick
// link with: `MagickWand-config --ldflags --libs`
void Image::CreateThumbnail()
{
PT::WideToUTF8(item_work.source, sourcea);
PT::WideToUTF8(item_work.dst, dsta);
MagickWandGenesis();
MagickWand * wand = NewMagickWand();
if( MagickReadImage(wand, sourcea.c_str()) )
{
MagickThumbnailImage(wand, item_work.cx, item_work.cy);
if( MagickWriteImage(wand, dsta.c_str()) )
{
Lock();
log << log3 << "Image: created a thumbnail: " << dsta << logend;
Unlock();
}
}
DestroyMagickWand(wand);
MagickWandTerminus();
}
*/

View File

@ -1,114 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_image
#define headerfile_winix_core_image
#include <string>
#include <list>
#include "basethread.h"
#include "textstream.h"
#include "db/db.h"
#include "core/item.h"
#include "core/config.h"
class System;
// Width given, height automagically selected to preserve aspect ratio.
#define WINIX_IMAGE_MODE_1 1
// Height given, width automagically selected to preserve aspect ratio.
#define WINIX_IMAGE_MODE_2 2
// Maximum values of height and width given, aspect ratio preserved.
#define WINIX_IMAGE_MODE_3 3
// Minimum values of width and height given, aspect ratio preserved.
#define WINIX_IMAGE_MODE_4 4
// Width and height emphatically given, original aspect ratio ignored.
#define WINIX_IMAGE_MODE_5 5
// Change as per widthxheight but only if an image dimension exceeds a specified dimension.
#define WINIX_IMAGE_MODE_6 6
// Change dimensions only if both image dimensions are less than specified dimensions.
#define WINIX_IMAGE_MODE_7 7
// resizing
#define WINIX_IMAGE_TYPE_RESIZE 1
// generating a thumbnail
#define WINIX_IMAGE_TYPE_CREATE_THUMB 2
class Image : public BaseThread
{
public:
void SetDb(Db * pdb);
void SetConfig(Config * pconfig);
void SetSystem(System * psystem);
void Resize(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality);
void CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality);
private:
Db * db;
Config * config;
System * system;
struct ImageItem
{
int type; // WINIX_IMAGE_TYPE_*
Item file;
size_t cx;
size_t cy;
int aspect_mode;
int quality;
};
// queue of thumbnails to create
typedef std::list<ImageItem> ImageTab;
ImageTab image_tab;
ImageItem item_temp;
// only for second thread
ImageItem item_work;
std::wstring src_path, dst_path;
TextStream<std::string> command;
TextStream<std::wstring> stream_tmp_path;
DbItemQuery iq;
std::string add_tempa;
std::string input_file_name;
std::string tmp_file_name;
virtual bool SignalReceived();
virtual void Do();
bool CreateCommand();
bool CreateInputFileName();
void CreateTmpFileName();
void SaveImage();
void CreateImage();
void SelectAspect();
void EscapePath(const std::string & path, TextStream<std::string> & out, bool clear_stream = true);
void CheckParam(ImageItem & item);
void Add(const std::wstring & in, TextStream<std::string> & out);
};
#endif

View File

@ -1,58 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_ipbancontainer
#define headerfile_winix_core_ipbancontainer
#include <vector>
#include "ipban.h"
class IPBanContainer
{
public:
IPBanContainer();
IPBan & AddIP(int ip);
IPBan * FindIP(int ip);
void Sort();
size_t Size();
IPBan & GetIPBan(size_t index);
void SetMaxSize(size_t soft_size, size_t size);
void RemoveIP(int ip);
void Clear();
bool IsSorted();
private:
std::vector<IPBan> ipban_tab;
bool is_ipban_tab_sorted;
size_t soft_max_size, max_size;
std::vector<size_t> sort_helper_tab;
static bool SortIPBansFunction(const IPBan & ip1, const IPBan & ip2);
void RemoveOldRecords();
void PrintTab();
void PrintTab2();
struct SortByLastUsedHelper
{
IPBanContainer * container;
SortByLastUsedHelper(IPBanContainer * c) : container(c) {}
bool operator()(size_t index1, size_t index2);
};
};
#endif

View File

@ -1,82 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "item.h"
#include "misc.h"
#include "crypt.h"
Item::Item()
{
Clear();
}
// !! IMPROVE ME
// now we have Request::start_time and Request::start_date
// we can somehow get the current time from the request
// may setting the date should be completetly removed from here?
void Item::SetDateToNow()
{
date_creation = std::time(0);
date_modification = date_creation;
}
void Item::SetDateModifyToNow()
{
date_modification = std::time(0);
}
void Item::Clear()
{
id = -1;
user_id = -1;
group_id = -1;
privileges = 0;
modification_user_id = -1;
guest_name.clear();
subject.clear();
content.clear();
modify_index = 0;
url.clear();
content_type = ct_formatted_text;
type = none;
parent_id = -1;
link_to.clear();
link_redirect = false;
content_id = -1;
ref = 1;
file_path.clear();
file_fs = -1;
file_type = WINIX_ITEM_FILETYPE_NONE;
hash.clear();
hash_type = WINIX_CRYPT_HASH_NONE;
file_size = 0;
has_thumb = false;
html_template.clear();
sort_index = 0;
meta.Clear();
ameta.Clear();
SetDateToNow();
}

View File

@ -1,122 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_item
#define headerfile_winix_core_item
#include <string>
#include "space/space.h"
#include "date/date.h"
#define WINIX_ITEM_FILETYPE_NONE 0
#define WINIX_ITEM_FILETYPE_IMAGE 1
#define WINIX_ITEM_FILETYPE_DOCUMENT 2
#define WINIX_ITEM_FILETYPE_VIDEO 3
#define WINIX_ITEM_FILETYPE_UNKNOWN 10
struct Item
{
long id;
long parent_id;
long user_id;
long group_id;
std::wstring guest_name; // used as a user name when user_id is equal -1
long modification_user_id; // who has modified the item last (not taken into account when checking permissions)
int privileges;
PT::Date date_creation;
PT::Date date_modification;
std::wstring subject;
std::wstring content;
std::wstring url;
int modify_index;
enum ContentType
{
ct_text = 0,
ct_formatted_text,
ct_html,
ct_bbcode,
ct_raw
};
ContentType content_type;
enum Type
{
dir = 0,
file = 1,
symlink = 2,
none = 1000
};
Type type;
// used when type is symlink or to a directory too (function 'default')
std::wstring link_to;
int link_redirect;
// static file (if exists)
std::wstring file_path; // relative file path
int file_fs; // file system type where the file was saved
int file_type; // file type (none, image, doc, etc)
bool has_thumb; // whether or not we have a thumbnail
std::wstring hash; // file hash (md4, md5, ...)
int hash_type; // hash type WINIX_CRYPT_HASH_* (see crypt.h)
size_t file_size; // size of the file
std::wstring html_template;
// sort index used when displaying a group of items
int sort_index;
// meta information
PT::Space meta;
PT::Space ameta;
// methods
Item();
void SetDateToNow();
void SetDateModifyToNow();
void Clear();
private:
// used by the database
long content_id; // content id in 'content' table
int ref; // content references
friend class Db;
friend struct DbItemColumns;
};
#endif

View File

@ -1,165 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "job.h"
#include "plugin.h"
#include "log.h"
Job::Job()
{
jobs_queue_tab.resize(WINIX_JOBS_HOW_MANY_PRIORITIES);
}
void Job::CheckPriority(int & priority) const
{
if( priority < 0 )
priority = 0;
if( priority >= WINIX_JOBS_HOW_MANY_PRIORITIES )
priority = WINIX_JOBS_HOW_MANY_PRIORITIES - 1;
}
// first thread (objects locked)
void Job::Add(PT::Space & job, int priority)
{
CheckPriority(priority);
jobs_queue_tab[priority].push(job);
WakeUpThread();
}
size_t Job::Size(int priority) const
{
CheckPriority(priority);
return jobs_queue_tab[priority].size();
}
size_t Job::Size() const
{
size_t sum = 0;
for(size_t i=0 ; i<WINIX_JOBS_HOW_MANY_PRIORITIES ; ++i)
sum += Size(i);
return sum;
}
bool Job::Empty(int priority) const
{
CheckPriority(priority);
return jobs_queue_tab[priority].empty();
}
bool Job::Empty() const
{
for(size_t i=0 ; i<WINIX_JOBS_HOW_MANY_PRIORITIES ; ++i)
if( !Empty(i) )
return false;
return true;
}
/*
second thread
*/
// second thread (objects locked)
bool Job::SignalReceived()
{
return !Empty();
}
// second thread (objects not locked)
void Job::Do()
{
size_t i = WINIX_JOBS_HOW_MANY_PRIORITIES;
bool is_empty;
while( i-- > 0 && !IsExitSignal() )
{
do
{
Lock();
is_empty = Empty(i);
Unlock();
if( !is_empty )
DoQueue(jobs_queue_tab[i]);
}
while( !is_empty && !IsExitSignal() );
}
}
// second thread (objects not locked, jobs_queue is not empty)
void Job::DoQueue(JobsQueue & jobs_queue)
{
bool is_empty;
do
{
Lock();
// references will not be invalidated after insertion to jobs_queue
// (jobs_queue is std::queue and it uses std::deque by default)
PT::Space & job = jobs_queue.front();
Unlock();
DoJob(job);
Lock();
jobs_queue.pop();
is_empty = jobs_queue.empty();
Unlock();
}
while( !is_empty && !IsExitSignal() );
}
// second thread (objects not locked)
void Job::DoJob(PT::Space & job)
{
try
{
PluginRes res = plugin.Call((Session*)0, WINIX_JOB, &job);
if( res.res_true == 0 )
DoWinixJob(job);
}
catch(...)
{
}
}
// second thread (objects not locked)
void Job::DoWinixJob(PT::Space & job)
{
Lock();
//log << log1 << "standard winix job: " << job.Text(L"type") << logend;
Unlock();
}

View File

@ -1,82 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_jobs
#define headerfile_winix_core_jobs
#include <vector>
#include <queue>
#include "basethread.h"
#include "space/space.h"
#define WINIX_JOBS_HOW_MANY_PRIORITIES 32
class Job : public BaseThread
{
public:
Job();
/*
add a new job to the queue
priority: 0-31 (0 - the lowest priority, 31 - the highest priority)
*/
void Add(PT::Space & job, int priority = 0);
/*
queue size, and size of all jobs in any priority
*/
size_t Size(int priority) const;
size_t Size() const;
/*
true if specified queue is empty
or if all queues are empty
*/
bool Empty(int priority) const;
bool Empty() const;
private:
typedef std::queue<PT::Space> JobsQueue;
typedef std::vector<JobsQueue> JobsQueueTab;
JobsQueueTab jobs_queue_tab;
void CheckPriority(int & priority) const;
void SaveToFile();
void ReadFromFile();
/*
second thread
*/
// standard winix jobs
// Image image;
// sending emails
// etc.
bool SignalReceived();
void Do();
void DoQueue(JobsQueue & jobs_queue);
void DoJob(PT::Space & job);
void DoWinixJob(PT::Space & job);
};
#endif

View File

@ -1,78 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_lastcontainer
#define headerfile_winix_core_lastcontainer
#include <string>
#include <list>
#include <cstring>
#include <ctime>
#include "date/date.h"
// how many items we store in the 'last' function
#define WINIX_LASTCONTAINER_TABLE_SIZE 100
struct LastItem
{
long user_id;
// additional we store the whole string-name
// (you can delete a user from the database but we can still print the name)
std::wstring name;
// ip address
unsigned int ip;
// session id (used when logging out)
long session_id;
// start logging and end logging
PT::Date start;
PT::Date end;
LastItem();
bool IsLoggedOut();
};
class LastContainer
{
public:
typedef std::list<LastItem> LastTab;
typedef LastTab::iterator Iterator;
public:
Iterator Begin();
Iterator End();
void UserLogin(long user_id, const std::wstring & name, unsigned int ip, long session_id);
void UserLogout(long user_id, long session_id);
private:
LastTab last_tab;
Iterator FindNotLoggedOut(long user_id, long session_id);
};
#endif

View File

@ -1,114 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_loadavg
#define headerfile_winix_core_loadavg
#include <ctime>
// in seconds
#define WINIX_LOADAVG_GRANULARITY1 2
#define WINIX_LOADAVG_GRANULARITY5 15
#define WINIX_LOADAVG_GRANULARITY15 45
class LoadAvg
{
public:
LoadAvg();
~LoadAvg();
LoadAvg & operator=(const LoadAvg & l);
LoadAvg(const LoadAvg & l);
void StartRequest();
void StopRequest();
double LoadAvgNow(); // load average withing last WINIX_LOADAVG_GRANULARITY1 seconds
double LoadAvg1();
double LoadAvg5();
double LoadAvg15();
double ReqPerSecNow();
double ReqPerSec1();
double ReqPerSec5();
double ReqPerSec15();
private:
struct Times
{
double dr; // time for the request (in seconds)
double dp; // time for the pause between requestes (in seconds)
long req; // how many requests
void Clear()
{
dr = 0.0;
dp = 0.0;
req = 0;
}
Times & operator=(const Times & t)
{
dr = t.dr;
dp = t.dp;
req = t.req;
return *this;
}
};
void CheckTimers();
void UpdateTimer1();
void UpdateTimer5();
void UpdateTimer15();
Times current1;
Times current5;
Times current15;
void CreateTable(size_t seconds, size_t granulatiry, Times* & tab, size_t & len);
void CreateTable();
void MoveTab(Times * tab, size_t len);
void SumTab(Times * tab, size_t len, double expected, Times & t);
void Calculate1();
void Calculate5();
void Calculate15();
bool was_stop_request;
timespec start_req, stop_req;
Times * tab1;
size_t len1;
Times * tab5;
size_t len5;
Times * tab15;
size_t len15;
double cache_load1;
double cache_load5;
double cache_load15;
double cache_req_per_sec1;
double cache_req_per_sec5;
double cache_req_per_sec15;
};
#endif

View File

@ -1,49 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "lock.h"
Lock::Lock()
{
synchro = 0;
}
Lock::Lock(Synchro * synchro_)
{
synchro = synchro_;
synchro->Lock();
}
Lock::Lock(Synchro & synchro_)
{
synchro = &synchro_;
synchro->Lock();
}
Lock::~Lock()
{
Unlock();
}
void Lock::Unlock()
{
if( synchro )
{
synchro->Unlock();
synchro = 0;
}
}

View File

@ -1,37 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_lock
#define headerfile_winix_core_lock
#include "synchro.h"
class Lock
{
public:
Lock(Synchro * synchro_);
Lock(Synchro & synchro_);
~Lock();
void Unlock();
private:
Synchro * synchro;
Lock();
};
#endif

View File

@ -1,480 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "log.h"
#include <ctime>
#include <string.h>
#include "utf8/utf8.h"
#include "timezones.h"
Log::Log()
{
log_level = 1;
current_level = 100; // nothing to log (call Init() first)
request = 0;
max_requests = 1;
lines = 0;
max_lines = 5000;
log_file_open = false;
time_zones = 0;
}
Log::~Log()
{
SaveLogAndClear();
}
void Log::SetTimeZones(TimeZones * ptime_zones)
{
time_zones = ptime_zones;
}
int Log::LogLevel()
{
return log_level;
}
void Log::Init(int log_level_, bool save_each_line_, const std::string & log_file_, bool log_std, int log_max_requests)
{
log_level = log_level_;
log_file = log_file_;
log_stdout = log_std;
max_requests = log_max_requests;
save_each_line = save_each_line_;
// don't open the file here
// because it would be created with the root as an owner
}
void Log::OpenFile()
{
if( !log_file.empty() )
{
file.open( log_file.c_str(), std::ios_base::out | std::ios_base::app );
log_file_open = true;
}
}
void Log::PrintDate(const PT::Date & date, size_t time_zone_id)
{
if( time_zones )
{
TimeZone * tz = time_zones->GetZone(time_zone_id);
if( tz )
{
PT::Date local_date = tz->ToLocal(date);
log << local_date;
}
else
{
(*this) << date << " UTC"; // unknown time zone identifier
}
}
else
{
(*this) << date << " UTC"; // time_zones object was not set
}
}
Log & Log::operator<<(const void * s)
{
if( current_level > log_level )
return *this;
buffer << s;
return *this;
}
Log & Log::operator<<(const char * s)
{
if( current_level > log_level )
return *this;
if( !s )
return *this;
buffer << s;
return *this;
}
Log & Log::operator<<(const std::string & s)
{
if( current_level > log_level )
return *this;
buffer << s;
return *this;
}
Log & Log::operator<<(const std::string * s)
{
if( current_level > log_level )
return *this;
buffer << *s;
return *this;
}
Log & Log::operator<<(const wchar_t * s)
{
if( current_level <= log_level )
{
if( s )
buffer << s;
}
return *this;
}
Log & Log::operator<<(const std::wstring & s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(const std::wstring * s)
{
if( current_level <= log_level )
{
buffer << *s;
}
return *this;
}
Log & Log::operator<<(int s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(long s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(char s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(wchar_t s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(size_t s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(double s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(const PT::Space & s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(const PT::Date & date)
{
if( current_level <= log_level )
{
buffer << date;
}
return *this;
}
Log & Log::operator<<(LogManipulators m)
{
switch(m)
{
case logend:
if( current_level <= log_level )
{
buffer << '\n';
lines += 1;
if( save_each_line )
SaveLogAndClear();
}
break;
case logsave:
SaveLogAndClear();
break;
case logendrequest:
if( ++request >= max_requests || lines > max_lines )
SaveLogAndClear();
break;
case log1:
current_level = 1;
break;
case log2:
current_level = 2;
break;
case log3:
current_level = 3;
break;
case log4:
current_level = 4;
break;
default:
break;
}
return *this;
}
char Log::GetHEXdigit(unsigned char c)
{
if( c < 10 )
return c + '0';
return c - 10 + 'A';
}
void Log::ToHEX(char * buf, unsigned char c)
{
buf[0] = GetHEXdigit(c >> 4);
buf[1] = GetHEXdigit(c & 0xf);
buf[2] = 0;
}
void Log::LogBinary(const char * blob, size_t blob_len)
{
size_t i=0;
char buf[3];
while( i < blob_len )
{
size_t oldi = i;
for(size_t a=0 ; a<16 ; ++a)
{
if( i < blob_len )
{
ToHEX(buf, blob[i]);
buffer << buf << ' ';
++i;
}
else
{
buffer << " ";
}
if( a == 7 )
{
if( i < blob_len )
buffer << "- ";
else
buffer << " ";
}
}
i = oldi;
buffer << ' ';
for(size_t a=0 ; a<16 && i<blob_len ; ++a, ++i)
{
if( blob[i] > 31 && blob[i] < 127 )
buffer << blob[i];
else
buffer << '.';
}
(*this) << logend;
}
}
void Log::LogBinary(const std::string & blob)
{
LogBinary(blob.c_str(), blob.size());
}
void Log::SystemErr(int err)
{
(*this) << "errno: " << err;
const char * err_msg = strerror(err);
if( err_msg )
(*this) << " (" << err_msg << ")";
}
void Log::SaveLogAndClear()
{
SaveLog();
buffer.Clear();
request = 0;
lines = 0;
}
void Log::SaveLog()
{
if( buffer.Str().empty() )
return;
if( log_stdout )
PT::WideToUTF8(buffer.Str(), std::cout);
if( log_file.empty() )
return;
if( !log_file_open || !file )
{
file.close();
file.clear();
OpenFile();
if( !file )
return;
}
PT::WideToUTF8(buffer.Str(), file);
file.flush();
}

View File

@ -1,163 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_log
#define headerfile_winix_core_log
#include <sstream>
#include <fstream>
#include <iostream>
#include <string>
#include "textstream.h"
#include "logmanipulators.h"
#include "textstream/textstream.h"
class TimeZones;
class Log
{
public:
Log();
~Log();
void SetTimeZones(TimeZones * ptime_zones);
void Init(int log_level_, bool save_each_line_, const std::string & log_file_, bool log_std, int log_max_requests);
Log & operator<<(const void * s);
Log & operator<<(const char * s);
Log & operator<<(const std::string * s);
Log & operator<<(const std::string & s);
Log & operator<<(const wchar_t * s);
Log & operator<<(const std::wstring * s);
Log & operator<<(const std::wstring & s);
Log & operator<<(int s);
Log & operator<<(long s);
Log & operator<<(char s);
Log & operator<<(wchar_t s);
Log & operator<<(size_t s);
Log & operator<<(double s);
Log & operator<<(const PT::Space & space);
Log & operator<<(LogManipulators m);
Log & operator<<(const PT::Date & date);
void PrintDate(const PT::Date & date, size_t time_zone_id);
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);
template<class StringType>
void LogString(const StringType & value, size_t max_size);
void LogBinary(const char * blob, size_t blob_len);
void LogBinary(const std::string & blob);
void SystemErr(int err);
void SaveLog();
void SaveLogAndClear();
int LogLevel();
private:
// time zones for printing the time in the log file
TimeZones * time_zones;
// buffer for the log
TextStream<std::wstring> buffer;
// log lovel from the config file
int log_level;
// current level set by a modifier (e.g. log << log3)
int current_level;
// current request for logging
// starts from zero and incremented after logendrequest modifier
int request;
// how many request to save at once
int max_requests;
// file log
std::string log_file;
std::ofstream file;
// logging to stdout
bool log_stdout;
// how many lines there are in the buffer
int lines;
// is the config file already open
bool log_file_open;
// how many lines can be in the config buffer
// default: 5000
int max_lines;
// whether to save each line (for debug)
bool save_each_line;
void OpenFile();
char GetHEXdigit(unsigned char c);
void ToHEX(char * buf, unsigned char c);
};
template<class StringType>
void Log::LogString(const StringType & value, size_t max_size)
{
size_t min_size = value.size() < max_size ? value.size() : max_size;
if( current_level <= log_level )
{
for(size_t i=0 ; i<min_size ; ++i)
{
if( value[i] < 32 )
buffer << '.';
else
buffer << value[i];
}
}
}
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)
{
if( current_level <= log_level )
buffer << buf;
return *this;
}
extern Log log;
extern Log nlog;
// for convenience, we have to use only #include "log.h" in the winix
#include "slog.h"
#endif

View File

@ -1,48 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_logmanipulators
#define headerfile_winix_core_logmanipulators
/*
log1 - the first level
log2
log3
log4 - the last level (debug level)
logend - the end of a line
logendrequest - end of a current request
logsave - current log buffer is saved and cleared
manipulators used by the session logger (SLog)
loginfo - normal info to a user
logerror - we are reporting an error
logwarning - we are reporting a warning
make sure that loginfo, logerror and logwarning have values less than 32 (space)
their are used as control codes in a string
*/
enum LogManipulators
{
log1,
log2,
log3,
log4,
logend,
logendrequest,
logsave,
loginfo,
logerror,
logwarning
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,111 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "mount.h"
#include "misc.h"
Mount::Mount()
{
dir_id = -1;
type = -1;
fs = -1;
}
void Mount::ClearParams()
{
size_t i;
for(i=0 ; i<param.size() ; ++i)
param[i].Clear();
}
bool Mount::IsPar(int code)
{
if( code < 0 || code >= (int)param.size() )
return false;
if( !param[code].defined )
return false;
return true;
}
bool Mount::IsArg(int code, const wchar_t * arg)
{
ParamRow::ParamArg::iterator i;
if( code < 0 || code >= (int)param.size() )
return false;
if( !param[code].defined )
return false;
for(i=param[code].arg.begin() ; i!=param[code].arg.end() ; ++i)
{
if( *i == arg )
return true;
}
return false;
}
bool Mount::IsArg(int code, const std::wstring & arg)
{
return IsArg(code, arg.c_str());
}
bool Mount::IsArg(int code, int arg)
{
ParamRow::ParamArg::iterator i;
if( code < 0 || code >= (int)param.size() )
return false;
if( !param[code].defined )
return false;
for(i=param[code].arg.begin() ; i!=param[code].arg.end() ; ++i)
{
if( Toi(*i) == arg )
return true;
}
return false;
}
const std::wstring & Mount::Arg(int code, int arg) const
{
if( code < 0 || code >= (int)param.size() )
return empty_str;
if( !param[code].defined )
return empty_str;
if( arg >= (int)param[code].arg.size() )
return empty_str;
return param[code].arg[arg];
}
const std::wstring & Mount::FirstArg(int code) const
{
return Arg(code, 0);
}

View File

@ -1,71 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009-2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_mount
#define headerfile_winix_core_mount
#include <map>
#include <string>
#include <vector>
class Mount
{
public:
struct ParamRow
{
typedef std::vector<std::wstring> ParamArg;
bool defined;
ParamArg arg;
ParamRow() { defined = false; }
void Clear() { defined = false; arg.clear(); }
};
typedef std::vector<ParamRow> Param;
long dir_id;
int type;
int fs;
Param param;
Mount();
void ClearParams();
bool IsPar(int code);
bool IsArg(int code, const wchar_t * arg);
bool IsArg(int code, const std::wstring & arg);
bool IsArg(int code, int arg);
// returning the arg argument if defined (or an empty string)
const std::wstring & Arg(int code, int arg) const;
// returning the first argument (arg=0) if defined (or an empty string)
const std::wstring & FirstArg(int code) const;
private:
// for Arg() methods when the argument is not defined
const std::wstring empty_str;
};
#endif

View File

@ -1,155 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "plugindata.h"
#include "plugin.h"
#include "log.h"
#include "session.h"
PluginData::PluginData()
{
session = 0;
}
PluginData::PluginData(const PluginData & p)
{
operator=(p);
}
PluginData & PluginData::operator=(const PluginData & p)
{
// we don't copy all pointers - only resize the table
// pointers will be set to zero
Resize(p.Size());
session = 0;
return *this;
}
PluginData::~PluginData()
{
DeleteAll();
}
void PluginData::SetSession(Session * ses)
{
session = ses;
}
void PluginData::Assign(size_t index, PluginDataBase * data)
{
if( index >= table.size() )
Resize(index+1);
table[index] = data;
}
void PluginData::Assign(PluginDataBase * data)
{
if( plugin.current_plugin == -1 )
{
log << log1 << "PD: Assign(PluginDataBase*) should be called only from plugins" << logend;
return;
}
Assign(plugin.current_plugin, data);
}
PluginDataBase * PluginData::Get(size_t index)
{
if( index >= table.size() )
Resize(index+1);
return table[index];
}
PluginDataBase * PluginData::Get()
{
if( plugin.current_plugin == -1 )
{
log << log1 << "PD: Get() should be called only from plugins" << logend;
return 0;
}
return Get(plugin.current_plugin);
}
void PluginData::DeleteAll()
{
bool all_null = true;
/*
when we copy a session's object (and this object then)
we resize the table and there are only null pointers there
consequently if all pointers are null there is no sens
to send WINIX_PLUGIN_SESSION_DATA_REMOVE
*/
for(size_t i=0 ; i<table.size() ; ++i)
{
if( table[i] != 0 )
{
all_null = false;
break;
}
}
/*
in the future this message may be removed
and we directly 'delete' the pointers
*/
if( !all_null )
plugin.Call(session, WINIX_PLUGIN_SESSION_DATA_REMOVE);
table.clear();
}
size_t PluginData::Size() const
{
return table.size();
}
void PluginData::Resize(size_t new_size)
{
size_t old_size = table.size();
if( old_size == new_size )
return;
table.resize(new_size);
for(size_t i = old_size ; i<new_size ; ++i)
table[i] = 0;
}

View File

@ -1,69 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_plugindata
#define headerfile_winix_core_plugindata
#include <vector>
struct Session;
struct PluginDataBase
{
virtual ~PluginDataBase() {}
/*
!! CHECK ME
it is still in use?
when deleting sessions we first call Clear() method
consequently the destructor has nothing to do
(and it does not throw an exception)
*/
virtual void Clear() {}
};
class PluginData
{
public:
PluginData();
PluginData(const PluginData & p);
PluginData & operator=(const PluginData & p);
~PluginData();
void SetSession(Session * ses);
void Assign(size_t index, PluginDataBase * data);
void Assign(PluginDataBase * data);
PluginDataBase * Get(size_t index);
PluginDataBase * Get();
void DeleteAll();
size_t Size() const;
void Resize(size_t new_size);
private:
Session * session;
std::vector<PluginDataBase*> table;
};
#endif

View File

@ -1,151 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_postparser
#define headerfile_winix_core_postparser
#include <fcgiapp.h>
#include <string>
#include "httpsimpleparser.h"
#include "requesttypes.h"
#include "misc.h"
#include "utf8/utf8.h"
#include "log.h"
#include "config.h"
#include "plugin.h"
class PostParser : public HttpSimpleParser
{
FCGX_Stream * in;
PostTab * post_tab;
std::wstring temp_name, temp_value;
bool input_as_utf8;
size_t log_value_size;
int var_index;
bool has_winix_post_params_msg;
bool has_winix_raw_post_msg;
std::string raw_post;
protected:
virtual int GetChar()
{
int c = FCGX_GetChar(in);
if( c != -1 && has_winix_raw_post_msg )
raw_post += c;
return c;
}
void CreateLog(bool param_added)
{
log << log2 << "Method POST, name: \"" << temp_name << "\"";
if( log_value_size > 0 && !IsSubStringNoCase(L"pass", temp_name.c_str()) )
{
log << ", value: ";
if( temp_value.size() > log_value_size )
log << "(first " << log_value_size << " characters) ";
log << "\"";
log.LogString(temp_value, log_value_size);
log << "\" (size: " << temp_value.size() << ")";
}
if( param_added == false )
log << log2 << " (skipped)";
log << log2 << logend;
}
void ConvStr(const std::string & src, std::wstring & dst)
{
if( input_as_utf8 )
PT::UTF8ToWide(src, dst);
else
AssignString(src, dst);
}
virtual void Parameter(std::string & name, std::string & value)
{
bool added;
std::pair<PostTab::iterator, bool> res;
if( has_winix_post_params_msg )
plugin.Call(0, WINIX_POST_PARAMS, &name, &value);
ConvStr(name, temp_name);
ConvStr(value, temp_value);
res = post_tab->insert( std::make_pair(temp_name, temp_value) );
added = res.second;
if( !added )
{
temp_name += L"_inc";
temp_name += Toa(var_index);
res = post_tab->insert( std::make_pair(temp_name, temp_value) );
added = res.second;
var_index += 1;
}
CreateLog(added);
}
public:
PostParser()
{
input_as_utf8 = false;
log_value_size = 0;
}
void UTF8(bool utf)
{
input_as_utf8 = utf;
}
void LogValueSize(size_t s)
{
log_value_size = s;
}
void Parse(FCGX_Stream * in_, PostTab & post_tab_)
{
in = in_;
post_tab = &post_tab_;
var_index = 1;
raw_post.clear();
has_winix_post_params_msg = plugin.HasMessage(WINIX_POST_PARAMS);
has_winix_raw_post_msg = plugin.HasMessage(WINIX_RAW_POST_STRING);
HttpSimpleParser::Parse();
if( has_winix_raw_post_msg )
plugin.Call(0, WINIX_RAW_POST_STRING, &raw_post);
raw_post.clear();
}
};
#endif

View File

@ -1,51 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_rebus
#define headerfile_winix_core_rebus
#include <string>
#include <vector>
struct Cur;
class Rebus
{
public:
struct Item
{
int key;
std::wstring question;
int answer;
};
void SetCur(Cur * pcur);
void Init();
Item * Rand();
bool IsAnswerOk(Item * item, const std::wstring & answer);
bool CheckRebus();
private:
Cur * cur;
bool InitPair(int a, int b, Item & item);
std::vector<Item> table;
};
#endif

View File

@ -1,355 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2013, Tomasz Sowa
* All rights reserved.
*
*/
#include "request.h"
#include "log.h"
#include "plugin.h"
#include "misc.h"
Request::Request() : char_empty(0)
{
id = 0;
}
void Request::SetConfig(Config * pconfig)
{
config = pconfig;
}
void Request::ClearAjax()
{
size_t i = ajax.spaces.size();
while( i-- > 0 )
ajax.RemoveSpace(i);
ajax.table.clear();
PT::Space::TableSingle::iterator s = ajax.table_single.begin();
while( s != ajax.table_single.end() )
{
if( s->first != L"content" && s->first != L"http_status" )
{
ajax.table_single.erase(s++);
}
else
{
// small optimization when deleting
// the memory for "content" and "http_status" will be reused
s->second.clear();
++s;
}
}
}
void Request::Clear()
{
// id is never 0
if( ++id == 0 )
++id;
RemovePostFileTmp(post_file_tab);
post_tab.clear();
post_file_tab.clear();
cookie_tab.clear();
method = none;
role = responder;
headers.Clear();
page.Clear();
ajaxpage.Clear();
debug.Clear();
page_generated = false;
use_html_filter = true;
env_request_method = &char_empty;
env_request_uri = &char_empty;
env_http_cookie = &char_empty;
env_remote_addr = &char_empty;
env_http_host = &char_empty;
env_http_user_agent = &char_empty;
env_fcgi_role = &char_empty;
env_content_type = &char_empty;
env_http_accept_encoding = &char_empty;
env_https = &char_empty;
item_tab.clear();
item.Clear();
dir_tab.clear();
last_item = &item;
is_item = false;
function = 0; // !! dodac jakas empty funkcje
param_tab.clear();
anchor.clear();
status = WINIX_ERR_OK;
browser_msie = false;
redirect_to.clear();
redirect_type = 303;
x_sendfile.clear();
send_as_attachment = false;
using_ssl = false;
start_time = 0;
start_date.Clear();
subdomain.clear();
ClearAjax();
ajax_serializer = 0;
binary_page.clear();
compressed_page.clear();
use_text_page = true;
gen_trim_white = false;
gen_skip_new_line = false;
gen_use_special_chars = false;
ip = 0;
use_200_status_for_not_found_and_permission_denied = false;
}
void Request::RequestStarts()
{
// clearing it is better to use at the end of a request
// so starting is much faster
start_time = std::time(0);
start_date = start_time;
}
// value can be null
void Request::SetCookie(const char * name, const char * value, PT::Date * expires)
{
headers << "Set-Cookie: " << name << "=";
if( value && value[0]!=0 )
headers << value;
else
headers << "\"\"";
if( expires )
headers << "; expires=" << DateToStrCookie(*expires) << " GMT";
headers << "; path=/; domain=" << config->base_url << "\r\n";
/*
don't use '; secure' flag if you are using both sites (with SSL
and without SSL) -- with secure flag the cookie is sent only through
SSL and if you accidentally open a new window without SSL (http://)
then winix will create a new session for you and the previous session (https://)
will be lost (cookie is overwritten on the client browser)
*/
}
void Request::SetCookie(const char * name, long value, PT::Date * expires)
{
headers << "Set-Cookie: " << name << "=" << value;
if( expires )
headers << "; expires=" << DateToStrCookie(*expires) << " GMT";
headers << "; path=/; domain=" << config->base_url << "\r\n";
}
bool Request::IsPostVar(const wchar_t * var)
{
PostTab::iterator p;
p = post_tab.find(var);
if( p == post_tab.end() )
return false;
return true;
}
bool Request::IsPostVar(const std::wstring & var)
{
PostTab::iterator p;
p = post_tab.find(var);
if( p == post_tab.end() )
return false;
return true;
}
const std::wstring & Request::PostVar(const wchar_t * var)
{
PostTab::iterator p = post_tab.find(var);
if( p == post_tab.end() )
return str_empty;
return p->second;
}
const std::wstring & Request::PostVar(const std::wstring & var)
{
PostTab::iterator p = post_tab.find(var);
if( p == post_tab.end() )
return str_empty;
return p->second;
}
bool Request::PostVar(const wchar_t * var, std::wstring & result)
{
PostTab::iterator p = post_tab.find(var);
if( p == post_tab.end() )
{
result.clear();
return false;
}
result = p->second;
return true;
}
bool Request::PostVar(const std::wstring & var, std::wstring & result)
{
PostTab::iterator p = post_tab.find(var);
if( p == post_tab.end() )
{
result.clear();
return false;
}
result = p->second;
return true;
}
std::wstring * Request::PostVarp(const wchar_t * var)
{
PostTab::iterator p = post_tab.find(var);
if( p == post_tab.end() )
return 0;
return &p->second;
}
std::wstring * Request::PostVarp(const std::wstring & var)
{
PostTab::iterator p = post_tab.find(var);
if( p == post_tab.end() )
return 0;
return &p->second;
}
bool Request::AllPostVarEmpty()
{
PostTab::iterator i;
for(i=post_tab.begin() ; i!=post_tab.end() ; ++i)
if( !i->second.empty() )
return false;
return true;
}
bool Request::IsParam(const wchar_t * param_name)
{
ParamTab::iterator i;
for(i=param_tab.begin() ; i!=param_tab.end() ; ++i)
{
if( i->name == param_name )
return true;
}
return false;
}
bool Request::IsParam(const std::wstring & param_name)
{
ParamTab::iterator i;
for(i=param_tab.begin() ; i!=param_tab.end() ; ++i)
{
if( i->name == param_name )
return true;
}
return false;
}
const std::wstring & Request::ParamValue(const wchar_t * param_name)
{
ParamTab::iterator i;
for(i=param_tab.begin() ; i!=param_tab.end() ; ++i)
{
if( i->name == param_name )
return i->value;
}
return str_empty;
}
const std::wstring & Request::ParamValue(const std::wstring & param_name)
{
return ParamValue(param_name.c_str());
}

View File

@ -1,235 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2013, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_request
#define headerfile_winix_core_request
#include <fcgiapp.h>
#include <sstream>
#include <vector>
#include "requesttypes.h"
#include "item.h"
#include "error.h"
#include "config.h"
#include "textstream.h"
#include "templates/htmltextstream.h"
#include "date/date.h"
#include "space/space.h"
#include "space/spacetojson.h"
class FunctionBase;
struct Request
{
// request id
// is incremented for each request and is never 0
// (from -1 will be incremented twice)
// it's used for some optimalizations e.g. in templates
size_t id;
// !! moze pozbyc sie tego none?
enum Method { get, post, head, none } method;
enum Role { responder, authorizer } role;
// headers, page and debug
//std::ostringstream headers, page, debug;
TextStream<std::string> headers;
HtmlTextStream page, debug;
TextStream<std::wstring> ajaxpage;
// binary page
BinaryPage binary_page;
// a compressed page ready to send to the client
BinaryPage compressed_page;
// if true then either page or ajaxpage will be sent to the client
// if false then binary_page is sent
// default: true
bool use_text_page;
// if set to true then the standard template system will not be generated
// default: false
bool page_generated;
// whether or not the html filter should be used
// default: true
bool use_html_filter;
// raw parameters
PostTab post_tab;
PostFileTab post_file_tab;
CookieTab cookie_tab;
// html anchor (those part of URI after '#' character)
std::wstring anchor;
// environment variables
// they are not null -- when the server doesn't have such a variable
// it will be pointing into 'char_empty' which is default '\0'
const char * env_request_method;
const char * env_request_uri;
const char * env_http_cookie;
const char * env_remote_addr;
const char * env_http_host;
const char * env_http_user_agent;
const char * env_http_accept_encoding;
const char * env_fcgi_role;
const char * env_content_type;
const char * env_https;
// current IP address of the remote host (read from REMOTE_ADDR environment variable)
// (at the moment only IPv4 are supported)
int ip;
// true if the browser is Microsoft Internet Explorer
bool browser_msie;
// true if the browser is Konqueror
bool browser_konqueror;
// true if we are using encrypted connection (SSL)
bool using_ssl;
// current directory
std::vector<Item*> dir_tab;
// true if a file exists
bool is_item;
// current file (if exists)
Item item;
// current winix function
// null if there is no a function
FunctionBase * function;
// parameters (name:value)
ParamTab param_tab;
// request status
Error status;
// usually items in the current directory (depends on the function)
std::vector<Item> item_tab;
// if not empty means an address for redirecting to
// it should be url-encoded
std::wstring redirect_to;
std::string aredirect_to;
// a redirect type
// following redirect types are supported:
// 300 Multiple Choices
// 301 Moved Permanently
// 302 Found
// 303 See Other (default)
// 307 Temporary Redirect
int redirect_type;
// send header X-LIGHTTPD-send-file with path to a file
std::wstring x_sendfile;
// send as attachment (causes header: content-disposition: attachment)
bool send_as_attachment;
// this is a pointer either to the item (if exists) or to the last directory
Item * last_item;
// request start time
// Time() methods are very slow so it is better to directly use those two values
// they are set when a request starts
time_t start_time;
PT::Date start_date;
// a subdomain
// subdomain = HTTP_HOST environment variable - config->base_url
std::wstring subdomain;
// used as a JSON output (when ajax_serializer is defined)
// it will be serialized and have at least:
// 'content' string - the whole html content
// 'http_status' integer - http status code (e.g. 200) !! FIXME this is not added at the moment
PT::Space ajax;
// if not null then the request will have a JSON as an output
PT::SpaceToJSON * ajax_serializer;
// if this variable is true then winix always return 200 OK header
// when the status would be 404 (not found) or 403 (permission denied)
// default: false
bool use_200_status_for_not_found_and_permission_denied;
// options used by ezc generators
bool gen_trim_white;
bool gen_skip_new_line;
bool gen_use_special_chars;
Request();
void SetConfig(Config * pconfig);
void RequestStarts();
void Clear();
bool IsParam(const wchar_t * param_name);
bool IsParam(const std::wstring & param_name);
const std::wstring & ParamValue(const wchar_t * param_name); // returns an empty string if there is no such a parameter
const std::wstring & ParamValue(const std::wstring & param_name); // returns an empty string if there is no such a parameter
void SetCookie(const char * name, const char * value, PT::Date * expires = 0);
void SetCookie(const char * name, long value, PT::Date * expires = 0);
bool IsPostVar(const wchar_t * var);
bool IsPostVar(const std::wstring & var);
const std::wstring & PostVar(const wchar_t * var); // returns an empty string if there is no such a parameter
const std::wstring & PostVar(const std::wstring & var); // returns an empty string if there is no such a parameter
bool PostVar(const wchar_t * var, std::wstring & result);
bool PostVar(const std::wstring & var, std::wstring & result);
std::wstring * PostVarp(const wchar_t * var);
std::wstring * PostVarp(const std::wstring & var);
bool AllPostVarEmpty(); // returning true if all post vars are empty
void SendAll();
private:
Config * config;
// contains '\0'
// used to set env_* pointers to the empty value
const char char_empty;
// used in ParamValue() and PostVar() when there is no such a param
const std::wstring str_empty;
void ClearAjax();
};
#endif

View File

@ -1,52 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_requesttypes
#define headerfile_winix_core_requesttypes
#include <string>
#include <vector>
#include <map>
#include "textstream/textstream.h"
// !! narazie uzywane tylko w post multi parserze
// dodac do zwyklego parsera post
#define WINIX_POSTTABLE_MAXSIZE 50
struct PostFile
{
std::wstring filename; // original file name
std::wstring tmp_filename; // file with content (in /tmp)
size_t file_size;
};
// parameters from get name:value
struct Param
{
std::wstring name;
std::wstring value;
};
// some global types used by Request class
typedef std::map<std::wstring, std::wstring> PostTab;
typedef std::map<std::wstring, PostFile> PostFileTab;
typedef std::vector<Param> ParamTab;
typedef std::map<std::string, std::string> CookieTab;
typedef PT::TextStreamBase<char, 1, 4096> BinaryPage;
#endif

View File

@ -1,94 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "session.h"
#include "misc.h"
Session::Session()
{
Clear();
plugin_data.SetSession(this);
}
Session::Session(const Session & ses)
{
operator=(ses);
}
Session & Session::operator=(const Session & ses)
{
/*
we can only copy ses.id because it is needen in SessionContainer
it have indexes to id
*/
Clear();
id = ses.id;
plugin_data.SetSession(this);
return *this;
}
void Session::SetTimesTo(time_t time)
{
start_time = time;
start_date = time;
last_time = start_time;
last_date = start_date;
// the first request can be a POST (it doesn't matter)
last_time_get = start_time;
}
// clear_plugin_data is used when clearing the temporary session
void Session::Clear(bool clear_plugin_data)
{
id = 0;
puser = 0;
rebus_item = 0;
rebus_checked = false;
remember_me = false;
new_session = true;
spam_score = 0;
remove_me = false;
start_time = 0;
last_time = 0;
last_time_get = 0;
start_date.Clear();
last_date.Clear();
log_buffer.Clear();
last_css.clear();
ip_ban = 0;
if( clear_plugin_data )
plugin_data.Resize(0);
}
// clearing some variables when a request is ended (just for safety)
void Session::ClearOnEndRequest()
{
// ip_ban list can be sorted by SessionManager (in the special thread)
ip_ban = 0;
}

View File

@ -1,100 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_session
#define headerfile_winix_core_session
#include <vector>
#include <string>
#include <ctime>
#include "item.h"
#include "error.h"
#include "user.h"
#include "plugindata.h"
#include "rebus.h"
#include "textstream.h"
#include "date/date.h"
#include "ipban.h"
struct Session
{
Session();
Session(const Session & ses);
Session & operator=(const Session & ses);
void SetTimesTo(time_t time);
void Clear(bool clear_plugin_data = true);
void ClearOnEndRequest();
// 0 - means that there is a temporary session
long id;
// true if the session was created now
bool new_session;
// when this session was created
// (the same values)
time_t start_time;
PT::Date start_date;
// when this session was last used
// (the same values)
time_t last_time;
PT::Date last_date;
// when there was a last get request
// (used to calculate spam or invalid login attempts etc.)
time_t last_time_get;
// 0 - means that nobody is logged
User * puser;
// if false the session will end when the user browser is shutdown
bool remember_me;
// rebus - set by rebus_question(Info & i) from templates
Rebus::Item * rebus_item;
bool rebus_checked;
int spam_score;
// if true then this session will be removed by SessionManager
// without checking the time expiration
bool remove_me;
PluginData plugin_data;
// buffer for the session log
TextStream<std::wstring> log_buffer;
// !! IMPROVE ME it is still needed?
// css cannot be taken directly from the mountpoint?
// table with css files
// used by some javascript wysiwyg editors (ckeditor, tinymce)
std::vector<std::wstring> last_css;
// pointer to IPBan struct if exists for this IP
// many sessions can pointer to the same IPBan struct
// (it can be null)
IPBan * ip_ban;
};
#endif

View File

@ -1,74 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_sessioncontainer
#define headerfile_winix_core_sessioncontainer
#include <list>
#include <map>
#include <ctime>
#include "session.h"
#include "cur.h"
#include "config.h"
class SessionContainer
{
public:
typedef std::list<Session> Table;
typedef Table::iterator Iterator;
typedef std::map<long, Iterator> IndexId;
typedef IndexId::iterator IdIterator;
SessionContainer();
void SetCur(Cur * pcur);
void SetConfig(Config * pconfig);
void SetTmpSession(Session * psession);
void Clear();
size_t Size();
Iterator Begin();
Iterator End();
Session & Back();
Iterator AddSession(long id);
Iterator FindById(long);
IdIterator IdBegin();
IdIterator IdEnd();
void EraseById(long id);
bool ChangeSessionId(Iterator ses, long new_id);
bool ChangeSessionId(long old_id, long new_id);
private:
Table table;
IndexId index_id;
Cur * cur;
Config * config;
Session * tmp_session;
Session empty_session;
// in FreeBSD implementation (GCC) list::size() has linear complexity
// so we use our own table_size with O(1)
size_t table_size;
};
#endif

View File

@ -1,605 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2013, Tomasz Sowa
* All rights reserved.
*
*/
#include <sys/stat.h>
#include "sessionmanager.h"
#include "request.h"
#include "log.h"
#include "session.h"
#include "sessionparser.h"
#include "plugin.h"
SessionManager::SessionManager()
{
temporary_session.id = 0;
session = &temporary_session;
session_tab.SetTmpSession(&temporary_session);
// thread work mode
work_mode = 1;
}
void SessionManager::SetCur(Cur * pcur)
{
cur = pcur;
session_tab.SetCur(pcur);
}
void SessionManager::SetConfig(Config * pconfig)
{
config = pconfig;
session_tab.SetConfig(pconfig);
}
void SessionManager::SetSystem(System * psystem)
{
system = psystem;
}
void SessionManager::SetLastContainer(LastContainer * plast_container)
{
last_container = plast_container;
}
void SessionManager::InitBanList()
{
ban_tab.SetMaxSize(config->ban_list_soft_max_size, config->ban_list_max_size);
}
size_t SessionManager::Size()
{
return session_tab.Size();
}
bool SessionManager::IsSession(long id)
{
if( session_tab.FindById(id) == session_tab.End() )
return false;
return true;
}
long SessionManager::CreateSessionId()
{
long id;
// make sure to call std::srand() somewhere at the beginning
// id must be != 0 (0 is reserved)
do
{
if( sizeof(long) == 8 )
{
id = (((unsigned long)std::rand()) << 32) + std::rand();
}
else
{
id = std::rand();
}
id += std::time(0);
if( id < 0 )
id = -id;
}
while( id == 0 ); // 0 reserved for a temporary session
return id;
}
void SessionManager::CreateSession()
{
int attempts = 100;
SessionContainer::Iterator i = session_tab.End();
if( config->session_max == 0 || session_tab.Size() < config->session_max )
{
for( ; i == session_tab.End() && attempts > 0 ; --attempts )
{
long id = CreateSessionId();
i = session_tab.AddSession(id);
}
}
else
{
log << log2 << "SM: sessions limit exceeded (" << config->session_max << ")" << logend;
}
if( i != session_tab.End() )
{
session = &(*i);
session->new_session = true;
session->SetTimesTo(cur->request->start_time);
log << log2 << "SM: created a new session: " << session->id << logend;
}
else
{
// there is a problem with generating a new session id
// we do not set a session cookie
log << log1 << "SM: cannot create a session id (temporary used: with id 0)" << logend;
SetTemporarySession();
}
}
void SessionManager::SetTemporarySession()
{
session = &temporary_session;
session->Clear(false);
session->SetTimesTo(cur->request->start_time);
session->new_session = false; // temporary session was initialized at the beginning
}
bool SessionManager::SetSessionFromCookie(const std::string & cookie)
{
long id = Tol(cookie.c_str());
SessionContainer::Iterator s = session_tab.FindById(id);
if( s == session_tab.End() || s->remove_me )
return false;
// that session is in the table
session = &(*s);
session->new_session = false;
session->last_time = cur->request->start_time;
session->last_date = cur->request->start_time;
if( cur->request->method == Request::get )
session->last_time_get = cur->request->start_time;
log << log2 << "SM: session: " << session->id;
if( session->puser )
log << log2 << ", user: " << session->puser->name << ", id: " << session->puser->id;
log << log2 << logend;
return true;
}
void SessionManager::SetSession()
{
current_ip_ban = ban_tab.FindIP(cur->request->ip);
if( current_ip_ban && current_ip_ban->IsIPBanned() )
{
if( current_ip_ban->expires != 0 && cur->request->start_time >= current_ip_ban->expires )
{
log << log2 << "SM: removing a ban from this IP and resetting events counter" << logend;
current_ip_ban->ClearAfterRemovingBan();
}
else
{
log << log2 << "SM: this ip is bannned, using a temporary session" << logend;
SetTemporarySession();
session->ip_ban = current_ip_ban;
return;
}
}
CookieTab::iterator i = cur->request->cookie_tab.find(config->http_session_id_name);
if( i == cur->request->cookie_tab.end() )
{
CreateSession();
}
else
{
if( !SetSessionFromCookie(i->second) )
{
// there is no such a session
// deleting the old cookie
cur->request->cookie_tab.erase(i);
// and creating a new one
CreateSession();
}
}
session->ip_ban = current_ip_ban;
}
Session * SessionManager::FindSession(long id)
{
SessionContainer::Iterator i = session_tab.FindById(id);
if( i != session_tab.End() )
return &*i;
return 0;
}
SessionContainer::Iterator SessionManager::SessionBegin()
{
return session_tab.Begin();
}
SessionContainer::Iterator SessionManager::SessionEnd()
{
return session_tab.End();
}
void SessionManager::DeleteSessions()
{
SessionContainer::Iterator i;
for(i=session_tab.Begin() ; i!=session_tab.End() ; ++i)
{
if( i->puser && !i->remember_me )
{
plugin.Call(&(*i), WINIX_PREPARE_USER_TO_LOGOUT, i->puser);
last_container->UserLogout(i->puser->id, i->id);
}
}
session_tab.Clear();
}
/*
don't change a session's id when a user is logged
the session id is in last_container and the user would not be
correctly removed from the container
*/
bool SessionManager::ChangeSessionId(long old_id)
{
int attempts = 100;
bool changed = false;
long new_id;
SessionContainer::Iterator i = session_tab.FindById(old_id);
if( i != session_tab.End() )
{
for( ; !changed && attempts > 0 ; --attempts )
{
new_id = CreateSessionId();
changed = session_tab.ChangeSessionId(i, new_id);
}
if( changed )
plugin.Call(&(*i), WINIX_SESSION_CHANGED_ID, old_id, new_id);
else
log << log1 << "SM: I cannot create a new session id (still uses old one)" << logend;
}
else
{
log << log2 << "SM: there is no a session with id: " << old_id << logend;
}
return changed;
}
void SessionManager::InitTmpSession()
{
Session * old_session = cur->session;
log << log4 << "SM: initializing temporary session" << logend;
cur->session = &temporary_session;
plugin.Call(WINIX_SESSION_CREATED);
cur->session = old_session;
}
void SessionManager::UninitTmpSession()
{
Session * old_session = cur->session;
log << log4 << "SM: uninitializing temporary session" << logend;
cur->session = &temporary_session;
cur->session->plugin_data.DeleteAll(); // this will call plugin.Call(WINIX_PLUGIN_SESSION_DATA_REMOVE);
cur->session->plugin_data.Resize(0);
cur->session = old_session;
}
void SessionManager::LoadSessions()
{
SessionParser sp;
SessionContainer::Iterator i;
// sessions will be overwritten (pointers are invalidated)
cur->session = &temporary_session;
sp.SetUsers(&system->users);
sp.Parse(config->session_file, session_tab);
for(i=session_tab.Begin() ; i != session_tab.End() ; ++i)
{
i->plugin_data.Resize(plugin.Size());
plugin.Call(&(*i), WINIX_SESSION_CREATED);
/*
!! IMPROVE ME
we do not add it to the last_container (we don't have IP address stored yet)
*/
if( i->puser )
plugin.Call(&(*i), WINIX_USER_LOGGED);
}
cur->session = &temporary_session;
}
void SessionManager::SaveSessions()
{
if( config->session_file.empty() )
return;
std::ofstream file(config->session_file.c_str());
if( !file )
{
log << log1 << "SM: cannot open the session file for writing - sessions lost" << logend;
return;
}
log << log2 << "SM: saving sessions" << logend;
long len = 0;
SessionContainer::Iterator i = session_tab.Begin();
for( ; i!=session_tab.End() ; ++i )
{
if( i->id != 0 && i->puser && !i->remove_me )
{
file << i->id << ' ' << i->puser->id << ' ' << i->remember_me << ' ';
file << (long)i->start_time << ' ' << (long)i->last_time << std::endl;
++len;
}
}
file.close();
chmod(config->session_file.c_str(), 0600);
log << log2 << "SM: saved " << len << " session(s)" << logend;
}
Session * SessionManager::GetTmpSession()
{
return &temporary_session;
}
Session * SessionManager::GetCurSession()
{
return session;
}
// returns how many sessions was marked to remove
size_t SessionManager::MarkAllSessionsToRemove(long user_id)
{
size_t how_many = 0;
SessionContainer::Iterator i;
for(i=session_tab.Begin() ; i!=session_tab.End() ; ++i)
{
if( i->puser && i->puser->id == user_id )
{
plugin.Call(&(*i), WINIX_PREPARE_USER_TO_LOGOUT, i->puser);
last_container->UserLogout(i->puser->id, i->id);
i->remove_me = true;
i->puser = 0;
how_many += 1;
}
}
return how_many;
}
IPBan & SessionManager::AddIPToBanList(int ip)
{
return ban_tab.AddIP(ip);
}
size_t SessionManager::BanListSize()
{
return ban_tab.Size();
}
IPBan & SessionManager::GetIPBan(size_t index)
{
return ban_tab.GetIPBan(index);
}
void SessionManager::RemoveIPBan(int ip)
{
ban_tab.RemoveIP(ip);
}
void SessionManager::ClearIPBanList()
{
ban_tab.Clear();
}
/*
*
*
* sessions gc (second thread)
* sessions are only removed here
* SessionContainer::IndexId can be removed from the other thread
* (when ChangeSessionId() method is called)
*
*/
void SessionManager::Work()
{
bool exit = false;
SessionContainer::Iterator i;
deleted = 0;
Lock();
i = session_tab.Begin();
Unlock();
while( !exit )
{
Lock();
CheckWheterIPListIsSorted();
CheckSession(i);
exit = synchro->was_stop_signal;
Unlock();
}
}
// objects locked
void SessionManager::CheckWheterIPListIsSorted()
{
if( !ban_tab.IsSorted() )
{
log << log4 << "SM: sorting the ban list" << logend;
ban_tab.Sort();
}
}
// it's called from the other thread (with Lock and Unlock)
void SessionManager::CheckSession(SessionContainer::Iterator & i)
{
const int deleted_max_at_once = 10;
if( i == session_tab.End() )
{
if( deleted > 0 )
{
deleted = 0;
log << logsave;
}
i = session_tab.Begin();
WaitForSignalSleep(10);
}
else
{
if( i->remove_me || IsSessionOutdated(*i) )
{
Session * ses = &(*i);
++i;
DeleteSession(ses);
++deleted;
}
else
{
++i;
}
if( deleted >= deleted_max_at_once )
{
log << logsave;
WaitForSignalSleep(1);
deleted = 0;
}
}
}
// it's called from the other thread (with Lock and Unlock)
bool SessionManager::IsSessionOutdated(const Session & s) const
{
bool outdated;
if( s.remember_me )
{
outdated = s.last_time < std::time(0) - config->session_remember_max_idle;
}
else
{
outdated = s.last_time < std::time(0) - config->session_max_idle;
}
return outdated;
}
// it's called from the other thread (with Lock and Unlock)
void SessionManager::DeleteSession(Session * del_session)
{
if( del_session->puser )
{
plugin.Call(del_session, WINIX_PREPARE_USER_TO_LOGOUT, del_session->puser);
last_container->UserLogout(del_session->puser->id, del_session->id);
del_session->puser = 0;
}
long id = del_session->id;
plugin.Call(del_session, WINIX_PREPARE_SESSION_TO_REMOVE);
session_tab.EraseById(del_session->id);
plugin.Call((Session*)0, WINIX_SESSION_REMOVED, id);
}
/*
*
*
* end of sessions gc
*
*
*/

View File

@ -1,105 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_sessionmanager
#define headerfile_winix_core_sessionmanager
#include <set>
#include <ctime>
#include "sessioncontainer.h"
#include "ipbancontainer.h"
#include "config.h"
#include "request.h"
#include "lastcontainer.h"
#include "system.h"
#include "synchro.h"
#include "basethread.h"
class SessionManager : public BaseThread
{
public:
SessionManager();
void SetCur(Cur * pcur);
void SetConfig(Config * pconfig);
void SetSystem(System * psystem);
void SetLastContainer(LastContainer * plast_container);
// can return a null pointer
Session * FindSession(long id);
void SetSession();
void DeleteSessions(); // deleting all sessions
bool ChangeSessionId(long old_id);
void InitBanList();
void InitTmpSession();
void UninitTmpSession();
Session * GetTmpSession();
Session * GetCurSession();
void LoadSessions();
void SaveSessions();
SessionContainer::Iterator SessionBegin();
SessionContainer::Iterator SessionEnd();
size_t Size();
size_t MarkAllSessionsToRemove(long user_id);
IPBan & AddIPToBanList(int ip);
size_t BanListSize();
IPBan & GetIPBan(size_t index);
void RemoveIPBan(int ip);
void ClearIPBanList();
private:
Config * config;
Cur * cur;
System * system;
LastContainer * last_container;
// current session - set by SetSession()
Session * session;
SessionContainer session_tab;
IPBanContainer ban_tab;
IPBan * current_ip_ban;
// session with id 0
Session temporary_session;
bool IsSession(long s);
long CreateSessionId();
void CreateSession();
bool SetSessionFromCookie(const std::string & cookie);
void SetTemporarySession();
// second thread
int deleted;
virtual void Work();
void CheckSession(SessionContainer::Iterator & i);
bool IsSessionOutdated(const Session & s) const;
void DeleteSession(Session * del_session);
void CheckWheterIPListIsSorted();
};
#endif

View File

@ -1,50 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_sessionparser
#define headerfile_winix_core_sessionparser
#include <fstream>
#include <string>
#include "session.h"
#include "sessioncontainer.h"
#include "users.h"
class SessionParser
{
public:
bool Parse(const char * path, SessionContainer & container);
bool Parse(const std::string & path, SessionContainer & container);
void SetUsers(Users * pusers);
private:
Users * users;
bool Parse(SessionContainer & container);
void MakeSession(long id, long user_id, SessionContainer & container);
bool IsWhite(int c);
bool IsDigit(int c);
void SkipWhite();
void SkipLine();
long ReadLong();
std::ifstream file;
int last; // last character
};
#endif

View File

@ -1,57 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include <errno.h>
#include "synchro.h"
Synchro::Synchro() : mutex(PTHREAD_MUTEX_INITIALIZER)
{
was_stop_signal = false;
ref = 0;
}
bool Synchro::Lock()
{
int res = pthread_mutex_lock(&mutex);
if( res == EDEADLK )
{
// Lock() method in this thread was called before
ref += 1;
return true;
}
else
{
ref = 0;
}
return res == 0;
}
void Synchro::Unlock()
{
if( ref > 0 )
{
ref -= 1;
}
else
{
pthread_mutex_unlock(&mutex);
}
}

View File

@ -1,43 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_synchro
#define headerfile_winix_core_synchro
#include <pthread.h>
struct Synchro
{
// one global mutex
pthread_mutex_t mutex;
// true when winix is closing
volatile bool was_stop_signal;
Synchro();
bool Lock();
void Unlock();
private:
// deadlock counter
// we can call Lock() more than one in the same thread
int ref;
};
#endif

View File

@ -1,349 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_textstream
#define headerfile_winix_core_textstream
#include <string>
#include <ctime>
#include "misc.h"
#include "space/space.h"
#include "date/date.h"
#include "textstream/textstream.h"
/*
a special class representing a stream buffer
similar to std::ostringstream
StringType can be either std::string or std::wstring
this class doesn't use UTF-8 in any kind
*/
template<class StringType>
class TextStream
{
public:
typedef typename StringType::value_type CharType;
typedef typename StringType::value_type char_type;
void Clear();
bool Empty() const;
size_t Size() const;
void Reserve(size_t len);
const StringType & Str() const;
const CharType * CStr() const;
CharType operator[](size_t index);
TextStream & operator<<(const char * str);
TextStream & operator<<(const std::string * str);
TextStream & operator<<(const std::string & str);
TextStream & operator<<(const wchar_t * str);
TextStream & operator<<(const std::wstring * str);
TextStream & operator<<(const std::wstring & str);
TextStream & operator<<(char);
TextStream & operator<<(wchar_t);
TextStream & operator<<(int);
TextStream & operator<<(long);
TextStream & operator<<(unsigned int);
TextStream & operator<<(unsigned long);
TextStream & operator<<(double);
TextStream & operator<<(const void *);// printing a pointer
TextStream & operator<<(const PT::Space & space);
TextStream & operator<<(const PT::Date & date);
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 & Write(const char * buf, size_t len);
TextStream & Write(const wchar_t * buf, size_t len);
TextStream & write(const char * buf, size_t len); // for compatibility with standard library (Ezc uses it)
TextStream & write(const wchar_t * buf, size_t len);
protected:
StringType buffer;
std::wstring space_str; // for using with spaces
};
template<class StringType>
void TextStream<StringType>::Clear()
{
buffer.clear();
}
template<class StringType>
bool TextStream<StringType>::Empty() const
{
return buffer.empty();
}
template<class StringType>
size_t TextStream<StringType>::Size() const
{
return buffer.size();
}
template<class StringType>
void TextStream<StringType>::Reserve(size_t len)
{
buffer.reserve(len);
}
template<class StringType>
const StringType & TextStream<StringType>::Str() const
{
return buffer;
}
template<class StringType>
const typename TextStream<StringType>::CharType * TextStream<StringType>::CStr() const
{
return buffer.c_str();
}
template<class StringType>
typename TextStream<StringType>::CharType TextStream<StringType>::operator[](size_t index)
{
return buffer[index];
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const char * str)
{
AssignString(str, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const std::string * str)
{
AssignString(*str, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const std::string & str)
{
AssignString(str, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const wchar_t * str)
{
AssignString(str, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const std::wstring * str)
{
AssignString(*str, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const std::wstring & str)
{
AssignString(str, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(char v)
{
buffer += v;
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(wchar_t v)
{
buffer += static_cast<CharType>(v);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(int v)
{
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
Toa(v, buf, len);
AssignString(buf, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(long v)
{
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
Toa(v, buf, len);
AssignString(buf, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(unsigned int v)
{
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
Toa(v, buf, len);
AssignString(buf, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(unsigned long v)
{
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
Toa(v, buf, len);
AssignString(buf, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(double v)
{
char buf[50];
sprintf(buf, "%f", v);
AssignString(buf, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const void * v)
{
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
buf[0] = '0';
buf[1] = 'x';
Toa(reinterpret_cast<unsigned long>(v), buf+2, len-2, 16);
AssignString(buf, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::Write(const char * buf, size_t len)
{
AssignString(buf, len, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::write(const char * buf, size_t len)
{
return Write(buf, len);
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::Write(const wchar_t * buf, size_t len)
{
AssignString(buf, len, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::write(const wchar_t * buf, size_t len)
{
return Write(buf, len);
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const PT::Space & space)
{
space.Serialize(*this, true, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const PT::Date & date)
{
date.Serialize(*this);
return *this;
}
template<class StringType>
template<typename arg_char_type, size_t arg_stack_size, size_t arg_heap_block_size>
TextStream<StringType> & TextStream<StringType>::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;
for(i=arg.begin() ; i != arg.end() ; ++i)
buffer += static_cast<char_type>(*i);
return *this;
}
#endif

View File

@ -1,136 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include <signal.h>
#include "threadmanager.h"
#include "log.h"
ThreadManager::ThreadManager()
{
were_started = false;
}
void ThreadManager::SetSynchro(Synchro * psynchro)
{
synchro = psynchro;
}
void ThreadManager::Init()
{
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGTERM);
sigaddset(&set, SIGINT);
// blocking SIGTERM and SIGINT
// new threads will have the signals blocked too
pthread_sigmask(SIG_BLOCK, &set, 0);
}
void ThreadManager::Add(BaseThread * pbase, const wchar_t * thread_name)
{
ThreadItem item;
item.object = pbase;
item.name = thread_name;
thread_tab.push_back(item);
if( were_started )
Start(thread_tab.size() - 1);
else
log << log4 << "TM: added a thread to the queue, number: " << (thread_tab.size()-1)
<< ", name: " << thread_name << logend;
}
void ThreadManager::Add(BaseThread & pbase, const wchar_t * thread_name)
{
Add(&pbase, thread_name);
}
void ThreadManager::Add(BaseThread * pbase, const std::wstring & thread_name)
{
Add(pbase, thread_name.c_str());
}
void ThreadManager::Add(BaseThread & pbase, const std::wstring & thread_name)
{
Add(&pbase, thread_name.c_str());
}
void ThreadManager::StartAll()
{
synchro->Lock();
for(size_t i=0 ; i<thread_tab.size() ; ++i)
Start(i);
synchro->Unlock();
were_started = true;
}
void ThreadManager::Start(size_t i)
{
if( i < thread_tab.size() )
{
thread_tab[i].object->SetSynchro(synchro);
if( thread_tab[i].object->StartThread() )
{
log << log4 << "TM: thread " << i << " (" << thread_tab[i].object->ThreadId() << ", name: "
<< thread_tab[i].name << ") started" << logend;
}
else
{
log << log4 << "TM: cannot run a thread, thread number: " << i
<< ", name: " << thread_tab[i].name << logend;
}
}
}
void ThreadManager::StopAll()
{
if( !were_started )
return;
// WakeUpThread() should be used with Lock/Unlock
synchro->Lock();
for(size_t i=0 ; i<thread_tab.size() ; ++i)
thread_tab[i].object->WakeUpThread();
synchro->Unlock();
for(size_t i=0 ; i<thread_tab.size() ; ++i)
{
log << log4 << "TM: waiting for thread " << i << " (" << thread_tab[i].object->ThreadId()
<< ", name: " << thread_tab[i].name << ")" << logend;
thread_tab[i].object->WaitForThread();
log << log4 << "TM: thread " << i << " terminated" << logend;
}
}

View File

@ -1,65 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_threadmanager
#define headerfile_winix_core_threadmanager
#include <string>
#include <vector>
#include "basethread.h"
#include "synchro.h"
class ThreadManager
{
public:
ThreadManager();
// synchro object
void SetSynchro(Synchro * psynchro);
// initializing
void Init();
// adding a new thread to the queue
// the thread will be running only if we call StartAll() before
// otherwise the thread will be waiting for StartAll()
void Add(BaseThread * pbase, const wchar_t * thread_name);
void Add(BaseThread & pbase, const wchar_t * thread_name);
void Add(BaseThread * pbase, const std::wstring & thread_name);
void Add(BaseThread & pbase, const std::wstring & thread_name);
// starting all threads
void StartAll();
// sending a stop signal to all threads
// and waiting until they finish
void StopAll();
private:
struct ThreadItem
{
BaseThread * object;
std::wstring name;
};
Synchro * synchro;
typedef std::vector<ThreadItem> ThreadTab;
ThreadTab thread_tab;
bool were_started;
void Start(size_t i);
};
#endif

View File

@ -1,289 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "timezone.h"
#include "misc.h"
TimeZone::Dst::Dst()
{
Clear();
}
void TimeZone::Dst::Clear()
{
has_dst = false;
start.Clear();
end.Clear();
offset = 0;
}
bool TimeZone::Dst::IsDstUsed(const PT::Date & date) const
{
if( !has_dst )
return false;
if( Compare(start, date) <= 0 ) // !! CHECK ME <= or < ? (what about the one second?)
if( Compare(date, end) < 0 )
return true;
return false;
}
int TimeZone::Dst::Compare(const PT::Date & date1, const PT::Date & date2) const
{
// year is ignored
if( date1.month != date2.month )
return date1.month - date2.month;
if( date1.day != date2.day )
return date1.day - date2.day;
if( date1.hour != date2.hour )
return date1.hour - date2.hour;
if( date1.min != date2.min )
return date1.min - date2.min;
if( date1.sec != date2.sec )
return date1.sec - date2.sec;
// dates are equal
return 0;
}
TimeZone::TimeZone()
{
Clear();
}
void TimeZone::Clear()
{
name.clear();
id = 0;
offset = 0;
dst_map.clear();
}
TimeZone::Dst * TimeZone::FindDst(int year)
{
if( dst_map.empty() )
return 0;
DstMap::iterator i = dst_map.lower_bound(year);
if( i == dst_map.begin() && i->first > year )
return 0;
if( i == dst_map.end() )
return &(--i)->second;
if( i != dst_map.begin() && i->first > year )
return &(--i)->second;
return &i->second;
}
time_t TimeZone::CalcLocalOffset(const PT::Date & utc_date)
{
time_t dst_offset = 0;
Dst * dst = FindDst(utc_date.year);
if( dst && dst->IsDstUsed(utc_date) )
dst_offset = dst->offset;
return offset + dst_offset;
}
time_t TimeZone::ToLocal(time_t utc_time)
{
time_t offset = CalcLocalOffset(PT::Date(utc_time));
return utc_time + offset;
}
PT::Date TimeZone::ToLocal(const PT::Date & utc_date)
{
PT::Date local(utc_date);
local += CalcLocalOffset(utc_date);
return local;
}
time_t TimeZone::CalcUTCOffset(const PT::Date & local_date)
{
time_t dst_offset = 0;
Dst * dst = FindDst(local_date.year);
if( dst && dst->has_dst )
{
// dst date ranges we have in UTC
PT::Date utc(local_date);
utc -= (offset + dst->offset);
if( dst->IsDstUsed(utc) )
dst_offset = dst->offset;
}
return offset + dst_offset;
}
time_t TimeZone::ToUTC(time_t local_time)
{
time_t offset = CalcUTCOffset(PT::Date(local_time));
return local_time - offset;
}
PT::Date TimeZone::ToUTC(const PT::Date & local_date)
{
time_t offset;
PT::Date utc(local_date);
offset = CalcUTCOffset(local_date);
utc -= offset;
return utc;
}
time_t TimeZone::ParseStrOffset(const wchar_t * str)
{
PT::Date date;
bool is_sign = false;
time_t offset = 0;
str = SkipWhite(str);
if( *str == '-' )
{
is_sign = true;
str += 1;
}
else
if( *str == '+' )
{
str += 1;
}
if( date.ParseTime(str) )
{
offset = date.hour * 60 * 60 + date.min * 60 + date.sec;
if( is_sign )
offset = -offset;
}
return offset;
}
time_t TimeZone::GetOffset(PT::Space & space)
{
std::wstring * offset_str = space.GetValue(L"offset_str");
if( offset_str )
return ParseStrOffset(offset_str->c_str());
return space.Long(L"offset");
}
bool TimeZone::SetTzDst(PT::Space & year)
{
time_t h24 = 60 * 60 * 24; // 24 hours
bool result = true;
Dst dst;
int year_int = Toi(year.name);
if( year_int < 1970 && year_int > 10000 )
return false;
dst.has_dst = year.Bool(L"has_dst", false);
if( dst.has_dst )
{
dst.start.year = year_int;
dst.end.year = year_int;
if( !dst.start.ParseMonthDayTime(year.Text(L"start")) )
result = false;
if( !dst.end.ParseMonthDayTime(year.Text(L"end")) )
result = false;
dst.offset = GetOffset(year);
if( dst.offset < -h24 || dst.offset > h24 )
result = false;
}
if( result )
dst_map[year_int] = dst;
return result;
}
bool TimeZone::SetTz(PT::Space & space)
{
bool result = true;
name = space.name;
id = space.Int(L"id", -1);
offset = GetOffset(space);
time_t h24 = 60 * 60 * 24; // 24 hours
if( offset < -h24 || offset > h24 )
result = false;
PT::Space & dst = space.FindAddSpace(L"dst");
for(size_t i=0 ; i<dst.spaces.size() ; ++i)
{
PT::Space & year = *dst.spaces[i];
if( !SetTzDst(year) )
{
result = false;
break;
}
}
return result;
}

View File

@ -1,142 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_timezone
#define headerfile_winix_core_timezone
#include <ctime>
#include <map>
#include "date/date.h"
#include "space/space.h"
class TimeZone
{
public:
struct Dst
{
// true if a time zone has daylight saving time
bool has_dst;
// time zone daylight saving time (used if has_dst is true)
// the 'year' field is the same in 'start' and 'end'
// start and end are represented in UTC time
PT::Date start, end;
// time zone daylight saving time offset
// used when has_dst is true and the date is whithin start and end
// this offset should be added to time zone offset
time_t offset;
Dst();
void Clear();
// checking whether specified 'date' is in the range of <start, end>
// the year field in date, start and end is ignored
// has_dst must be true
bool IsDstUsed(const PT::Date & date) const;
private:
// Compare returns zero if date1 and date2 are equal
// return value less than zero if date1 is lower than date2
// and a value greater than zero if date1 is greater than date2
// the year field is ignored
int Compare(const PT::Date & date1, const PT::Date & date2) const;
};
TimeZone();
/*
*/
void Clear();
/*
reading zime zone values from Space struct (tz_id is skipped)
the space struct should have:
"tz_offset" (long)
"tz_has_dst" (bool)
if tz_has_dst is true then also:
"tz_dst_start" date in the following format: MM:DD HH[:MM[:SS]]
"tz_dst_end" the same as above
"tz_dst_offset" (long)
*/
bool SetTz(PT::Space & space);
/*
converting from UTC to local time
*/
time_t CalcLocalOffset(const PT::Date & utc_date);
time_t ToLocal(time_t utc_time);
PT::Date ToLocal(const PT::Date & utc_date);
/*
converting from local time to UTC
*/
time_t CalcUTCOffset(const PT::Date & local_date);
time_t ToUTC(time_t local_time);
PT::Date ToUTC(const PT::Date & local_date);
// return a Dst structure for the specified year
// or null if it not exists
// this method can return a Dst structure for earlier year than 'year'
// if 'year' doesn't exist
Dst * FindDst(int year);
// a time zone name
// this is a key to locale
std::wstring name;
// each locale has its own identifier
size_t id;
// time zone offset (in seconds)
time_t offset;
// daylight saving time map
// year -> Dst
// if there is not a specified year we are taking the lower year, e.g.
// if we are looking for 2010 and there is no such a year then we take 2009
// (or 2008 if 2009 not exists etc)
typedef std::map<int, Dst> DstMap;
DstMap dst_map;
private:
time_t ParseStrOffset(const wchar_t * str);
time_t GetOffset(PT::Space & space);
bool SetTzDst(PT::Space & year);
};
#endif

View File

@ -1,178 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "timezones.h"
#include "misc.h"
#include "log.h"
TimeZones::TimeZones()
{
Clear();
}
void TimeZones::Clear()
{
zone_tab.clear();
for(size_t i=0 ; i<zone_indices.size() ; ++i)
zone_indices[i] = size_t(-1);
}
void TimeZones::SetTimeZoneMaxId(size_t max_id)
{
if( max_id > 1000 )
{
max_id = 1000;
log << log1 << "TZ: time_zone_max_id is too big (changed to 1000)" << logend;
}
size_t old_size = zone_indices.size();
zone_indices.resize(max_id + 1);
for(size_t i=old_size ; i<zone_indices.size() ; ++i)
zone_indices[i] = size_t(-1);
}
bool TimeZones::HasZone(size_t zone_id)
{
if( zone_id < zone_indices.size() )
return zone_indices[zone_id] < zone_tab.size();
return false;
}
TimeZone * TimeZones::GetZone(size_t zone_id)
{
if( zone_id < zone_indices.size() )
{
size_t index = zone_indices[zone_id];
if( index < zone_tab.size() )
return &zone_tab[index];
}
return 0;
}
TimeZone * TimeZones::GetZoneByIndex(size_t zone_index)
{
if( zone_index < zone_tab.size() )
return &zone_tab[zone_index];
return 0;
}
size_t TimeZones::Size() const
{
return zone_tab.size();
}
bool TimeZones::Empty() const
{
return zone_tab.empty();
}
void TimeZones::ParseZones()
{
for(size_t i=0 ; i<temp_space.spaces.size() ; ++i)
{
PT::Space & zone = *temp_space.spaces[i];
temp_zone.Clear();
if( temp_zone.SetTz(zone) )
{
if( !HasZone(temp_zone.id) )
{
if( temp_zone.id < zone_indices.size() )
{
zone_tab.push_back(temp_zone);
zone_indices[temp_zone.id] = zone_tab.size() - 1;
}
else
{
log << log1 << "Tz: zone: " << temp_zone.name << " has too big id: "
<< temp_zone.id << " (skipping)" << logend;
}
}
else
{
log << log1 << "Tz: zone with id: " << temp_zone.id
<< " already exists (skipping)" << logend;
}
}
else
{
log << log1 << "System: problem with reading time zone info from time zone: "
<< zone.name << " (skipping) " << logend;
}
}
}
// !! IMPROVE ME
// in the future we do not have to read the whole file
// just space by space (not implemented in Space at the moment)
bool TimeZones::ReadTimeZones(const wchar_t * path)
{
parser.UTF8(true);
parser.SetSpace(temp_space);
zone_tab.clear();
temp_space.Clear();
PT::SpaceParser::Status status = parser.Parse(path);
if( status == PT::SpaceParser::ok )
{
ParseZones();
log << log2 << "Tz: time zones loaded, there are " << zone_tab.size() << " zones" << logend;
}
else
if( status == PT::SpaceParser::syntax_error )
{
log << log1 << "TZ: error in time zone file, line: " << parser.line << logend;
}
else
if( status == PT::SpaceParser::cant_open_file )
{
log << log1 << "TZ: I cannot open the time zone file: " << path << logend;
}
temp_space.Clear();
return status == PT::SpaceParser::ok;
}
bool TimeZones::ReadTimeZones(const std::wstring & path)
{
return ReadTimeZones(path.c_str());
}

View File

@ -1,65 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "user.h"
User::User()
{
Clear();
}
void User::Clear()
{
id = -1;
name.clear();
super_user = false;
groups.clear();
email.clear();
notify = 0;
env.Clear();
aenv.Clear();
status = WINIX_ACCOUNT_BLOCKED;
locale_id = 0;
time_zone_id = 0;
}
bool User::IsMemberOf(long group)
{
std::vector<long>::iterator i;
for(i=groups.begin() ; i!=groups.end() ; ++i)
if( *i == group )
return true;
return false;
}

View File

@ -1,108 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_user
#define headerfile_winix_core_user
#include <string>
#include <vector>
#include "space/space.h"
#include "date/date.h"
#define WINIX_ACCOUNT_MAX_LOGIN_SIZE 250
#define WINIX_ACCOUNT_MAX_PASSWORD_SIZE 250
#define WINIX_ACCOUNT_MAX_EMAIL_SIZE 250
// account status
// 1 - a user has created its account -- an email was sent back to him
#define WINIX_ACCOUNT_NOT_ACTIVATED 1
// 2 - a user clicked on the link in the mail and now can normally use his account
#define WINIX_ACCOUNT_READY 2
// 3 - account was suspended
#define WINIX_ACCOUNT_SUSPENDED 3
// 4 - account was banned
#define WINIX_ACCOUNT_BLOCKED 4
/*
a user can login only to an account which status is equal to WINIX_ACCOUNT_READY
actually there is no difference between WINIX_ACCOUNT_SUSPENDED and WINIX_ACCOUNT_BANNED
only a different message will be present on the website
you can use other values of status in your plugins - this not have any impact on winix
the default 'login' winix function only allowes to login a user who has WINIX_ACCOUNT_READY value
but you can provide your own 'login' function which can work in a different way
winix knows that user is login when cur->session->puser pointer is set
(when the pointer is not null then winix do not check what the value of 'status' is --
the status is only tested in 'login' function)
*/
/*
a temporary struct used for hashing and encrypting a user's password
*/
struct UserPass
{
int pass_type; // the kind of hash (WINIX_CRYPT_HASH_* see crypt.h)
std::wstring pass; // password hashed or plain text if pass_type==0
std::string pass_encrypted; // password encrypted
bool pass_hash_salted; // true when the hash was salted (plain text passwords are never salted)
};
struct User
{
long id;
std::wstring name;
bool super_user;
std::vector<long> groups;
std::wstring email;
int notify;
// environment variables which can be set by this user
// use 'env' winix function
PT::Space env;
// environment variables set only by an administrator
// an administrator can use 'env' winix function with 'a' parameter
PT::Space aenv;
// account status
// WINIX_ACCOUNT_*
// a user can normally login only when status is WINIX_ACCOUNT_READY
int status;
// locale identifier
size_t locale_id;
// time zone identifier
size_t time_zone_id;
User();
void Clear();
bool IsMemberOf(long group);
bool ReadMonthDayTime(PT::Date & date, const wchar_t * str);
bool SetTzFromEnv();
};
#endif

View File

@ -1,294 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include <arpa/inet.h>
#include "users.h"
#include "sessionmanager.h"
#include "plugin.h"
Users::Users()
{
how_many_logged = 0; // !! CHECK ME may it should be moved to Clear() method?
Clear();
}
void Users::SetCur(Cur * pcur)
{
cur = pcur;
}
void Users::SetSessionManager(SessionManager * sm)
{
session_manager = sm;
}
void Users::Clear()
{
table.Clear();
}
void Users::ReadUsers(Db * db)
{
Clear();
db->GetUsers(table);
}
bool Users::AddUser(const User & user)
{
Table::Iterator i = table.PushBack(user);
return (i != table.End());
}
bool Users::IsUser(const std::wstring & name)
{
return table.Is(name);
}
User * Users::GetUser(long user_id)
{
Table::Iterator i = table.FindId(user_id);
if( i == table.End() )
return 0;
return &(*i);
}
User * Users::GetUser(const std::wstring & name)
{
Table::Iterator i = table.FindName(name);
if( i == table.End() )
return 0;
return &(*i);
}
long Users::GetUserId(const std::wstring & name)
{
User * puser = GetUser(name);
if( !puser )
return -1;
return puser->id;
}
Users::Iterator Users::Begin()
{
return table.Begin();
}
Users::Iterator Users::End()
{
return table.End();
}
Users::SizeType Users::Size()
{
return table.Size();
}
bool Users::Remove(long user_id)
{
bool result = false;
User * puser = GetUser(user_id);
if( puser )
{
LogoutUser(user_id);
plugin.Call(WINIX_PREPARE_TO_REMOVE_USER, puser);
result = table.Remove(user_id);
if( result )
plugin.Call(WINIX_USER_REMOVED, user_id);
}
return result;
}
// private
bool Users::LoginUserCheckSession(bool use_ses_log)
{
if( !cur->session )
return false;
if( cur->session->id == 0 )
{
log << log1 << "Users: I cannot login a user on a temporary session" << logend;
if( use_ses_log )
slog << logerror << T(L"service_unavailable") << logend;
return false;
}
return true;
}
// private
User * Users::LoginUserCheckStatus(long user_id, bool use_ses_log)
{
User * puser = GetUser(user_id);
if( !puser )
{
log << log1 << "Users: user id: " << user_id << " is not in system.users table" << logend;
if( use_ses_log )
slog << logerror << T(L"service_unavailable") << logend;
return 0;
}
if( puser->status != WINIX_ACCOUNT_READY )
{
log << log1 << "Users: user id: " << user_id << " is not ready for logging in (status: "
<< puser->status << ")" << logend;
if( use_ses_log )
{
if( puser->status == WINIX_ACCOUNT_NOT_ACTIVATED )
slog << logerror << T(L"account_not_activated") << logend;
else
if( puser->status == WINIX_ACCOUNT_SUSPENDED )
slog << logerror << T(L"account_suspended") << logend;
else
if( puser->status == WINIX_ACCOUNT_BLOCKED )
slog << logerror << T(L"account_banned") << logend;
}
return 0;
}
return puser;
}
bool Users::LoginUser(long user_id, bool remember_me, bool use_ses_log)
{
if( !LoginUserCheckSession(use_ses_log) )
return false;
User * puser = LoginUserCheckStatus(user_id, use_ses_log);
if( !puser )
return false;
PluginRes res = plugin.Call(WINIX_PREPARE_USER_TO_LOGIN, puser);
if( res.res_false > 0 )
{
log << log3 << "Users: login prevented by a plugin" << logend;
return false;
}
if( cur->session->puser )
LogoutCurrentUser();
cur->session->puser = puser;
cur->session->spam_score = 0;
cur->session->remember_me = remember_me;
// change session id before last.UserLogin()
if( !cur->session->new_session )
session_manager->ChangeSessionId(cur->session->id);
last.UserLogin(user_id, cur->session->puser->name, inet_addr(cur->request->env_remote_addr), cur->session->id);
how_many_logged += 1;
log << log2 << "Users: user " << cur->session->puser->name << " (id: " << user_id << ") logged" << logend;
plugin.Call(WINIX_USER_LOGGED);
return true;
}
size_t Users::LogoutUser(long user_id)
{
size_t how_many = 0;
User * puser = GetUser(user_id);
if( puser )
{
log << log2 << "Users: logging out user " << puser->name << ", id: "
<< puser->id << " from all sessions" << logend;
// WINIX_PREPARE_USER_TO_LOGOUT will be sent by MarkAllSessionsToRemove()
how_many = session_manager->MarkAllSessionsToRemove(user_id);
how_many_logged -= how_many;
if( how_many )
log << log3 << "Users: " << how_many << " user(s) were logged out" << logend;
}
return how_many;
}
void Users::LogoutCurrentUser()
{
if( !cur->session || !cur->session->puser )
return;
log << log2 << "Users: user " << cur->session->puser->name << ", id: "
<< cur->session->puser->id << " logged out" << logend;
plugin.Call(WINIX_PREPARE_USER_TO_LOGOUT, cur->session->puser);
last.UserLogout(cur->session->puser->id, cur->session->id);
if( how_many_logged > 0 ) // for safety
how_many_logged -= 1;
cur->session->puser = 0;
cur->session->remember_me = false;
}
void Users::IncrementLoggedUsers()
{
how_many_logged += 1;
}
long Users::HowManyLogged()
{
return how_many_logged;
}

View File

@ -1,78 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_users
#define headerfile_winix_core_users
#include <map>
#include "user.h"
#include "ugcontainer.h"
#include "lastcontainer.h"
#include "cur.h"
#include "db/db.h"
class SessionManager;
class Users
{
typedef UGContainer<User> Table;
public:
typedef Table::Iterator Iterator;
typedef Table::SizeType SizeType;
LastContainer last;
Users();
void SetCur(Cur * pcur);
void SetSessionManager(SessionManager * sm);
void Clear();
void ReadUsers(Db * db);
bool AddUser(const User & user);
bool IsUser(const std::wstring & name);
User * GetUser(long user_id);
User * GetUser(const std::wstring & name);
long GetUserId(const std::wstring & name);
Iterator Begin();
Iterator End();
SizeType Size();
bool Remove(long user_id);
bool LoginUser(long user_id, bool remember_me, bool use_ses_log = false);
size_t LogoutUser(long user_id);
void LogoutCurrentUser();
void IncrementLoggedUsers();
long HowManyLogged();
private:
Table table;
Cur * cur;
SessionManager * session_manager;
long how_many_logged;
bool LoginUserCheckSession(bool use_ses_log);
User * LoginUserCheckStatus(long user_id, bool use_ses_log);
};
#endif

View File

@ -1,19 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2013, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_version
#define headerfile_winix_core_version
#define WINIX_VER_MAJOR 0
#define WINIX_VER_MINOR 5
#define WINIX_VER_REVISION 3
#endif

View File

@ -1,19 +0,0 @@
include Makefile.o.dep
all: $(o)
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I.. -I../../ezc/src -I../../pikotools -I../../tito/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
clean:
rm -f *.o
include Makefile.dep

View File

@ -1,62 +0,0 @@
# DO NOT DELETE
db.o: db.h dbbase.h dbconn.h dbtextstream.h ../core/textstream.h
db.o: ../core/misc.h ../core/item.h ../../pikotools/space/space.h
db.o: ../../pikotools/textstream/types.h ../../pikotools/date/date.h
db.o: ../core/requesttypes.h ../../pikotools/textstream/textstream.h
db.o: ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h
db.o: ../../pikotools/membuffer/membuffer.h
db.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
db.o: ../core/error.h ../../pikotools/space/spaceparser.h
db.o: ../../pikotools/space/space.h dbitemquery.h ../core/item.h
db.o: dbitemcolumns.h ../core/user.h ../core/group.h ../core/dircontainer.h
db.o: ../core/ugcontainer.h ../core/log.h ../core/textstream.h
db.o: ../core/logmanipulators.h ../core/slog.h ../core/cur.h
db.o: ../core/request.h ../core/error.h ../core/config.h ../core/htmlfilter.h
db.o: ../templates/htmltextstream.h ../../pikotools/space/spacetojson.h
db.o: ../core/session.h ../core/user.h ../core/plugindata.h ../core/rebus.h
db.o: ../core/ipban.h ../core/mount.h ../templates/locale.h ../core/log.h
db.o: ../core/misc.h
dbbase.o: dbbase.h dbconn.h dbtextstream.h ../core/textstream.h
dbbase.o: ../core/misc.h ../core/item.h ../../pikotools/space/space.h
dbbase.o: ../../pikotools/textstream/types.h ../../pikotools/date/date.h
dbbase.o: ../core/requesttypes.h ../../pikotools/textstream/textstream.h
dbbase.o: ../../pikotools/convert/convert.h
dbbase.o: ../../pikotools/convert/inttostr.h
dbbase.o: ../../pikotools/membuffer/membuffer.h
dbbase.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
dbbase.o: ../core/error.h ../../pikotools/space/spaceparser.h
dbbase.o: ../../pikotools/space/space.h ../core/log.h ../core/misc.h
dbconn.o: dbconn.h dbtextstream.h ../core/textstream.h ../core/misc.h
dbconn.o: ../core/item.h ../../pikotools/space/space.h
dbconn.o: ../../pikotools/textstream/types.h ../../pikotools/date/date.h
dbconn.o: ../core/requesttypes.h ../../pikotools/textstream/textstream.h
dbconn.o: ../../pikotools/convert/convert.h
dbconn.o: ../../pikotools/convert/inttostr.h
dbconn.o: ../../pikotools/membuffer/membuffer.h
dbconn.o: ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.h
dbconn.o: ../core/log.h ../core/error.h
dbitemcolumns.o: dbitemcolumns.h ../core/item.h dbbase.h dbconn.h
dbitemcolumns.o: dbtextstream.h ../core/textstream.h ../core/misc.h
dbitemcolumns.o: ../core/item.h ../../pikotools/space/space.h
dbitemcolumns.o: ../../pikotools/textstream/types.h
dbitemcolumns.o: ../../pikotools/date/date.h ../core/requesttypes.h
dbitemcolumns.o: ../../pikotools/textstream/textstream.h
dbitemcolumns.o: ../../pikotools/convert/convert.h
dbitemcolumns.o: ../../pikotools/convert/inttostr.h
dbitemcolumns.o: ../../pikotools/membuffer/membuffer.h
dbitemcolumns.o: ../../pikotools/textstream/types.h
dbitemcolumns.o: ../../pikotools/utf8/utf8.h ../core/error.h
dbitemcolumns.o: ../../pikotools/space/spaceparser.h
dbitemcolumns.o: ../../pikotools/space/space.h ../core/log.h
dbitemquery.o: dbitemquery.h ../core/item.h
dbtextstream.o: dbtextstream.h ../core/textstream.h ../core/misc.h
dbtextstream.o: ../core/item.h ../../pikotools/space/space.h
dbtextstream.o: ../../pikotools/textstream/types.h
dbtextstream.o: ../../pikotools/date/date.h ../core/requesttypes.h
dbtextstream.o: ../../pikotools/textstream/textstream.h
dbtextstream.o: ../../pikotools/convert/convert.h
dbtextstream.o: ../../pikotools/convert/inttostr.h
dbtextstream.o: ../../pikotools/membuffer/membuffer.h
dbtextstream.o: ../../pikotools/textstream/types.h
dbtextstream.o: ../../pikotools/utf8/utf8.h

View File

@ -1 +0,0 @@
o = db.o dbbase.o dbconn.o dbitemcolumns.o dbitemquery.o dbtextstream.o

1734
db/db.cpp

File diff suppressed because it is too large Load Diff

145
db/db.h
View File

@ -1,145 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_db_db
#define headerfile_winix_db_db
#include <vector>
#include <map>
#include <cstdio>
#include <ctime>
#include <cstring>
#include "dbbase.h"
#include "dbitemquery.h"
#include "dbitemcolumns.h"
#include "core/item.h"
#include "core/user.h"
#include "core/group.h"
#include "core/dircontainer.h"
#include "core/ugcontainer.h"
class Db : public DbBase
{
public:
// !! przerobic tak aby GetItem zwracalo wszystkie pozycja
// !! GetFile tylko dla plikow
// !! GetDir tylko dla katalogow
// !! GetFile i GetDir beda uzywac GetItem
Db() : item_cols(*this)
{
}
bool GetUserPass(const std::wstring & login, long & user_id, UserPass & up);
Error AddUser(User & user, const UserPass & up);
Error ChangeUserPass(long user_id, const UserPass & up);
Error ChangeUserEnv(long user_id, const PT::Space & space);
Error ChangeUserAdminEnv(long user_id, const PT::Space & space);
Error ChangeUserStatus(long user_id, int status);
Error ChangeUserEmail(long user_id, const std::wstring & email);
Error ChangeUserLocale(long user_id, size_t locale_id);
Error ChangeUserTimeZone(long user_id, size_t time_zone_id);
Error RemoveUser(long user_id);
Error AddItem(Item & item);
Error EditItemById(Item & item, bool with_url = true);
Error EditItemByUrl(Item & item, bool with_url = true);
// !! nie zwracac zadnych kodow bledow?
void GetItems(std::vector<Item> & item_tab, const DbItemQuery & item_query);
void GetItems(std::vector<long> & item_tab, const DbItemQuery & item_query);
Error GetItem(Item & item, const DbItemQuery & item_query);
bool GetPriv(Item & item, long id);
Error EditPrivById(Item & item, long id); // !! dlaczego tu nie ma const?
Error EditParentUrlById(Item & item, long id);
Error EditFileById(const Item & item, long id); // file_path, file_fs, file_type
Error EditHasThumbById(bool has_thumb, long id);
Error EditMetaById(const PT::Space & meta, long id);
Error EditAdminMetaById(const PT::Space & meta, long id);
Error DelDirById(long id);
Error DelFileById(long file_id);
Error DelSymlinkById(long symlink_id);
Error EditSubjectById(Item & item, long id);
Error DelItem(const Item & item);
void GetDirs(DirContainer & dir_tab);
void GetUsers(UGContainer<User> & user_tab);
void GetGroups(UGContainer<Group> & group_tab);
// !! nowy interfejs
long Size(long parent_id, Item::Type type = Item::none);
Error GetItemById(long item_id, Item & item);
Error GetItem(long parent_id, const std::wstring & url, Item & item);
Error EditLinkItem(long id, const std::wstring & link_to, int link_redirect);
Error EditTemplateItemById(long id, const std::wstring & new_html_template);
long GetItemId(long parent_id, const std::wstring & url, Item::Type type);
long GetFileId(long parent_id, const std::wstring & url);
long GetDirId(long parent_id, const std::wstring & url);
Error AddHardLink(Item & item);
Error EditSortIndexItemById(long id, int sort_index);
protected:
DbTextStream query, query_create_url;
std::wstring temp_url;
Item dir_temp;
Item get_item_temp;
std::wstring iq_id_list;
DbItemColumns item_cols;
bool AddItemCreateUrlSubject(Item & item);
Error AddItemIntoContent(Item & item);
Error AddItemIntoItem(Item & item);
Error EditItemInItem(Item & item, bool with_url);
Error EditItemInContent(Item & item);
Error EditItemGetIdsByUrl(Item & item);
long GetContentId(long item_id);
Error DelItemDelItem(long item_id, int type);
Error DelItemDelContent(long content_id);
Error IncrementContentRef(long content_id);
Error DecrementContentRef(long content_id);
void GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query, bool skip_other_sel);
void GetItemsQueryJoin(const DbItemQuery & iq, DbTextStream & query);
void GetItemsQueryWhere(const DbItemQuery & iq, DbTextStream & query);
void GetItemsQueryOrder(const DbItemQuery & iq, DbTextStream & query);
void GetItemsQueryLimit(const DbItemQuery & iq, DbTextStream & query);
PGresult * GetItemsQuery(const DbItemQuery & iq, DbTextStream & query, bool skip_other_sel = false);
PGresult * GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel = false);
};
#endif

View File

@ -1,111 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_db_dbbase
#define headerfile_winix_db_dbbase
#include "dbconn.h"
#include "dbtextstream.h"
#include <vector>
#include <string>
#include "core/error.h"
#include "space/spaceparser.h"
#include "date/date.h"
class DbBase
{
public:
DbBase();
void SetConn(DbConn * conn);
void SetConn(DbConn & conn);
DbConn * GetConn();
void LogQueries(bool log_q);
PGresult * AssertQuery(const char * query);
PGresult * AssertQuery(const DbTextStream & query);
PGresult * AssertQuery(const char * q, ExecStatusType t);
PGresult * AssertQuery(const DbTextStream & query, ExecStatusType t);
void AssertResult(PGresult * r, ExecStatusType t);
static int AssertColumn(PGresult * r, const char * column_name);
// static assignments
static const char * AssertValue(PGresult * r, int row, int col);
static const std::wstring & AssertValueWide(PGresult * r, int row, int col); // warning: this method uses a static buffer
static void AssertValueWide(PGresult * r, int row, int col, std::wstring & result);
static void AssertValueBin(PGresult * r, int row, int col, std::string & result);
static long AssertValueLong(PGresult * r, int row, int col);
static int AssertValueInt(PGresult * r, int row, int col);
static bool AssertValueBool(PGresult * r, int row, int col);
static unsigned long AssertValueULong(PGresult * r, int row, int col);
static unsigned int AssertValueUInt(PGresult * r, int row, int col);
static PT::Date AssertValueDate(PGresult * r, int row, int col);
// non static assignments
bool AssertValueSpace(PGresult * r, int row, int col, PT::Space & space, bool split_single = true);
void ClearResult(PGresult * r);
long AssertCurrval(const char * table);
bool IsNull(PGresult * r, int row, int col);
int Rows(PGresult * r);
int Cols(PGresult * r);
long AffectedRows(PGresult * r);
void CreateIdList(const std::vector<long> & id_tab, std::wstring & list, bool add_parentheses = true);
Error DoCommand(const DbTextStream & command);
Error DoCommand(const char * command);
Error BeginTrans();
Error RollbackTrans();
Error CommitTrans();
Error EndTrans(Error err);
// new API (returns only bool)
bool EndTrans(bool everything_ok);
static void UnescapeBin(const char * str, size_t len, std::string & out, bool clear_out = true);
protected:
// a helper method for escaping strings
template<class RawType>
DbTextStream::RawText<RawType> R(const RawType & par)
{
return DbTextStream::RawText<RawType>(par);
}
DbConn * db_conn;
bool log_queries;
private:
// static int CharToInt(char c);
// static bool IsCorrectOctalDigit(char c);
// static int UnescapeBin(const char * str, size_t & i, size_t len);
static char UnescapeBinHexToDigit(char hex);
DbTextStream bquery;
PT::SpaceParser conf_parser;
};
#endif

View File

@ -1,153 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "dbconn.h"
#include "core/log.h"
#include "core/error.h"
DbConn::DbConn()
{
pg_conn = 0;
}
DbConn::~DbConn()
{
Close();
}
PGconn * DbConn::GetPgConn()
{
return pg_conn;
}
void DbConn::SetConnParam(const std::string & d, const std::string & u, const std::string & p)
{
db_database = d;
db_user = u;
db_pass = p;
}
void DbConn::Connect()
{
Close();
conn_info.Clear();
conn_info.SetExtented(false);
conn_info << R("dbname=") << db_database
<< R(" user=") << db_user
<< R(" password=") << db_pass;
pg_conn = PQconnectdb(conn_info.CStr());
// warning! pg_conn can be not null but there cannnot be a connection established
// use PQstatus(pg_conn) to check whether the connection works fine
}
void DbConn::LogConnectionSocket()
{
log << log2 << "Db: connection to the database works fine" << logend;
log << log3 << "Db: connection socket: " << PQsocket(pg_conn) << logend;
}
void DbConn::WaitForConnection()
{
if( !pg_conn || PQstatus(pg_conn) != CONNECTION_OK )
{
log << log3 << "Db: waiting for the db to be ready...." << logend << logsave;
while( !AssertConnection(false, false) )
sleep(5);
LogConnectionSocket();
}
}
void DbConn::Close()
{
if( pg_conn )
{
PQfinish(pg_conn);
pg_conn = 0;
}
}
bool DbConn::AssertConnection(bool put_log, bool throw_if_no_connection)
{
bool was_connection = true;
if( !pg_conn )
{
was_connection = false;
Connect();
}
else
if( PQstatus(pg_conn) != CONNECTION_OK )
{
if( put_log )
log << log2 << "Db: connection to the database is lost, trying to recover" << logend;
was_connection = false;
PQreset(pg_conn);
}
if( pg_conn && PQstatus(pg_conn) == CONNECTION_OK )
{
if( !was_connection )
{
if( put_log )
LogConnectionSocket();
SetDbParameters();
}
return true;
}
else
{
if( put_log )
log << log1 << "Db: connection to db server cannot be established" << logend;
if( throw_if_no_connection )
throw Error(WINIX_ERR_DB_FATAL_ERROR_DURING_CONNECTING);
return false;
}
}
void DbConn::SetDbParameters()
{
if( PQsetClientEncoding(pg_conn, "UTF8") == -1 )
log << log1 << "Db: Can't set the proper client encoding" << logend;
}

View File

@ -1,55 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_db_dbconn
#define headerfile_winix_db_dbconn
#include <string>
#include <libpq-fe.h>
#include "dbtextstream.h"
class DbConn
{
public:
DbConn();
~DbConn();
void SetConnParam(const std::string & database, const std::string & user, const std::string & pass);
void Connect();
void WaitForConnection();
void Close();
bool AssertConnection(bool put_log = true, bool throw_if_no_connection = true);
void SetDbParameters();
PGconn * GetPgConn();
private:
void LogConnectionSocket();
PGconn * pg_conn;
std::string db_database, db_user, db_pass;
DbTextStream conn_info;
// a helper method for escaping strings
template<class RawType>
DbTextStream::RawText<RawType> R(const RawType & par)
{
return DbTextStream::RawText<RawType>(par);
}
};
#endif

View File

@ -1,92 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "dbitemcolumns.h"
#include "dbbase.h"
#include "core/log.h"
void DbItemColumns::SetColumns(PGresult * r)
{
// PQfnumber returns -1 if there is no such a column
id = PQfnumber(r, "id");
user_id = PQfnumber(r, "user_id");
group_id = PQfnumber(r, "group_id");
privileges = PQfnumber(r, "privileges");
date_creation = PQfnumber(r, "date_creation");
date_modification = PQfnumber(r, "date_modification");
url = PQfnumber(r, "url");
type = PQfnumber(r, "type");
parent_id = PQfnumber(r, "parent_id");
content_id = PQfnumber(r, "content_id");
link_to = PQfnumber(r, "link_to");
link_redirect = PQfnumber(r, "link_redirect");
subject = PQfnumber(r, "subject");
content = PQfnumber(r, "content");
content_type = PQfnumber(r, "content_type");
guest_name = PQfnumber(r, "guest_name");
html_template = PQfnumber(r, "template");
modification_user_id = PQfnumber(r, "modification_user_id");
file_path = PQfnumber(r, "file_path");
file_fs = PQfnumber(r, "file_fs");
file_type = PQfnumber(r, "file_type");
has_thumb = PQfnumber(r, "has_thumb");
hash = PQfnumber(r, "hash");
hash_type = PQfnumber(r, "hash_type");
file_size = PQfnumber(r, "file_size");
ref = PQfnumber(r, "ref");
modify_index = PQfnumber(r, "modify_index");
sort_index = PQfnumber(r, "sort_index");
meta = PQfnumber(r, "meta");
ameta = PQfnumber(r, "ameta");
}
void DbItemColumns::SetItem(PGresult * r, long row, Item & item)
{
if( id != -1 ) item.id = DbBase::AssertValueLong(r, row, id);
if( user_id != -1 ) item.user_id = DbBase::AssertValueLong(r, row, user_id);
if( group_id != -1 ) item.group_id = DbBase::AssertValueLong(r, row, group_id);
if( privileges != -1 ) item.privileges = DbBase::AssertValueInt(r, row, privileges);
if( date_creation != -1 ) item.date_creation = DbBase::AssertValueDate(r, row, date_creation);
if( date_modification != -1 ) item.date_modification = DbBase::AssertValueDate(r, row, date_modification);
if( type != -1 ) item.type = static_cast<Item::Type>( DbBase::AssertValueInt(r, row, type) );
if( parent_id != -1 ) item.parent_id = DbBase::AssertValueLong(r, row, parent_id);
if( content_id != -1 ) item.content_id = DbBase::AssertValueLong(r, row, content_id);
if( link_redirect != -1 ) item.link_redirect = DbBase::AssertValueInt(r, row, link_redirect);
if( content_type != -1 ) item.content_type = static_cast<Item::ContentType>( DbBase::AssertValueInt(r, row, content_type) );
if( modification_user_id != -1 ) item.modification_user_id = DbBase::AssertValueLong(r, row, modification_user_id);
if( file_fs != -1 ) item.file_fs = DbBase::AssertValueInt(r, row, file_fs);
if( file_type != -1 ) item.file_type = DbBase::AssertValueInt(r, row, file_type);
if( has_thumb != -1 ) item.has_thumb = DbBase::AssertValueBool(r, row, has_thumb);
if( hash != -1 ) DbBase::AssertValueWide(r, row, hash, item.hash);
if( hash_type != -1 ) item.hash_type = DbBase::AssertValueInt(r, row, hash_type);
if( file_size != -1 ) item.file_size = DbBase::AssertValueLong(r, row, file_size);
if( ref != -1 ) item.ref = DbBase::AssertValueInt(r, row, ref);
if( modify_index != -1 ) item.modify_index = DbBase::AssertValueInt(r, row, modify_index);
if( url != -1 ) DbBase::AssertValueWide(r, row, url, item.url);
if( content != -1 ) DbBase::AssertValueWide(r, row, content, item.content);
if( subject != -1 ) DbBase::AssertValueWide(r, row, subject, item.subject);
if( file_path != -1 ) DbBase::AssertValueWide(r, row, file_path, item.file_path);
if( link_to != -1 ) DbBase::AssertValueWide(r, row, link_to, item.link_to);
if( guest_name != -1 ) DbBase::AssertValueWide(r, row, guest_name, item.guest_name);
if( html_template != -1 ) DbBase::AssertValueWide(r, row, html_template, item.html_template);
if( sort_index != -1 ) item.sort_index = DbBase::AssertValueInt(r, row, sort_index);
if( meta != -1 ) db_base.AssertValueSpace(r, row, meta, item.meta);
if( ameta != -1 ) db_base.AssertValueSpace(r, row, ameta, item.ameta);
}

View File

@ -1,70 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_db_dbitemcolumns
#define headerfile_winix_db_dbitemcolumns
#include <libpq-fe.h>
#include "core/item.h"
#include "dbbase.h"
struct DbItemColumns
{
int id;
int user_id;
int group_id;
int privileges;
int date_creation;
int date_modification;
int url;
int type;
int parent_id;
int content_id;
int link_to;
int link_redirect;
int subject;
int content;
int content_type;
int guest_name;
int modification_user_id;
int html_template;
int file_path;
int file_fs;
int file_type;
int has_thumb;
int hash;
int hash_type;
int file_size;
int ref;
int modify_index;
int sort_index;
int meta;
int ameta;
DbItemColumns(DbBase & db_base_) : db_base(db_base_)
{
}
void SetColumns(PGresult * r);
void SetItem(PGresult * r, long row, Item & item);
private:
DbBase & db_base;
};
#endif

View File

@ -1,131 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "dbitemquery.h"
DbItemQuery::DbItemQuery()
{
Clear();
}
void DbItemQuery::Clear()
{
sort_asc = true;
SetAll(true, false);
id = -1;
id_tab = 0;
parent_id = -1;
type = Item::none;
file_type = WINIX_ITEM_FILETYPE_NONE;
type_equal = true;
file_type_equal = true;
limit = 0; // limit and offset not used by default
offset = 0;
}
void DbItemQuery::SetAllSel(bool sel)
{
sel_parent_id = sel;
sel_user_id = sel;
sel_group_id = sel;
sel_guest_name = sel;
sel_privileges = sel;
sel_date = sel;
sel_subject = sel;
sel_content = sel;
sel_url = sel;
sel_type = sel;
sel_link = sel;
sel_file = sel;
sel_html_template = sel;
sel_sort_index = sel;
sel_meta = sel;
}
void DbItemQuery::SetAllWhere(bool where_)
{
where_id = where_;
where_parent_id = where_;
where_type = where_;
where_file_type = where_;
}
void DbItemQuery::SetAll(bool sel, bool where_)
{
SetAllSel(sel);
SetAllWhere(where_);
}
void DbItemQuery::WhereId(long id_)
{
where_id = true;
id = id_;
}
void DbItemQuery::WhereIdIn(const std::vector<long> & id_tab_list)
{
id_tab = &id_tab_list;
}
void DbItemQuery::WhereParentId(long parent_id_)
{
where_parent_id = true;
parent_id = parent_id_;
}
void DbItemQuery::WhereType(Item::Type type_, bool equal)
{
where_type = true;
type = type_;
type_equal = equal;
}
void DbItemQuery::WhereFileType(int file_t, bool equal)
{
where_file_type = true;
file_type = file_t;
file_type_equal = equal;
}
void DbItemQuery::Limit(long l)
{
limit = l;
}
void DbItemQuery::Offset(long o)
{
offset = o;
}

View File

@ -1,79 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_db_dbitemquery
#define headerfile_winix_db_dbitemquery
#include <vector>
#include "core/item.h"
struct DbItemQuery
{
// id and content_id is selected always
bool sel_parent_id; // parent_id
bool sel_user_id; // user_id, modification_user_id
bool sel_group_id; // group_id
bool sel_guest_name; // guest_name
bool sel_privileges; // privileges
bool sel_date; // date_creation, date_modification
bool sel_subject; // subject
bool sel_content; // content, content_type, ref, modify_index
bool sel_url; // url
bool sel_type; // type (dir, file, none)
bool sel_link; // link_to, link_redirect
bool sel_file; // file_path, file_fs, file_type, has_thumb, hash, hash_type, file_size
bool sel_html_template; // template
bool sel_sort_index; // sort_index
bool sel_meta; // meta and ameta (PT::Space)
bool where_id; //
bool where_parent_id; //
bool where_type;
bool where_file_type;
long id; // if where_id is true
long parent_id; // if where_parent_id is true
Item::Type type;
bool type_equal;
int file_type;
bool file_type_equal; // if true means file_type should be equal
bool sort_asc;
const std::vector<long> * id_tab; // != 0 if WhereIdIn was used
long limit;
long offset;
DbItemQuery();
void Clear();
void SetAllSel(bool sel);
void SetAllWhere(bool where_);
void SetAll(bool sel, bool where_);
void WhereId(long id_);
void WhereIdIn(const std::vector<long> & id_tab_list);
void WhereParentId(long parent_id_);
void WhereType(Item::Type type_, bool equal = true);
void WhereFileType(int file_t, bool equal = true);
void Limit(long l); // setting 0 turns off
void Offset(long o); // setting 0 turns off
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
include Makefile.o.dep
all: $(o)
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I.. -I../../ezc/src -I../../pikotools -I../../tito/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
clean:
rm -f *.o
include Makefile.dep

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o default.o download.o emacs.o env.o functionbase.o functionparser.o functions.o ipban.o last.o ln.o locale.o login.o logout.o ls.o man.o meta.o mkdir.o mount.o mv.o nicedit.o node.o passwd.o priv.o privchanger.o pw.o reload.o rm.o rmuser.o run.o sort.o specialdefault.o stat.o subject.o template.o timezone.o tinymce.o uname.o upload.o uptime.o vim.o who.o

View File

@ -1,52 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_adduser
#define headerfile_winix_functions_adduser
#include "functionbase.h"
#include "core/user.h"
namespace Fun
{
class AddUser : public FunctionBase
{
public:
AddUser();
void MakePost();
void MakeGet();
bool IsLoginCorrect(const std::wstring & login, bool use_ses_log = false);
bool IsEmailCorrect(const std::wstring & email, bool use_ses_log = false);
bool HasLoginCorrectChars(const std::wstring & login);
bool AddNewUser(User & user, const std::wstring & pass);
bool AddNewUser(const std::wstring & login,
const std::wstring & pass,
const std::wstring & email,
bool autoactivate,
bool try_login,
bool use_ses_log = false);
private:
UserPass up;
User user;
};
} // namespace
#endif

View File

@ -1,43 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "cat.h"
namespace Fun
{
Cat::Cat()
{
fun.url = L"cat";
}
void Cat::MakeGet()
{
if( !cur->request->is_item )
{
log << log1 << "Content: cat function requires an item" << logend;
cur->request->status = WINIX_ERR_NO_ITEM;
return;
}
if( !system->HasReadAccess(cur->request->item) )
{
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
return;
}
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
}
} // namespace

View File

@ -1,33 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_cat
#define headerfile_winix_functions_cat
#include "functionbase.h"
namespace Fun
{
class Cat : public FunctionBase
{
public:
Cat();
void MakeGet();
};
} // namespace Fun
#endif

View File

@ -1,45 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "chmod.h"
namespace Fun
{
Chmod::Chmod()
{
fun.url = L"chmod";
}
void Chmod::MakePost()
{
priv_changer.SetCur(cur);
priv_changer.SetSystem(system);
priv_changer.SetDb(db);
priv_changer.Change(false, true);
}
void Chmod::MakeGet()
{
priv_changer.SetCur(cur);
priv_changer.SetSystem(system);
priv_changer.SetDb(db);
priv_changer.CheckAccess();
}
} // namespace

View File

@ -1,38 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_chmod
#define headerfile_winix_functions_chmod
#include "functionbase.h"
#include "privchanger.h"
namespace Fun
{
class Chmod : public FunctionBase
{
public:
Chmod();
void MakePost();
void MakeGet();
private:
PrivChanger priv_changer;
};
} // namespace
#endif

View File

@ -1,45 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "chown.h"
namespace Fun
{
Chown::Chown()
{
fun.url = L"chown";
}
void Chown::MakePost()
{
priv_changer.SetCur(cur);
priv_changer.SetSystem(system);
priv_changer.SetDb(db);
priv_changer.Change(true, false);
}
void Chown::MakeGet()
{
priv_changer.SetCur(cur);
priv_changer.SetSystem(system);
priv_changer.SetDb(db);
priv_changer.CheckAccess();
}
} // namespace

View File

@ -1,38 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_chown
#define headerfile_winix_functions_chown
#include "functionbase.h"
#include "privchanger.h"
namespace Fun
{
class Chown : public FunctionBase
{
public:
Chown();
void MakePost();
void MakeGet();
private:
PrivChanger priv_changer;
};
} // namespace
#endif

View File

@ -1,53 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "ckeditor.h"
#include "functions.h"
namespace Fun
{
Ckeditor::Ckeditor()
{
fun.url = L"ckeditor";
}
void Ckeditor::Init()
{
system->AddCommonFileToVar(L"winix/ckeditor_full.js", L"ckeditor_full.js");
system->AddCommonFileToVar(L"winix/ckeditor_winix.js", L"ckeditor_winix.js");
}
bool Ckeditor::HasAccess()
{
return functions->fun_emacs.HasAccess();
}
void Ckeditor::MakeGet()
{
cur->session->last_css.clear();
int parcss = system->mounts.MountParCss();
if( cur->mount->param[parcss].defined )
cur->session->last_css = cur->mount->param[parcss].arg;
}
void Ckeditor::MakePost()
{
functions->fun_emacs.MakePost();
}
} // namespace

View File

@ -1,36 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_ckeditor
#define headerfile_winix_functions_ckeditor
#include "functionbase.h"
namespace Fun
{
class Ckeditor : public FunctionBase
{
public:
Ckeditor();
void Init();
bool HasAccess();
void MakeGet();
void MakePost();
};
} // namespace
#endif

View File

@ -1,52 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "default.h"
namespace Fun
{
Default::Default()
{
fun.url = L"default";
}
bool Default::HasAccess()
{
return !cur->request->is_item && system->HasWriteAccess(*cur->request->dir_tab.back());
}
void Default::MakePost()
{
Item & dir = *cur->request->dir_tab.back();
dir.link_to = cur->request->PostVar(L"linkto");
dir.link_redirect = cur->request->IsPostVar(L"makeredirect") ? 1 : 0;
TrimWhite(dir.link_to);
// !! dodac sprawdzenie czy link_to jest pusty teraz
cur->request->status = db->EditLinkItem(dir.id, dir.link_to, dir.link_redirect);
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "Default: changed link_to: " << dir.link_to << ", for dir_id: " << dir.id << logend;
system->RedirectToLastDir();
}
}
} // namespace

View File

@ -1,34 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_default
#define headerfile_winix_functions_default
#include "functionbase.h"
namespace Fun
{
class Default : public FunctionBase
{
public:
Default();
bool HasAccess();
void MakePost();
};
} // namespace
#endif

View File

@ -1,54 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "download.h"
namespace Fun
{
Download::Download()
{
fun.url = L"download";
}
void Download::MakeGet()
{
// !! moze wywalic to no_item i wszedzie w takich miejscach dac poprostu permission_denied?
if( !cur->request->is_item )
{
log << log1 << "Content: download function requires an item" << logend;
cur->request->status = WINIX_ERR_NO_ITEM;
return;
}
if( !system->HasReadAccess(cur->request->item) ||
cur->request->item.file_type == WINIX_ITEM_FILETYPE_NONE ||
cur->request->item.file_path.empty() )
{
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
return;
}
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
if( cur->request->item.has_thumb && cur->request->IsParam(L"thumb") )
system->MakeFilePath(cur->request->item, cur->request->x_sendfile, true);
else
system->MakeFilePath(cur->request->item, cur->request->x_sendfile);
}
} // namespace

View File

@ -1,35 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_download
#define headerfile_winix_functions_download
#include "functionbase.h"
namespace Fun
{
class Download : public FunctionBase
{
public:
Download();
void MakeGet();
private:
};
} // namespace
#endif

View File

@ -1,156 +0,0 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, Tomasz Sowa
* All rights reserved.
*
*/
#include "emacs.h"
#include "templates/templates.h"
#include "functions.h"
namespace Fun
{
Emacs::Emacs()
{
fun.url = L"emacs";
}
bool Emacs::HasAccess(const Item & item)
{
if( cur->session->puser && cur->session->puser->super_user )
// super user can use emacs everywhere
return true;
if( !system->HasWriteAccess(item) )
return false;
if( !system->mounts.pmount->IsPar(system->mounts.MountParEmacsOn()) )
return true;
if( system->mounts.pmount->IsArg(system->mounts.MountParEmacsOn(), cur->request->dir_tab.size()) )
return true;
return false;
}
bool Emacs::HasAccess()
{
return HasAccess(*cur->request->last_item);
}
bool Emacs::PostEmacsCheckAbuse(bool adding)
{
if( !system->rebus.CheckRebus() )
{
cur->request->status = WINIX_ERR_INCORRECT_REBUS;
return false;
}
// !! is tested in createthread once
functions->CheckGetPostTimes();
if( cur->session->spam_score > 0 )
{
cur->request->status = WINIX_ERR_SPAM;
log << log1 << "Emacs: ignoring due to suspected spamming" << logend;
return false;
}
return true;
}
// !! zmienic nazwy
// albo w ogole te metody nie sa potrzebne teraz (byly zmiany)
void Emacs::PostFunEmacsModifyMountPoint(bool adding)
{
system->RedirectTo(cur->request->item);
}
int Emacs::NotifyCodeEdit()
{
// !! nie potrzebne
// if( system->mounts.pmount->type == system->mounts.MountTypeThread() )
// return WINIX_NOTIFY_CODE_THREAD_POST_CHANGED;
return WINIX_NOTIFY_CODE_EDIT;
}
int Emacs::NotifyCodeAdd()
{
// !! nie potrzebne
// if( system->mounts.pmount->type == system->mounts.MountTypeThread() )
// return WINIX_NOTIFY_CODE_THREAD_REPLAYED;
return WINIX_NOTIFY_CODE_ADD;
}
void Emacs::MakePost()
{
bool adding = !cur->request->is_item;
if( !adding )
old_url = cur->request->item.url;
functions->ReadItem(cur->request->item, Item::file);
if( adding )
functions->SetUser(cur->request->item); // set user before checking the rebus
if( !PostEmacsCheckAbuse(adding) )
return;
if( adding )
{
cur->request->is_item = true; // !! moze lepiej nie ustawiac is_item? (bo jak wystapi blad np dodania do bazy danych
// to formularz edycji zmieni sie z 'dodaj' na 'edytuj'
cur->request->item.privileges = system->NewFilePrivileges();
cur->request->status = system->AddFile(cur->request->item, NotifyCodeAdd());
}
else
{
cur->request->status = system->EditFile(cur->request->item, cur->request->item.url != old_url, NotifyCodeEdit());
}
if( cur->request->status == WINIX_ERR_OK )
{
PostFunEmacsModifyMountPoint(adding);
functions->CheckSpecialFile(cur->request->item);
}
else
{
log << log1 << "Emacs: error: " << cur->request->status << logend;
}
}
} // namespace

Some files were not shown because too many files have changed in this diff Show More