added: winix functions: locale, timezone

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



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

View File

@@ -2,16 +2,16 @@
acceptbaseparser.o: acceptbaseparser.h
app.o: app.h config.h ../../pikotools/space/spaceparser.h
app.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
app.o: ../../pikotools/date/date.h ../../pikotools/space/space.h system.h
app.o: job.h basethread.h synchro.h dirs.h item.h dircontainer.h ../db/db.h
app.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
app.o: ../core/textstream.h misc.h requesttypes.h ../core/error.h
app.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
app.o: ../core/user.h ../core/group.h ../core/dircontainer.h
app.o: ../core/ugcontainer.h log.h textstream.h logmanipulators.h slog.h
app.o: cur.h request.h error.h ../templates/htmltextstream.h session.h user.h
app.o: plugindata.h rebus.h mount.h ../templates/locale.h ../notify/notify.h
app.o: ../../pikotools/space/space.h htmlfilter.h system.h job.h basethread.h
app.o: synchro.h ../../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 ../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 session.h user.h plugindata.h rebus.h
app.o: mount.h ../templates/locale.h ../notify/notify.h
app.o: ../notify/notifypool.h ../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
@@ -21,11 +21,11 @@ app.o: ../notify/notifythread.h ../core/basethread.h
app.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
app.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
app.o: users.h groups.h group.h loadavg.h image.h threadmanager.h timezones.h
app.o: sessionmanager.h sessioncontainer.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: timezone.h sessionmanager.h sessioncontainer.h
app.o: ../functions/functions.h ../functions/functionbase.h ../core/request.h
app.o: ../core/system.h ../core/synchro.h ../functions/functionparser.h
app.o: ../core/cur.h ../functions/adduser.h ../functions/cat.h
app.o: ../functions/chmod.h ../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
@@ -50,45 +50,45 @@ compress.o: compress.h log.h textstream.h logmanipulators.h slog.h cur.h
compress.o: request.h requesttypes.h item.h ../../pikotools/space/space.h
compress.o: ../../pikotools/date/date.h error.h config.h
compress.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
compress.o: htmlfilter.h timezone.h ../templates/htmltextstream.h
compress.o: ../core/textstream.h misc.h session.h user.h plugindata.h rebus.h
compress.o: mount.h ../templates/locale.h
compress.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
compress.o: misc.h session.h user.h plugindata.h rebus.h mount.h
compress.o: ../templates/locale.h
config.o: config.h ../../pikotools/space/spaceparser.h
config.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
config.o: ../../pikotools/date/date.h ../../pikotools/space/space.h log.h
config.o: textstream.h logmanipulators.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 session.h user.h plugindata.h rebus.h
config.o: mount.h ../templates/locale.h plugin.h pluginmsg.h system.h job.h
config.o: basethread.h synchro.h dirs.h dircontainer.h ../db/db.h
config.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
config.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
config.o: ../core/user.h ../core/group.h ../core/dircontainer.h
config.o: ../core/ugcontainer.h ../notify/notify.h ../notify/notifypool.h
config.o: ../templates/patterns.h ../templates/locale.h
config.o: ../templates/localefilter.h ../../ezc/src/ezc.h
config.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
config.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
config.o: ../../ezc/src/stringconv.h ../../pikotools/utf8/utf8.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 sessionmanager.h sessioncontainer.h
config.o: ../functions/functions.h ../functions/functionbase.h
config.o: ../core/request.h ../core/system.h ../core/synchro.h
config.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
config.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
config.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
config.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
config.o: ../functions/env.h ../functions/last.h ../functions/login.h
config.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
config.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
config.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
config.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
config.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
config.o: ../functions/sort.h ../functions/specialdefault.h
config.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
config.o: ../../pikotools/space/space.h htmlfilter.h log.h textstream.h
config.o: logmanipulators.h slog.h cur.h request.h requesttypes.h item.h
config.o: ../../pikotools/space/space.h ../../pikotools/date/date.h error.h
config.o: ../templates/htmltextstream.h ../core/textstream.h misc.h session.h
config.o: user.h plugindata.h rebus.h mount.h ../templates/locale.h plugin.h
config.o: pluginmsg.h system.h job.h basethread.h synchro.h dirs.h
config.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
config.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
config.o: ../core/item.h ../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: ../../pikotools/utf8/utf8.h ../notify/notifythread.h
config.o: ../core/basethread.h ../notify/templatesnotify.h ../core/config.h
config.o: ../core/users.h ugcontainer.h lastcontainer.h mounts.h
config.o: mountparser.h crypt.h run.h users.h groups.h group.h loadavg.h
config.o: image.h threadmanager.h timezones.h timezone.h sessionmanager.h
config.o: sessioncontainer.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
@@ -96,17 +96,17 @@ 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 htmlfilter.h timezone.h
crypt.o: ../../pikotools/date/date.h ../../pikotools/space/space.h user.h
crypt.o: ../../pikotools/utf8/utf8.h misc.h item.h requesttypes.h log.h
crypt.o: textstream.h logmanipulators.h slog.h cur.h request.h error.h
crypt.o: ../templates/htmltextstream.h ../core/textstream.h session.h
crypt.o: plugindata.h rebus.h mount.h ../templates/locale.h
crypt.o: ../../pikotools/space/space.h htmlfilter.h user.h
crypt.o: ../../pikotools/utf8/utf8.h misc.h item.h
crypt.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
crypt.o: requesttypes.h log.h textstream.h logmanipulators.h slog.h cur.h
crypt.o: request.h error.h ../templates/htmltextstream.h ../core/textstream.h
crypt.o: session.h plugindata.h rebus.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 slog.h cur.h request.h requesttypes.h
dircontainer.o: error.h config.h ../../pikotools/space/spaceparser.h
dircontainer.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
dircontainer.o: ../../pikotools/space/space.h htmlfilter.h
dircontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
dircontainer.o: session.h user.h plugindata.h rebus.h mount.h
dircontainer.o: ../templates/locale.h
@@ -115,7 +115,7 @@ 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 ../core/error.h ../../pikotools/space/spaceparser.h
dirs.o: ../../pikotools/space/space.h ../db/dbitemquery.h ../core/item.h
dirs.o: ../db/dbitemcolumns.h ../core/user.h timezone.h ../core/group.h
dirs.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
dirs.o: ../core/dircontainer.h ../core/ugcontainer.h log.h textstream.h
dirs.o: logmanipulators.h slog.h cur.h request.h error.h config.h
dirs.o: htmlfilter.h ../templates/htmltextstream.h session.h user.h
@@ -133,7 +133,7 @@ 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 ../core/error.h ../../pikotools/space/spaceparser.h
groups.o: ../../pikotools/space/space.h ../db/dbitemquery.h ../core/item.h
groups.o: ../db/dbitemcolumns.h ../core/user.h timezone.h ../core/group.h
groups.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
groups.o: ../core/dircontainer.h ../core/ugcontainer.h log.h textstream.h
groups.o: logmanipulators.h slog.h cur.h request.h error.h config.h
groups.o: htmlfilter.h ../templates/htmltextstream.h session.h user.h
@@ -146,7 +146,7 @@ image.o: ../core/textstream.h misc.h item.h ../../pikotools/space/space.h
image.o: ../../pikotools/date/date.h requesttypes.h ../core/error.h
image.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
image.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
image.o: ../core/user.h timezone.h ../core/group.h ../core/dircontainer.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: session.h user.h plugindata.h rebus.h mount.h ../templates/locale.h
@@ -160,7 +160,7 @@ 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: plugin.h pluginmsg.h sessionmanager.h sessioncontainer.h
image.o: timezone.h plugin.h pluginmsg.h sessionmanager.h sessioncontainer.h
image.o: ../functions/functions.h ../functions/functionbase.h
image.o: ../core/request.h ../core/system.h ../core/synchro.h
image.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
@@ -184,12 +184,12 @@ image.o: ../templates/htmltextstream.h ../core/sessionmanager.h
item.o: item.h ../../pikotools/space/space.h ../../pikotools/date/date.h
item.o: misc.h requesttypes.h crypt.h run.h config.h
item.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
item.o: htmlfilter.h timezone.h user.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 slog.h cur.h
job.o: request.h requesttypes.h item.h ../../pikotools/date/date.h error.h
job.o: config.h ../../pikotools/space/spaceparser.h
job.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
job.o: ../../pikotools/space/space.h htmlfilter.h
job.o: ../templates/htmltextstream.h ../core/textstream.h misc.h session.h
job.o: user.h plugindata.h rebus.h mount.h ../templates/locale.h system.h
job.o: dirs.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
@@ -205,11 +205,11 @@ job.o: ../notify/notifythread.h ../core/basethread.h
job.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
job.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
job.o: users.h groups.h group.h loadavg.h image.h threadmanager.h timezones.h
job.o: sessionmanager.h sessioncontainer.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: timezone.h sessionmanager.h sessioncontainer.h
job.o: ../functions/functions.h ../functions/functionbase.h ../core/request.h
job.o: ../core/system.h ../core/synchro.h ../functions/functionparser.h
job.o: ../core/cur.h ../functions/adduser.h ../functions/cat.h
job.o: ../functions/chmod.h ../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
@@ -230,7 +230,7 @@ lastcontainer.o: lastcontainer.h ../../pikotools/date/date.h log.h
lastcontainer.o: textstream.h logmanipulators.h slog.h cur.h request.h
lastcontainer.o: requesttypes.h item.h ../../pikotools/space/space.h error.h
lastcontainer.o: config.h ../../pikotools/space/spaceparser.h
lastcontainer.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
lastcontainer.o: ../../pikotools/space/space.h htmlfilter.h
lastcontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
lastcontainer.o: session.h user.h plugindata.h rebus.h mount.h
lastcontainer.o: ../templates/locale.h
@@ -238,23 +238,23 @@ loadavg.o: loadavg.h log.h textstream.h logmanipulators.h slog.h cur.h
loadavg.o: request.h requesttypes.h item.h ../../pikotools/space/space.h
loadavg.o: ../../pikotools/date/date.h error.h config.h
loadavg.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
loadavg.o: htmlfilter.h timezone.h ../templates/htmltextstream.h
loadavg.o: ../core/textstream.h misc.h session.h user.h plugindata.h rebus.h
loadavg.o: mount.h ../templates/locale.h
loadavg.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
loadavg.o: misc.h session.h user.h plugindata.h rebus.h mount.h
loadavg.o: ../templates/locale.h
log.o: log.h textstream.h logmanipulators.h slog.h cur.h request.h
log.o: requesttypes.h item.h ../../pikotools/space/space.h
log.o: ../../pikotools/date/date.h error.h config.h
log.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
log.o: htmlfilter.h timezone.h ../templates/htmltextstream.h
log.o: ../core/textstream.h misc.h session.h user.h plugindata.h rebus.h
log.o: mount.h ../templates/locale.h ../../pikotools/utf8/utf8.h
log.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h misc.h
log.o: session.h user.h plugindata.h rebus.h mount.h ../templates/locale.h
log.o: ../../pikotools/utf8/utf8.h
misc.o: misc.h item.h ../../pikotools/space/space.h
misc.o: ../../pikotools/date/date.h requesttypes.h log.h textstream.h
misc.o: logmanipulators.h slog.h cur.h request.h error.h config.h
misc.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
misc.o: htmlfilter.h timezone.h ../templates/htmltextstream.h
misc.o: ../core/textstream.h session.h user.h plugindata.h rebus.h mount.h
misc.o: ../templates/locale.h ../templates/templates.h ../../ezc/src/ezc.h
misc.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
misc.o: session.h user.h plugindata.h rebus.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 ../../pikotools/utf8/utf8.h
@@ -275,7 +275,7 @@ mountparser.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
mountparser.o: ../core/textstream.h misc.h requesttypes.h ../core/error.h
mountparser.o: ../../pikotools/space/spaceparser.h
mountparser.o: ../../pikotools/space/space.h ../db/dbitemquery.h
mountparser.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h timezone.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
@@ -295,7 +295,7 @@ 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: ../core/error.h ../../pikotools/space/spaceparser.h
mounts.o: ../../pikotools/space/space.h ../db/dbitemquery.h ../core/item.h
mounts.o: ../db/dbitemcolumns.h ../core/user.h timezone.h ../core/group.h
mounts.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
mounts.o: ../core/dircontainer.h ../core/ugcontainer.h log.h textstream.h
mounts.o: logmanipulators.h slog.h cur.h request.h config.h htmlfilter.h
mounts.o: ../templates/htmltextstream.h session.h user.h plugindata.h rebus.h
@@ -310,21 +310,21 @@ 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: sessionmanager.h sessioncontainer.h ../functions/functions.h
mounts.o: ../functions/functionbase.h ../core/request.h ../core/system.h
mounts.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
mounts.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
mounts.o: ../functions/privchanger.h ../functions/chown.h
mounts.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
mounts.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
mounts.o: ../functions/last.h ../functions/login.h ../functions/logout.h
mounts.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
mounts.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
mounts.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
mounts.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
mounts.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
mounts.o: ../functions/specialdefault.h ../functions/stat.h
mounts.o: ../functions/subject.h ../functions/template.h
mounts.o: timezone.h sessionmanager.h sessioncontainer.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
@@ -335,10 +335,10 @@ plugin.o: plugin.h pluginmsg.h log.h textstream.h logmanipulators.h slog.h
plugin.o: cur.h request.h requesttypes.h item.h ../../pikotools/space/space.h
plugin.o: ../../pikotools/date/date.h error.h config.h
plugin.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
plugin.o: htmlfilter.h timezone.h ../templates/htmltextstream.h
plugin.o: ../core/textstream.h misc.h session.h user.h plugindata.h rebus.h
plugin.o: mount.h ../templates/locale.h system.h job.h basethread.h synchro.h
plugin.o: dirs.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
plugin.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
plugin.o: misc.h session.h user.h plugindata.h rebus.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
@@ -351,7 +351,7 @@ plugin.o: ../../pikotools/utf8/utf8.h ../notify/notifythread.h
plugin.o: ../core/basethread.h ../notify/templatesnotify.h ../core/config.h
plugin.o: ../core/users.h ugcontainer.h lastcontainer.h mounts.h
plugin.o: mountparser.h crypt.h run.h users.h groups.h group.h loadavg.h
plugin.o: image.h threadmanager.h timezones.h sessionmanager.h
plugin.o: image.h threadmanager.h timezones.h timezone.h sessionmanager.h
plugin.o: sessioncontainer.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
@@ -377,7 +377,7 @@ plugindata.o: plugindata.h plugin.h pluginmsg.h log.h textstream.h
plugindata.o: logmanipulators.h slog.h cur.h request.h requesttypes.h item.h
plugindata.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
plugindata.o: error.h config.h ../../pikotools/space/spaceparser.h
plugindata.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
plugindata.o: ../../pikotools/space/space.h htmlfilter.h
plugindata.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
plugindata.o: session.h user.h rebus.h mount.h ../templates/locale.h system.h
plugindata.o: job.h basethread.h synchro.h dirs.h dircontainer.h ../db/db.h
@@ -394,8 +394,8 @@ plugindata.o: ../../pikotools/utf8/utf8.h ../notify/notifythread.h
plugindata.o: ../core/basethread.h ../notify/templatesnotify.h
plugindata.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
plugindata.o: mounts.h mountparser.h crypt.h run.h users.h groups.h group.h
plugindata.o: loadavg.h image.h threadmanager.h timezones.h sessionmanager.h
plugindata.o: sessioncontainer.h ../functions/functions.h
plugindata.o: loadavg.h image.h threadmanager.h timezones.h timezone.h
plugindata.o: sessionmanager.h sessioncontainer.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
@@ -420,23 +420,23 @@ plugindata.o: ../templates/changepatterns.h ../templates/htmltextstream.h
plugindata.o: ../core/sessionmanager.h
postmultiparser.o: postmultiparser.h error.h requesttypes.h config.h
postmultiparser.o: ../../pikotools/space/spaceparser.h
postmultiparser.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
postmultiparser.o: ../../pikotools/date/date.h ../../pikotools/space/space.h
postmultiparser.o: misc.h item.h log.h textstream.h logmanipulators.h slog.h
postmultiparser.o: cur.h request.h ../templates/htmltextstream.h
postmultiparser.o: ../../pikotools/space/space.h htmlfilter.h misc.h item.h
postmultiparser.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
postmultiparser.o: log.h textstream.h logmanipulators.h slog.h cur.h
postmultiparser.o: request.h ../templates/htmltextstream.h
postmultiparser.o: ../core/textstream.h session.h user.h plugindata.h rebus.h
postmultiparser.o: mount.h ../templates/locale.h ../../pikotools/utf8/utf8.h
rebus.o: log.h textstream.h logmanipulators.h slog.h cur.h request.h
rebus.o: requesttypes.h item.h ../../pikotools/space/space.h
rebus.o: ../../pikotools/date/date.h error.h config.h
rebus.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
rebus.o: htmlfilter.h timezone.h ../templates/htmltextstream.h
rebus.o: ../core/textstream.h misc.h session.h user.h plugindata.h rebus.h
rebus.o: mount.h ../templates/locale.h
rebus.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
rebus.o: misc.h session.h user.h plugindata.h rebus.h mount.h
rebus.o: ../templates/locale.h
request.o: request.h requesttypes.h item.h ../../pikotools/space/space.h
request.o: ../../pikotools/date/date.h error.h config.h
request.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
request.o: htmlfilter.h timezone.h textstream.h ../templates/htmltextstream.h
request.o: htmlfilter.h textstream.h ../templates/htmltextstream.h
request.o: ../core/textstream.h misc.h log.h logmanipulators.h slog.h cur.h
request.o: session.h user.h plugindata.h rebus.h mount.h
request.o: ../templates/locale.h plugin.h pluginmsg.h system.h job.h
@@ -454,7 +454,7 @@ 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 sessionmanager.h sessioncontainer.h
request.o: timezones.h timezone.h sessionmanager.h sessioncontainer.h
request.o: ../functions/functions.h ../functions/functionbase.h
request.o: ../core/request.h ../core/system.h ../core/synchro.h
request.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
@@ -480,9 +480,8 @@ run.o: run.h log.h textstream.h logmanipulators.h slog.h cur.h request.h
run.o: requesttypes.h item.h ../../pikotools/space/space.h
run.o: ../../pikotools/date/date.h error.h config.h
run.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
run.o: htmlfilter.h timezone.h ../templates/htmltextstream.h
run.o: ../core/textstream.h misc.h session.h user.h plugindata.h rebus.h
run.o: mount.h ../templates/locale.h
run.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h misc.h
run.o: session.h user.h plugindata.h rebus.h mount.h ../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 misc.h requesttypes.h
@@ -491,7 +490,7 @@ sessioncontainer.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
sessioncontainer.o: error.h user.h plugindata.h rebus.h textstream.h cur.h
sessioncontainer.o: request.h requesttypes.h config.h
sessioncontainer.o: ../../pikotools/space/spaceparser.h
sessioncontainer.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
sessioncontainer.o: ../../pikotools/space/space.h htmlfilter.h
sessioncontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessioncontainer.o: mount.h log.h logmanipulators.h slog.h
sessioncontainer.o: ../templates/locale.h
@@ -500,7 +499,7 @@ sessionmanager.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
sessionmanager.o: error.h user.h plugindata.h rebus.h textstream.h cur.h
sessionmanager.o: request.h requesttypes.h config.h
sessionmanager.o: ../../pikotools/space/spaceparser.h
sessionmanager.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
sessionmanager.o: ../../pikotools/space/space.h htmlfilter.h
sessionmanager.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessionmanager.o: mount.h lastcontainer.h system.h job.h basethread.h
sessionmanager.o: synchro.h dirs.h dircontainer.h ../db/db.h ../db/dbbase.h
@@ -518,7 +517,7 @@ sessionmanager.o: ../../pikotools/utf8/utf8.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
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
@@ -549,14 +548,14 @@ sessionparser.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
sessionparser.o: error.h user.h plugindata.h rebus.h textstream.h
sessionparser.o: sessioncontainer.h cur.h request.h requesttypes.h config.h
sessionparser.o: ../../pikotools/space/spaceparser.h
sessionparser.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
sessionparser.o: ../../pikotools/space/space.h htmlfilter.h
sessionparser.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessionparser.o: mount.h users.h log.h logmanipulators.h slog.h
sessionparser.o: ../templates/locale.h
slog.o: slog.h cur.h request.h requesttypes.h item.h
slog.o: ../../pikotools/space/space.h ../../pikotools/date/date.h error.h
slog.o: config.h ../../pikotools/space/spaceparser.h
slog.o: ../../pikotools/space/space.h htmlfilter.h timezone.h textstream.h
slog.o: ../../pikotools/space/space.h htmlfilter.h textstream.h
slog.o: ../templates/htmltextstream.h ../core/textstream.h misc.h session.h
slog.o: user.h plugindata.h rebus.h mount.h logmanipulators.h
slog.o: ../templates/locale.h
@@ -567,7 +566,7 @@ system.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
system.o: ../core/textstream.h misc.h requesttypes.h ../core/error.h
system.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
system.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
system.o: ../core/user.h timezone.h ../core/group.h ../core/dircontainer.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 session.h user.h plugindata.h rebus.h
@@ -581,25 +580,25 @@ system.o: ../../pikotools/utf8/utf8.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 ../templates/templates.h
system.o: ../templates/patterncacher.h ../templates/indexpatterns.h
system.o: ../templates/patterns.h ../templates/changepatterns.h
system.o: ../templates/htmltextstream.h ../core/cur.h ../core/system.h
system.o: ../core/sessionmanager.h ../core/htmlfilter.h
system.o: ../functions/functions.h ../functions/functionbase.h
system.o: ../core/request.h ../core/synchro.h ../functions/functionparser.h
system.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
system.o: ../functions/privchanger.h ../functions/chown.h
system.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
system.o: ../functions/download.h ../functions/emacs.h ../functions/env.h
system.o: ../functions/last.h ../functions/login.h ../functions/logout.h
system.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
system.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
system.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
system.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
system.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
system.o: ../functions/specialdefault.h ../functions/stat.h
system.o: ../functions/subject.h ../functions/template.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
@@ -608,12 +607,12 @@ threadmanager.o: logmanipulators.h slog.h cur.h request.h requesttypes.h
threadmanager.o: item.h ../../pikotools/space/space.h
threadmanager.o: ../../pikotools/date/date.h error.h config.h
threadmanager.o: ../../pikotools/space/spaceparser.h
threadmanager.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
threadmanager.o: ../../pikotools/space/space.h htmlfilter.h
threadmanager.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
threadmanager.o: session.h user.h plugindata.h rebus.h mount.h
threadmanager.o: ../templates/locale.h
timezone.o: timezone.h ../../pikotools/date/date.h
timezone.o: ../../pikotools/space/space.h
timezone.o: ../../pikotools/space/space.h misc.h item.h requesttypes.h
timezones.o: timezones.h timezone.h ../../pikotools/date/date.h
timezones.o: ../../pikotools/space/space.h
timezones.o: ../../pikotools/space/spaceparser.h
@@ -627,7 +626,7 @@ 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 cur.h request.h
users.o: requesttypes.h config.h ../../pikotools/space/spaceparser.h
users.o: ../../pikotools/space/space.h htmlfilter.h timezone.h
users.o: ../../pikotools/space/space.h htmlfilter.h
users.o: ../templates/htmltextstream.h ../core/textstream.h misc.h mount.h
users.o: lastcontainer.h system.h job.h basethread.h synchro.h dirs.h
users.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
@@ -643,8 +642,8 @@ users.o: ../../ezc/src/stringconv.h ../../pikotools/utf8/utf8.h
users.o: ../notify/notifythread.h ../core/basethread.h
users.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
users.o: ugcontainer.h mounts.h mountparser.h crypt.h run.h groups.h group.h
users.o: loadavg.h image.h threadmanager.h timezones.h plugin.h pluginmsg.h
users.o: ../functions/functions.h ../functions/functionbase.h
users.o: loadavg.h image.h threadmanager.h timezones.h timezone.h plugin.h
users.o: pluginmsg.h ../functions/functions.h ../functions/functionbase.h
users.o: ../core/request.h ../core/system.h ../core/synchro.h
users.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
users.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h

View File

@@ -292,6 +292,25 @@ return status;
}
void App::SetLocale()
{
size_t locale_id;
if( cur.session->puser )
{
locale_id = cur.session->puser->locale_id;
if( !TemplatesFunctions::locale.HasLanguage(locale_id) )
locale_id = config.locale_default_id;
}
else
{
locale_id = config.locale_default_id;
}
TemplatesFunctions::locale.SetCurLang(locale_id);
}
void App::ProcessRequestThrow()
{
@@ -304,6 +323,7 @@ void App::ProcessRequestThrow()
{
session_manager.SetSession();
cur.session = session_manager.GetCurSession();
SetLocale();
if( cur.session->new_session )
{

View File

@@ -129,6 +129,7 @@ private:
bool ShouldUseSSL();
bool ShouldNotUseSSL();
bool CheckSSLcorrectness();
void SetLocale();
void MakePage();
void Make();
void SaveSessionsIfNeeded(); // !! wywalic do menagera sesji??

View File

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

View File

@@ -13,7 +13,7 @@
#include <string>
#include "space/spaceparser.h"
#include "htmlfilter.h"
#include "timezone.h"
@@ -289,7 +289,7 @@ public:
// default: 92
int image_quality;
// the convert program (for images and thumbnails)
// the convert program (ImageMagic) (for images and thumbnails)
// default: /usr/local/bin/convert
std::wstring convert_cmd;
@@ -303,14 +303,16 @@ public:
// default: only one item: en
std::vector<std::wstring> locale_files;
// default locale
// default: the first item from locale_files
std::wstring locale_default;
// default locale - index to locale_files
// not available in config -- set automatically based on locale_default
size_t locale_default_index;
// 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://
@@ -485,16 +487,17 @@ public:
// default: 86400 (24 hours)
long reset_password_code_expiration_time;
// time zone for guests
// or for users who don't have time zone set
// following options are read:
// "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)
TimeZone time_zone;
// 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
@@ -548,7 +551,6 @@ private:
void ShowError();
void AssignValues(bool stdout_is_closed);
void SetAdditionalVariables();
void CheckLocale();
void CheckPasswd();
PT::Space space;

View File

@@ -166,6 +166,7 @@ SLog & SLog::TranslateText(const wchar_t * str)
if( locale )
trans = &locale->Get(str);
// !! IMPROVE ME "Not translated" add to locale
if( !trans || trans->empty() )
cur->session->log_buffer << "Not translated: " << str;
else

View File

@@ -69,6 +69,7 @@ void System::ReadTimeZones()
name_temp += '/';
name_temp += config->time_zones_file;
time_zones.SetTimeZoneMaxId(config->time_zone_max_id);
time_zones.ReadTimeZones(name_temp);
}
@@ -894,30 +895,40 @@ return status;
time_t System::ToLocal(time_t gmt_time)
time_t System::ToLocal(time_t utc_time)
{
time_t local_time;
size_t tz_id;
if( cur->session && cur->session->puser )
local_time = cur->session->puser->time_zone.ToLocal(gmt_time);
tz_id = cur->session->puser->time_zone_id;
else
local_time = config->time_zone.ToLocal(gmt_time);
tz_id = config->time_zone_default_id;
return local_time;
TimeZone * tz = time_zones.GetZone(tz_id);
if( tz )
return tz->ToLocal(utc_time);
return utc_time;
}
PT::Date System::ToLocal(const PT::Date & gmt_date)
PT::Date System::ToLocal(const PT::Date & utc_date)
{
PT::Date local_date;
size_t tz_id;
if( cur->session && cur->session->puser )
local_date = cur->session->puser->time_zone.ToLocal(gmt_date);
tz_id = cur->session->puser->time_zone_id;
else
local_date = config->time_zone.ToLocal(gmt_date);
tz_id = config->time_zone_default_id;
return local_date;
TimeZone * tz = time_zones.GetZone(tz_id);
if( tz )
return tz->ToLocal(utc_date);
return utc_date;
}
@@ -925,28 +936,38 @@ return local_date;
time_t System::ToUTC(time_t local_time)
{
time_t utc_time;
size_t tz_id;
if( cur->session && cur->session->puser )
utc_time = cur->session->puser->time_zone.ToUTC(local_time);
tz_id = cur->session->puser->time_zone_id;
else
utc_time = config->time_zone.ToUTC(local_time);
tz_id = config->time_zone_default_id;
return utc_time;
TimeZone * tz = time_zones.GetZone(tz_id);
if( tz )
return tz->ToUTC(local_time);
return local_time;
}
PT::Date System::ToUTC(const PT::Date & local_date)
{
PT::Date utc_date;
size_t tz_id;
if( cur->session && cur->session->puser )
utc_date = cur->session->puser->time_zone.ToUTC(local_date);
tz_id = cur->session->puser->time_zone_id;
else
utc_date = config->time_zone.ToUTC(local_date);
tz_id = config->time_zone_default_id;
return utc_date;
TimeZone * tz = time_zones.GetZone(tz_id);
if( tz )
return tz->ToUTC(local_date);
return local_date;
}

View File

@@ -140,8 +140,8 @@ public:
Error EditFile(Item & item, bool with_url = true, int notify_code = 0, bool call_plugins = true);
time_t ToLocal(time_t gmt_time);
PT::Date ToLocal(const PT::Date & gmt_date);
time_t ToLocal(time_t utc_time);
PT::Date ToLocal(const PT::Date & utc_date);
time_t ToUTC(time_t local_time);
PT::Date ToUTC(const PT::Date & local_date);

View File

@@ -8,6 +8,61 @@
*/
#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;
}
@@ -22,37 +77,45 @@ TimeZone::TimeZone()
void TimeZone::Clear()
{
tz_id = -1;
tz_offset = 0;
tz_has_dst = false;
tz_dst_offset = 0;
tz_dst_start.Clear();
tz_dst_end.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 offset;
time_t dst_offset = 0;
offset = tz_offset;
Dst * dst = FindDst(utc_date.year);
// !! CHECK ME need to be tested
if( dst && dst->IsDstUsed(utc_date) )
dst_offset = dst->offset;
if( tz_has_dst )
{
PT::Date local(utc_date);
local += tz_offset;
local.year = tz_dst_start.year;
tz_dst_end.year = tz_dst_start.year;
if( tz_dst_start <= local && local < tz_dst_end )
offset += tz_dst_offset;
}
return offset;
return offset + dst_offset;
}
@@ -76,27 +139,25 @@ return local;
time_t TimeZone::CalcUTCOffset(const PT::Date & local_date)
{
time_t offset;
time_t dst_offset = 0;
offset = tz_offset;
Dst * dst = FindDst(local_date.year);
if( tz_has_dst )
if( dst && dst->has_dst )
{
// !! CHECK ME need to be tested
// dst date ranges we have in UTC
PT::Date utc(local_date);
utc -= (offset + dst->offset);
PT::Date local(local_date);
local -= tz_dst_offset;
local.year = tz_dst_start.year;
tz_dst_end.year = tz_dst_start.year;
if( tz_dst_start <= local && local < tz_dst_end )
offset += tz_dst_offset;
if( dst->IsDstUsed(utc) )
dst_offset = dst->offset;
}
return offset;
return offset + dst_offset;
}
time_t TimeZone::ToUTC(time_t local_time)
{
time_t offset = CalcUTCOffset(PT::Date(local_time));
@@ -119,47 +180,110 @@ return utc;
bool TimeZone::SetTz(PT::Space & space)
time_t TimeZone::ParseStrOffset(const wchar_t * str)
{
bool result = true;
PT::Date date;
bool is_sign = false;
time_t offset = 0;
tz_id = space.Int(L"tz_id", -1);
tz_offset = space.Long(L"tz_offset", 0);
tz_has_dst = space.Bool(L"tz_has_dst", false);
str = SkipWhite(str);
time_t h13 = 60 * 60 * 13; // 13 hours
time_t h15 = 60 * 60 * 15; // 15 hours
time_t h24 = 60 * 60 * 24; // 24 hours
if( tz_offset < -h13 || tz_offset > h15 )
result = false;
if( tz_has_dst )
if( *str == '-' )
{
tz_dst_start.year = 1970;
tz_dst_end.year = 1970;
if( !tz_dst_start.ParseMonthDayTime(space.Text(L"tz_dst_start")) )
result = false;
if( !tz_dst_end.ParseMonthDayTime(space.Text(L"tz_dst_end")) )
result = false;
tz_dst_offset = space.Long(L"tz_dst_offset");
if( tz_dst_offset < -h24 || tz_dst_offset > h24 )
result = false;
is_sign = true;
str += 1;
}
else
if( *str == '+' )
{
tz_dst_start.Clear();
tz_dst_end.Clear();
tz_dst_offset = 0;
str += 1;
}
if( !result )
Clear();
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

@@ -11,6 +11,7 @@
#define headerfile_winix_core_timezone
#include <ctime>
#include <map>
#include "date/date.h"
#include "space/space.h"
@@ -20,13 +21,46 @@ 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();
/*
setting:
tz_offset = 0
tz_has_dst = false
*/
void Clear();
@@ -59,25 +93,39 @@ public:
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
int tz_id;
size_t id;
// time zone offset (in seconds)
time_t tz_offset;
time_t offset;
// true if the time zone has daylight saving time
bool tz_has_dst;
// 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;
// time zone daylight saving time (used if tz_has_dst is true)
// the 'year' field is ignored (is always 1970)
// these values (hours) are represented in local time (UTC + tz_offset)
PT::Date tz_dst_start, tz_dst_end;
// time zone daylight saving time offset
// used when tz_has_dst is true and the current date is whithin tz_dst_start and tz_dst_end
time_t tz_dst_offset;
private:
time_t ParseStrOffset(const wchar_t * str);
time_t GetOffset(PT::Space & space);
bool SetTzDst(PT::Space & year);
};

View File

@@ -19,64 +19,110 @@ TimeZones::TimeZones()
}
time_t TimeZones::ParseOffset(const wchar_t * str)
void TimeZones::Clear()
{
PT::Date date;
bool is_sign = false;
time_t offset = 0;
zone_tab.clear();
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;
if( is_sign )
offset = -offset;
}
return offset;
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];
zone.Add(L"tz_offset", ParseOffset(zone.Text(L"tz_offset_str").c_str()));
zone.Add(L"tz_dst_offset", ParseOffset(zone.Text(L"tz_dst_offset_str").c_str()));
temp_zone.Clear();
if( temp_zone.time_zone.SetTz(zone) )
if( temp_zone.SetTz(zone) )
{
temp_zone.name_key = zone.name;
if( !FindZone(temp_zone.time_zone.tz_id) )
if( !HasZone(temp_zone.id) )
{
tab.push_back(temp_zone);
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.time_zone.tz_id
log << log1 << "Tz: zone with id: " << temp_zone.id
<< " already exists (skipping)" << logend;
}
}
else
{
log << log1 << "System: problem with reading info from time zone: "
log << log1 << "System: problem with reading time zone info from time zone: "
<< zone.name << " (skipping) " << logend;
}
}
@@ -91,14 +137,15 @@ bool TimeZones::ReadTimeZones(const wchar_t * path)
{
parser.UTF8(true);
parser.SetSpace(temp_space);
tab.clear();
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 " << tab.size() << " zones" << logend;
log << log2 << "Tz: time zones loaded, there are " << zone_tab.size() << " zones" << logend;
}
else
if( status == PT::SpaceParser::syntax_error )
@@ -126,38 +173,6 @@ bool TimeZones::ReadTimeZones(const std::wstring & path)
TimeZones::Zone * TimeZones::FindZone(int tz_id)
{
for(size_t i=0 ; i<tab.size() ; ++i)
{
if( tab[i].time_zone.tz_id == tz_id )
return &tab[i];
}
return 0;
}
TimeZones::Zone & TimeZones::operator[](size_t index)
{
return tab[index];
}
size_t TimeZones::Size() const
{
return tab.size();
}
bool TimeZones::Empty() const
{
return tab.empty();
}
void TimeZones::Clear()
{
tab.clear();
}

View File

@@ -21,42 +21,57 @@ class TimeZones
{
public:
struct Zone
{
TimeZone time_zone;
std::wstring name_key; // a key to locale
void Clear()
{
time_zone.Clear();
name_key.clear();
}
};
TimeZones();
// maximum allowed time zone's identifier
void SetTimeZoneMaxId(size_t max_id);
// reading time zone from a file
bool ReadTimeZones(const wchar_t * path);
bool ReadTimeZones(const std::wstring & path);
Zone * FindZone(int tz_id);
Zone & operator[](size_t index);
// returning true if there is a time zone with the zone_id identifier
bool HasZone(size_t zone_id);
// returning a time zone by time zone's identifier
// can return a null pointer if there is no such a zone
TimeZone * GetZone(size_t zone_id);
// returning the number of all time zones
size_t Size() const;
bool Empty() const;
void Clear();
// returning a time zone by an internal index
// usuful for iterating through all zones
// this index is in a range of <0, Size()-1>
// can return a null pointer if the index is out of range
TimeZone * GetZoneByIndex(size_t zone_index);
// return true if there are not any time zones
bool Empty() const;
// clears all time zones
// this does not affect SetTimeZoneMaxId()
// so the size of zone_indices is not changed but all indices are invalidated
void Clear();
private:
typedef std::vector<Zone> Tab;
Tab tab;
// indices to 'tab'
// with this we have O(1) time to find a time zone in 'tab'
// everywhere we use zone_id we refer to this table
// SetTimeZoneMaxId(size_t max_id) sets size of this table to max_id+1
std::vector<size_t> zone_indices;
// time zones
// everywhere we use zone_index we refer to this table
std::vector<TimeZone> zone_tab;
PT::SpaceParser parser;
PT::Space temp_space;
Zone temp_zone;
TimeZone temp_zone;
time_t ParseOffset(const wchar_t * str);
void ParseZones();
void ParseZones();
};

View File

@@ -27,6 +27,8 @@ void User::Clear()
env.Clear();
aenv.Clear();
status = WINIX_ACCOUNT_BLOCKED;
locale_id = 0;
time_zone_id = 0;
}

View File

@@ -12,7 +12,6 @@
#include <string>
#include <vector>
#include "timezone.h"
#include "space/space.h"
#include "date/date.h"
@@ -89,10 +88,11 @@ struct User
// a user can normally login only when status is WINIX_ACCOUNT_READY
int status;
// time zone
// values here are the same as those in env space
// we provide they here to speed up the process of calculating times
TimeZone time_zone;
// locale identifier
size_t locale_id;
// time zone identifier
size_t time_zone_id;
User();