moved winix directories to winixdsubdirectory

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1028 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2016-03-17 08:26:02 +00:00
parent ed5adb3f23
commit 145efe937c
246 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
include Makefile.o.dep
name = export.so
all: $(name)
# -lcurl is used when linking the main winix.so so we don't have to use it here
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name) -o $(name) $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $(LDFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -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
rm -f *.so
rm -f $(name)
include Makefile.dep

View File

@@ -0,0 +1,264 @@
# DO NOT DELETE
edb.o: edb.h ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
edb.o: ../../../winix/db/dbtextstream.h ../../../winix/core/textstream.h
edb.o: ../../../winix/core/misc.h ../../../winix/core/item.h
edb.o: ../../../pikotools/space/space.h ../../../pikotools/textstream/types.h
edb.o: ../../../pikotools/date/date.h ../../../winix/core/requesttypes.h
edb.o: ../../../pikotools/textstream/textstream.h
edb.o: ../../../pikotools/convert/convert.h
edb.o: ../../../pikotools/convert/inttostr.h
edb.o: ../../../pikotools/membuffer/membuffer.h
edb.o: ../../../pikotools/textstream/types.h ../../../pikotools/utf8/utf8.h
edb.o: ../../../winix/core/winix_const.h ../../../winix/core/error.h
edb.o: ../../../pikotools/space/spaceparser.h
edb.o: ../../../pikotools/space/space.h export.h ../../../winix/core/dirs.h
edb.o: ../../../winix/core/dircontainer.h ../../../winix/db/db.h
edb.o: ../../../winix/db/dbbase.h ../../../winix/db/dbitemquery.h
edb.o: ../../../winix/core/item.h ../../../winix/db/dbitemcolumns.h
edb.o: ../../../winix/core/user.h ../../../winix/core/group.h
edb.o: ../../../winix/core/dircontainer.h ../../../winix/core/ugcontainer.h
edb.o: ../../../winix/core/log.h ../../../winix/core/textstream.h
edb.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
edb.o: ../../../winix/core/cur.h ../../../winix/core/request.h
edb.o: ../../../winix/core/error.h ../../../winix/core/config.h
edb.o: ../../../winix/core/htmlfilter.h
edb.o: ../../../winix/templates/htmltextstream.h
edb.o: ../../../pikotools/space/spacetojson.h ../../../ezc/src/outstreams.h
edb.o: ../../../winix/core/session.h ../../../winix/core/user.h
edb.o: ../../../winix/core/plugindata.h ../../../winix/core/rebus.h
edb.o: ../../../winix/core/ipban.h ../../../winix/core/mount.h
edb.o: ../../../winix/templates/locale.h ../../../winix/notify/notify.h
edb.o: ../../../winix/notify/notifypool.h ../../../winix/templates/patterns.h
edb.o: ../../../winix/templates/locale.h
edb.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
edb.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
edb.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
edb.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
edb.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
edb.o: ../../../winix/notify/notifythread.h ../../../winix/core/basethread.h
edb.o: ../../../winix/core/synchro.h ../../../winix/notify/templatesnotify.h
edb.o: ../../../winix/core/config.h ../../../winix/core/users.h
edb.o: ../../../winix/core/ugcontainer.h ../../../winix/core/lastcontainer.h
edb.o: ../../../winix/core/log.h
exportinfo.o: ../../../winix/core/log.h exportinfo.h
exportinfo.o: ../../../winix/core/system.h ../../../winix/core/job.h
exportinfo.o: ../../../winix/core/basethread.h ../../../winix/core/synchro.h
exportinfo.o: ../../../pikotools/space/space.h
exportinfo.o: ../../../pikotools/textstream/types.h
exportinfo.o: ../../../winix/core/dirs.h ../../../winix/core/item.h
exportinfo.o: ../../../pikotools/date/date.h
exportinfo.o: ../../../winix/core/dircontainer.h ../../../winix/db/db.h
exportinfo.o: ../../../winix/db/dbbase.h ../../../winix/db/dbitemquery.h
exportinfo.o: ../../../winix/core/item.h ../../../winix/db/dbitemcolumns.h
exportinfo.o: ../../../winix/core/user.h ../../../winix/core/group.h
exportinfo.o: ../../../winix/core/dircontainer.h
exportinfo.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
exportinfo.o: ../../../winix/core/textstream.h
exportinfo.o: ../../../winix/core/logmanipulators.h
exportinfo.o: ../../../pikotools/textstream/textstream.h
exportinfo.o: ../../../pikotools/convert/convert.h
exportinfo.o: ../../../pikotools/convert/inttostr.h
exportinfo.o: ../../../pikotools/membuffer/membuffer.h
exportinfo.o: ../../../pikotools/textstream/types.h
exportinfo.o: ../../../winix/core/slog.h ../../../winix/core/cur.h
exportinfo.o: ../../../winix/core/request.h
exportinfo.o: ../../../winix/core/requesttypes.h ../../../winix/core/error.h
exportinfo.o: ../../../winix/core/config.h
exportinfo.o: ../../../pikotools/space/spaceparser.h
exportinfo.o: ../../../pikotools/space/space.h
exportinfo.o: ../../../winix/core/htmlfilter.h
exportinfo.o: ../../../winix/templates/htmltextstream.h
exportinfo.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
exportinfo.o: ../../../pikotools/utf8/utf8.h
exportinfo.o: ../../../winix/core/winix_const.h
exportinfo.o: ../../../pikotools/space/spacetojson.h
exportinfo.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
exportinfo.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
exportinfo.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
exportinfo.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
exportinfo.o: ../../../winix/notify/notify.h
exportinfo.o: ../../../winix/notify/notifypool.h
exportinfo.o: ../../../winix/templates/patterns.h
exportinfo.o: ../../../winix/templates/locale.h
exportinfo.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
exportinfo.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
exportinfo.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
exportinfo.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
exportinfo.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
exportinfo.o: ../../../winix/notify/notifythread.h
exportinfo.o: ../../../winix/core/basethread.h
exportinfo.o: ../../../winix/notify/templatesnotify.h
exportinfo.o: ../../../winix/core/config.h ../../../winix/core/users.h
exportinfo.o: ../../../winix/core/ugcontainer.h
exportinfo.o: ../../../winix/core/lastcontainer.h
exportinfo.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
exportinfo.o: ../../../winix/core/crypt.h ../../../winix/core/run.h
exportinfo.o: ../../../winix/core/users.h ../../../winix/core/groups.h
exportinfo.o: ../../../winix/core/group.h ../../../winix/core/loadavg.h
exportinfo.o: ../../../winix/core/image.h ../../../winix/core/threadmanager.h
exportinfo.o: ../../../winix/core/timezones.h ../../../winix/core/timezone.h
exportinfo.o: export.h edb.h ../../../winix/db/dbbase.h
exportinfo.o: ../../../winix/db/dbconn.h ../../../winix/db/dbtextstream.h
exportinfo.o: ../../../winix/core/error.h ../../../winix/core/dirs.h
exportinfo.o: message.h exportthread.h
exportthread.o: exportthread.h ../../../winix/core/basethread.h
exportthread.o: ../../../winix/core/synchro.h message.h
exportthread.o: ../../../winix/core/log.h ../../../winix/core/misc.h
exportthread.o: ../../../winix/core/item.h ../../../pikotools/space/space.h
exportthread.o: ../../../pikotools/textstream/types.h
exportthread.o: ../../../pikotools/date/date.h
exportthread.o: ../../../winix/core/requesttypes.h
exportthread.o: ../../../pikotools/textstream/textstream.h
exportthread.o: ../../../pikotools/convert/convert.h
exportthread.o: ../../../pikotools/convert/inttostr.h
exportthread.o: ../../../pikotools/membuffer/membuffer.h
exportthread.o: ../../../pikotools/textstream/types.h
exportthread.o: ../../../pikotools/utf8/utf8.h
exportthread.o: ../../../winix/core/winix_const.h
funexport.o: funexport.h ../../../winix/functions/functionbase.h
funexport.o: ../../../winix/core/item.h ../../../winix/db/db.h
funexport.o: ../../../winix/db/dbbase.h ../../../winix/db/dbitemquery.h
funexport.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
funexport.o: ../../../pikotools/space/space.h
funexport.o: ../../../pikotools/textstream/types.h
funexport.o: ../../../pikotools/date/date.h ../../../winix/core/group.h
funexport.o: ../../../winix/core/dircontainer.h
funexport.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
funexport.o: ../../../winix/core/textstream.h
funexport.o: ../../../winix/core/logmanipulators.h
funexport.o: ../../../pikotools/textstream/textstream.h
funexport.o: ../../../pikotools/convert/convert.h
funexport.o: ../../../pikotools/convert/inttostr.h
funexport.o: ../../../pikotools/membuffer/membuffer.h
funexport.o: ../../../pikotools/textstream/types.h ../../../winix/core/slog.h
funexport.o: ../../../winix/core/cur.h ../../../winix/core/request.h
funexport.o: ../../../winix/core/requesttypes.h ../../../winix/core/item.h
funexport.o: ../../../winix/core/error.h ../../../winix/core/config.h
funexport.o: ../../../pikotools/space/spaceparser.h
funexport.o: ../../../pikotools/space/space.h
funexport.o: ../../../winix/core/htmlfilter.h
funexport.o: ../../../winix/templates/htmltextstream.h
funexport.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
funexport.o: ../../../pikotools/utf8/utf8.h ../../../winix/core/winix_const.h
funexport.o: ../../../pikotools/space/spacetojson.h
funexport.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
funexport.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
funexport.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
funexport.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
funexport.o: ../../../winix/core/request.h ../../../winix/core/config.h
funexport.o: ../../../winix/core/system.h ../../../winix/core/job.h
funexport.o: ../../../winix/core/basethread.h ../../../winix/core/synchro.h
funexport.o: ../../../winix/core/dirs.h ../../../winix/core/dircontainer.h
funexport.o: ../../../winix/notify/notify.h
funexport.o: ../../../winix/notify/notifypool.h
funexport.o: ../../../winix/templates/patterns.h
funexport.o: ../../../winix/templates/locale.h
funexport.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
funexport.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
funexport.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
funexport.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
funexport.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
funexport.o: ../../../winix/notify/notifythread.h
funexport.o: ../../../winix/core/basethread.h
funexport.o: ../../../winix/notify/templatesnotify.h
funexport.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
funexport.o: ../../../winix/core/lastcontainer.h ../../../winix/core/mounts.h
funexport.o: ../../../winix/core/mountparser.h ../../../winix/core/crypt.h
funexport.o: ../../../winix/core/run.h ../../../winix/core/users.h
funexport.o: ../../../winix/core/groups.h ../../../winix/core/group.h
funexport.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
funexport.o: ../../../winix/core/threadmanager.h
funexport.o: ../../../winix/core/timezones.h ../../../winix/core/timezone.h
funexport.o: ../../../winix/core/synchro.h exportinfo.h export.h edb.h
funexport.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
funexport.o: ../../../winix/db/dbtextstream.h ../../../winix/core/error.h
funexport.o: ../../../winix/core/dirs.h message.h exportthread.h
init.o: ../../../winix/core/log.h ../../../winix/core/plugin.h
init.o: ../../../winix/core/pluginmsg.h ../../../winix/core/log.h
init.o: ../../../winix/core/textstream.h
init.o: ../../../winix/core/logmanipulators.h
init.o: ../../../pikotools/textstream/textstream.h
init.o: ../../../pikotools/space/space.h
init.o: ../../../pikotools/textstream/types.h ../../../pikotools/date/date.h
init.o: ../../../pikotools/convert/convert.h
init.o: ../../../pikotools/convert/inttostr.h
init.o: ../../../pikotools/membuffer/membuffer.h
init.o: ../../../pikotools/textstream/types.h ../../../winix/core/slog.h
init.o: ../../../winix/core/cur.h ../../../winix/core/request.h
init.o: ../../../winix/core/requesttypes.h ../../../winix/core/item.h
init.o: ../../../winix/core/error.h ../../../winix/core/config.h
init.o: ../../../pikotools/space/spaceparser.h
init.o: ../../../pikotools/space/space.h ../../../winix/core/htmlfilter.h
init.o: ../../../winix/templates/htmltextstream.h
init.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
init.o: ../../../pikotools/utf8/utf8.h ../../../winix/core/winix_const.h
init.o: ../../../pikotools/space/spacetojson.h ../../../ezc/src/outstreams.h
init.o: ../../../winix/core/session.h ../../../winix/core/user.h
init.o: ../../../winix/core/plugindata.h ../../../winix/core/rebus.h
init.o: ../../../winix/core/ipban.h ../../../winix/core/mount.h
init.o: ../../../winix/templates/locale.h ../../../winix/core/system.h
init.o: ../../../winix/core/job.h ../../../winix/core/basethread.h
init.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
init.o: ../../../winix/core/dircontainer.h ../../../winix/db/db.h
init.o: ../../../winix/db/dbbase.h ../../../winix/db/dbitemquery.h
init.o: ../../../winix/core/item.h ../../../winix/db/dbitemcolumns.h
init.o: ../../../winix/core/user.h ../../../winix/core/group.h
init.o: ../../../winix/core/dircontainer.h ../../../winix/core/ugcontainer.h
init.o: ../../../winix/notify/notify.h ../../../winix/notify/notifypool.h
init.o: ../../../winix/templates/patterns.h ../../../winix/templates/locale.h
init.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
init.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
init.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
init.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
init.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
init.o: ../../../winix/notify/notifythread.h ../../../winix/core/basethread.h
init.o: ../../../winix/notify/templatesnotify.h ../../../winix/core/config.h
init.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
init.o: ../../../winix/core/lastcontainer.h ../../../winix/core/mounts.h
init.o: ../../../winix/core/mountparser.h ../../../winix/core/crypt.h
init.o: ../../../winix/core/run.h ../../../winix/core/users.h
init.o: ../../../winix/core/groups.h ../../../winix/core/group.h
init.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
init.o: ../../../winix/core/threadmanager.h ../../../winix/core/timezones.h
init.o: ../../../winix/core/timezone.h ../../../winix/core/sessionmanager.h
init.o: ../../../winix/core/sessioncontainer.h
init.o: ../../../winix/core/ipbancontainer.h
init.o: ../../../winix/core/sessionidmanager.h ../../../tito/src/base64.h
init.o: ../../../tito/src/aes.h ../../../winix/functions/functions.h
init.o: ../../../winix/functions/functionbase.h ../../../winix/core/request.h
init.o: ../../../winix/core/system.h ../../../winix/core/synchro.h
init.o: ../../../winix/functions/functionparser.h ../../../winix/core/cur.h
init.o: ../../../winix/functions/account.h ../../../winix/functions/adduser.h
init.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
init.o: ../../../winix/functions/privchanger.h
init.o: ../../../winix/functions/chown.h ../../../winix/functions/ckeditor.h
init.o: ../../../winix/functions/cp.h ../../../winix/functions/default.h
init.o: ../../../winix/functions/download.h ../../../winix/functions/emacs.h
init.o: ../../../winix/functions/env.h ../../../winix/functions/imgcrop.h
init.o: ../../../winix/functions/last.h ../../../winix/functions/login.h
init.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
init.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
init.o: ../../../winix/functions/meta.h ../../../winix/functions/mkdir.h
init.o: ../../../winix/functions/mv.h ../../../winix/functions/nicedit.h
init.o: ../../../winix/functions/node.h ../../../winix/functions/passwd.h
init.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
init.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
init.o: ../../../winix/functions/rmuser.h ../../../winix/functions/sort.h
init.o: ../../../winix/functions/specialdefault.h
init.o: ../../../winix/functions/stat.h ../../../winix/functions/subject.h
init.o: ../../../winix/functions/template.h
init.o: ../../../winix/functions/tinymce.h ../../../winix/functions/uname.h
init.o: ../../../winix/functions/upload.h ../../../winix/functions/uptime.h
init.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
init.o: ../../../winix/core/htmlfilter.h ../../../winix/templates/templates.h
init.o: ../../../winix/templates/patterncacher.h
init.o: ../../../winix/templates/indexpatterns.h
init.o: ../../../winix/templates/patterns.h
init.o: ../../../winix/templates/changepatterns.h
init.o: ../../../winix/templates/htmltextstream.h
init.o: ../../../winix/core/sessionmanager.h exportthread.h message.h
init.o: exportinfo.h export.h edb.h ../../../winix/db/dbbase.h
init.o: ../../../winix/db/dbconn.h ../../../winix/db/dbtextstream.h
init.o: ../../../winix/core/error.h ../../../winix/core/dirs.h funexport.h
init.o: ../../../winix/functions/functionbase.h

View File

@@ -0,0 +1 @@
o = edb.o exportinfo.o exportthread.o funexport.o init.o

View File

@@ -0,0 +1,238 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "edb.h"
#include "core/log.h"
namespace Winix
{
namespace Export
{
void EDb::SetDirs(Dirs * pdirs)
{
dirs = pdirs;
}
void EDb::SetExportCols(PGresult * r)
{
cid = AssertColumn(r, "id");
cuser_id = AssertColumn(r, "user_id");
cdir = AssertColumn(r, "dir");
cftp_id = AssertColumn(r, "ftp_id");
cftp_dir = AssertColumn(r, "ftp_dir");
cname = AssertColumn(r, "name");
cserver = AssertColumn(r, "server");
clogin = AssertColumn(r, "login");
cpass = AssertColumn(r, "pass");
cpass_type = AssertColumn(r, "pass_type");
ccan_change_ftp_params = AssertColumn(r, "can_change_ftp_params");
ccan_change_dir = AssertColumn(r, "can_change_dir");
chttp_server = AssertColumn(r, "http_server");
}
void EDb::SetExportValues(PGresult * r, int row, Export & exp)
{
exp.Clear();
exp.id = AssertValueLong(r, row, cid);
exp.user_id = AssertValueLong(r, row, cuser_id);
exp.ftp_id = AssertValueLong(r, row, cftp_id);
exp.ftp_pass_type = AssertValueInt(r, row, cpass_type);
AssertValueWide(r, row, cdir, exp.dir);
AssertValueWide(r, row, cftp_dir, exp.ftp_dir);
AssertValueWide(r, row, cname, exp.ftp_name);
AssertValueWide(r, row, cserver, exp.ftp_server);
AssertValueWide(r, row, clogin, exp.ftp_login);
AssertValueWide(r, row, chttp_server, exp.http_server);
AssertValueWide(r, row, cpass, exp.ftp_pass);
exp.can_change_ftp_params = AssertValueBool(r, row, ccan_change_ftp_params);
exp.can_change_dir = AssertValueBool(r, row, ccan_change_dir);
}
bool EDb::GetExport(long user_id, std::vector<Export> & export_tab, bool clear_tab)
{
if( clear_tab )
export_tab.clear();
PGresult * r = 0;
bool result = true;
try
{
query.Clear();
query << R( "select export.id, user_id, dir, ftp_id, ftp_dir, can_change_ftp_params, can_change_dir, "
"http_server, name, server, login, pass, pass_type from plugins.export "
"left join plugins.export_ftp on ftp_id = export_ftp.id where user_id = ")
<< user_id
<< R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
SetExportCols(r);
int rows = Rows(r);
for(int i=0 ; i<rows ; ++i)
{
SetExportValues(r, i, exp);
export_tab.push_back(exp);
}
}
catch(const Error &)
{
result = false;
}
ClearResult(r);
return result;
}
bool EDb::GetExport(long id, Export & exp)
{
exp.Clear();
PGresult * r = 0;
bool result = false;
try
{
query.Clear();
query << R( "select export.id, user_id, dir, ftp_id, ftp_dir, can_change_ftp_params, can_change_dir, "
"http_server, name, server, login, pass, pass_type from plugins.export "
"left join plugins.export_ftp on ftp_id = export_ftp.id where export.id = ")
<< id
<< R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
SetExportCols(r);
if( Rows(r) == 1 )
{
SetExportValues(r, 0, exp);
result = true;
}
}
catch(const Error &)
{
}
ClearResult(r);
return result;
}
bool EDb::GetExportDirs(std::vector<ExportDir> & export_tab, bool clear_tab)
{
if( clear_tab )
export_tab.clear();
PGresult * r = 0;
bool result = true;
try
{
query.Clear();
query << R( "select export.id, dir from plugins.export;");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
int rows = Rows(r);
cid = AssertColumn(r, "id");
cdir = AssertColumn(r, "dir");
for(int i=0 ; i<rows ; ++i)
{
exp_dir.id = AssertValueLong(r, i, cid);
AssertValueWide(r, i, cdir, dir_temp);
Item * pdir = dirs->GetDir(dir_temp);
if( pdir )
{
exp_dir.dir_id = pdir->id;
export_tab.push_back(exp_dir);
}
else
{
slog << "There is not such a directory: " << dir_temp << " (skipping)" << logend;
}
}
}
catch(const Error &)
{
result = false;
}
ClearResult(r);
return result;
}
}
} // namespace Winix

View File

@@ -0,0 +1,95 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_export_edb
#define headerfile_winix_plugins_export_edb
#include <vector>
#include "db/dbbase.h"
#include "export.h"
#include "core/dirs.h"
namespace Winix
{
namespace Export
{
class EDb : public DbBase
{
public:
void SetDirs(Dirs * pdirs);
bool GetExport(long user_id, std::vector<Export> & export_tab, bool clear_tab = true);
bool GetExport(long id, Export & exp);
bool GetExportDirs(std::vector<ExportDir> & export_tab, bool clear_tab = true);
private:
Dirs * dirs;
Export exp;
ExportDir exp_dir;
DbTextStream query;
std::wstring dir_temp;
int cid;
int cuser_id;
int cdir;
int cftp_id;
int cftp_dir;
int cname;
int cserver;
int clogin;
int cpass;
int cpass_type;
int ccan_change_ftp_params;
int ccan_change_dir;
int chttp_server;
void SetExportCols(PGresult * r);
void SetExportValues(PGresult * r, int row, Export & exp);
};
}
} // namespace Winix
#endif

View File

@@ -0,0 +1,108 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_export_export
#define headerfile_winix_plugins_export_export
#include <string>
namespace Winix
{
namespace Export
{
struct ExportDir
{
long id;
long dir_id;
};
struct Export
{
long id;
long user_id;
std::wstring dir;
long ftp_id;
std::wstring ftp_dir;
std::wstring ftp_name;
std::wstring ftp_server;
std::wstring ftp_login;
std::wstring ftp_pass;
int ftp_pass_type;
bool can_change_ftp_params;
bool can_change_dir;
std::wstring http_server;
Export()
{
Clear();
}
void Clear()
{
id = user_id = ftp_id = -1;
ftp_pass_type = 0;
dir.clear();
ftp_dir.clear();
ftp_name.clear();
ftp_server.clear();
ftp_login.clear();
ftp_pass.clear();
can_change_ftp_params = false;
can_change_dir = false;
http_server.clear();
}
};
}
} // namespace Winix
#endif

View File

@@ -0,0 +1,367 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "core/log.h"
#include "exportinfo.h"
namespace Winix
{
namespace Export
{
ExportInfo::ExportInfo()
{
use_rsa = false;
}
void ExportInfo::SetSystem(System * psystem)
{
system = psystem;
}
void ExportInfo::SetConfig(Config * pconfig)
{
config = pconfig;
}
void ExportInfo::SetEDb(EDb * pdb)
{
edb = pdb;
}
void ExportInfo::SetDb(Db * pdb)
{
db = pdb;
}
void ExportInfo::SetExportThread(ExportThread * pexport_thread)
{
export_thread = pexport_thread;
}
void ExportInfo::ReadExportDirs()
{
edb->GetExportDirs(export_dirs);
}
void ExportInfo::ReadConfigVars()
{
use_rsa = config->Bool(L"export_rsa", false);
rsa_key = config->Text(L"export_rsa_key");
}
ExportDir * ExportInfo::FindDir(long dir_id)
{
for(size_t i=0 ; i<export_dirs.size() ; ++i)
{
if( dir_id == export_dirs[i].dir_id || system->dirs.HasParent(dir_id, export_dirs[i].dir_id) )
return &export_dirs[i];
}
return 0;
}
bool ExportInfo::DecodePass(Export & exp)
{
if( exp.ftp_pass_type == 0 )
{
}
else
{
/*
if( system->crypt.RSA(false, rsa_key, exp.ftp_pass_bin, pass_decrypted) )
{
PT::UTF8ToWide(pass_decrypted, exp.ftp_pass);
system->crypt.ClearString(pass_decrypted);
}
else
{
log << log1 << "Export: I cannot decrypt a password (RSA failed)" << logend;
return false;
}
*/
}
return true;
}
bool ExportInfo::SkipDir(long dir_id, std::wstring & dir)
{
if( system->dirs.MakePath(dir_id, tmp_dir) )
{
if( !tmp_dir.empty() && IsSubString(tmp_dir, dir) )
{
// tmp_dir has a slash at the end
// we want the slash at the beginning
dir.erase(0, tmp_dir.size()-1);
return true;
}
}
return false;
}
void ExportInfo::ResetRecurrenceCheck()
{
recurrence_check.clear();
}
bool ExportInfo::HasRecurrenceId(long id)
{
return (std::find(recurrence_check.begin(), recurrence_check.end(), id) != recurrence_check.end());
}
void ExportInfo::SendFile(const Item & item, bool thumb, bool put_to_recurrence_tab)
{
ExportDir * exp_dir = FindDir(item.parent_id);
if( !exp_dir )
return;
if( HasRecurrenceId(item.id) )
{
log << log1 << "Export: recurrence found on item.id: " << item.id << ", url: " << item.url << " (skipping)" << logend;
return;
}
if( put_to_recurrence_tab )
recurrence_check.push_back(item.id);
msg.Clear();
system->dirs.MakePath(item.parent_id, msg.path);
msg.path += item.url;
if( item.file_type != WINIX_ITEM_FILETYPE_NONE )
{
msg.type = WINIX_PL_EXPORT_TYPE_CREATE_FILE_STATIC;
if( !system->MakeFilePath(item, msg.url, thumb) )
{
log << log1 << "Export: I cannot create a path to a static file, item id: " << item.id << logend;
return;
}
}
else
{
msg.type = WINIX_PL_EXPORT_TYPE_CREATE_FILE;
msg.url = config->url_proto;
msg.url += config->base_url;// !! IMPROVE ME what about subdomains?
system->dirs.MakePath(item.parent_id, msg.url, false);
msg.url += item.url;
msg.path += L".php"; // !! do konfiga
}
msg.errors = 0;
if( SkipDir(exp_dir->dir_id, msg.path) && edb->GetExport(exp_dir->id, exp) )
{
if( DecodePass(exp) )
{
msg.ftp_login = exp.ftp_login;
msg.ftp_pass = exp.ftp_pass;
msg.ftp_server = exp.ftp_server;
msg.http_server = exp.http_server;
system->dirs.MakePath(exp_dir->dir_id, msg.src_dir);
if( !item.file_path.empty() && thumb ) // !! uzyc file_type
msg.path.insert(0, L"/download"); // !! do konfiga
if( !exp.ftp_dir.empty() )
msg.path.insert(0, exp.ftp_dir);
if( !msg.path.empty() && msg.path[0] != '/' )
msg.path.insert(0, L"/");
export_thread->AddMessage(msg);
}
}
}
void ExportInfo::SendDir(const Item & item)
{
ExportDir * exp_dir = FindDir(item.id);
if( !exp_dir )
return;
if( HasRecurrenceId(item.id) )
{
log << log1 << "Export: recurrence found on item.id: " << item.id << ", url: " << item.url << " (skipping)" << logend;
return;
}
recurrence_check.push_back(item.id);
msg.Clear();
system->dirs.MakePath(item.id, msg.path);
msg.type = WINIX_PL_EXPORT_TYPE_CREATE_FILE;
msg.url = config->url_proto;
msg.url += config->base_url;// !! IMPROVE ME what about subdomains?
system->dirs.MakePath(item.id, msg.url, false);
msg.path += L"index.html"; // !! do konfiga
msg.errors = 0;
if( SkipDir(exp_dir->dir_id, msg.path) && edb->GetExport(exp_dir->id, exp) )
{
if( DecodePass(exp) )
{
msg.ftp_login = exp.ftp_login;
msg.ftp_pass = exp.ftp_pass;
msg.ftp_server = exp.ftp_server;
msg.http_server = exp.http_server;
system->dirs.MakePath(exp_dir->dir_id, msg.src_dir);
if( !exp.ftp_dir.empty() )
msg.path.insert(0, exp.ftp_dir);
if( !msg.path.empty() && msg.path[0] != '/' )
msg.path.insert(0, L"/");
export_thread->AddMessage(msg);
AdditionalExport(item);
}
}
}
void ExportInfo::SendDir(long dir_id)
{
Item * dir = system->dirs.GetDir(dir_id);
if( !dir )
return;
SendDir(*dir);
}
// send all non-static files from a directory
void ExportInfo::SendAllFilesFromDir(long dir_id)
{
iq_dir.SetAll(false, false);
iq_dir.sel_parent_id = true;
iq_dir.sel_url = true;
iq_dir.sel_file = true;
iq_dir.WhereParentId(dir_id);
iq_dir.WhereType(Item::file);
iq_dir.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
db->GetItems(dir_items, iq_dir);
for(size_t i=0 ; i<dir_items.size() ; ++i)
{
SendFile(dir_items[i]);
}
}
void ExportInfo::AdditionalExport(const Item & item)
{
for(size_t i=0 ; i<item.meta.spaces.size() ; ++i)
{
if( item.meta.spaces[i]->name == L"export" )
AdditionalExport(item, *item.meta.spaces[i]);
}
}
void ExportInfo::AdditionalExport(const Item & item, PT::Space & meta)
{
if( meta.ListText(L"additional_export", additional_export) )
{
for(size_t i=0 ; i<additional_export.size() ; ++i)
{
log << log1 << "exportuje dodatkowo takiego swiniaka: " << additional_export[i] << logend;
AdditionalExport(additional_export[i]);
}
}
}
void ExportInfo::AdditionalExport(const std::wstring & path)
{
int res = system->FollowAllLinks(path, additional_export_dir_tab, additional_export_item);
if( res == 0 )
{
// directory
SendDir(*additional_export_dir_tab.back());
}
else
if( res == 1 )
{
// file
// !! uwaga jesli to bedzie plik statyczny (moze dwa razy uzyc raz false i raz true?)
SendFile(additional_export_item);
}
else
{
log << log1 << "Export: incorrect path for additional export: " << path << logend;
}
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,117 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_export_exportinfo
#define headerfile_winix_plugins_export_exportinfo
#include "core/system.h"
#include "db/db.h"
#include "export.h"
#include "edb.h"
#include "message.h"
#include "exportthread.h"
namespace Winix
{
namespace Export
{
class ExportInfo
{
public:
ExportInfo();
void SetSystem(System * psystem);
void SetConfig(Config * pconfig);
void SetEDb(EDb * pdb);
void SetDb(Db * pdb);
void SetExportThread(ExportThread * pexport_thread);
void ReadExportDirs();
void ReadConfigVars();
ExportDir * FindDir(long dir_id);
bool DecodePass(Export & exp);
void SendFile(const Item & item, bool thumb = false, bool put_to_recurrence_tab = true);
void SendDir(const Item & item);
void SendDir(long dir_id);
void SendAllFilesFromDir(long dir_id);
void ResetRecurrenceCheck();
private:
System * system;
Config * config;
EDb * edb;
Db * db;
ExportThread * export_thread;
bool use_rsa;
std::wstring rsa_key;
std::string pass_decrypted;
Message msg;
Export exp;
std::wstring tmp_dir;
std::vector<ExportDir> export_dirs;
DbItemQuery iq_dir;
std::vector<Item> dir_items;
std::vector<std::wstring> additional_export;
std::vector<Item*> additional_export_dir_tab;
Item additional_export_item;
std::vector<long> recurrence_check;
bool SkipDir(long dir_id, std::wstring & dir);
void AdditionalExport(const Item & item);
void AdditionalExport(const Item & item, PT::Space & meta);
void AdditionalExport(const std::wstring & path);
bool HasRecurrenceId(long id);
};
}
} // namespace Winix
#endif

View File

@@ -0,0 +1,584 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <string.h>
#include "exportthread.h"
#include "core/log.h"
#include "core/misc.h"
#include "utf8/utf8.h"
namespace Winix
{
namespace Export
{
ExportThread * ExportThread::exp_thread;
ExportThread::ExportThread()
{
exp_thread = 0;
browser_name = "Winix Export";
conn_timeout = 5;
conn_max_errors = 3;
}
void ExportThread::SetBaseUrl(const std::wstring & url)
{
// SetBaseUrl() is called before this thread
// is started so we can use 'base_url' later without locking
base_url = url;
}
void ExportThread::AddMessage(const Message & message)
{
message_tab.insert(message_tab.end(), message);
WakeUpThread();
}
// first thread (objects locked)
void ExportThread::AddMessage(int type, const std::wstring & url, const std::wstring & path)
{
message_add_temp.type = type;
message_add_temp.url = url;
message_add_temp.path = path;
AddMessage(message_add_temp);
}
// second thread
// objects are locked
bool ExportThread::SignalReceived()
{
return !message_tab.empty();
}
// second thread
// objects are not locked
void ExportThread::Do()
{
MessageTab::iterator i;
bool end;
Lock();
i = message_tab.begin();
Unlock();
do
{
Lock();
if( i != message_tab.end() )
{
message_work = *i;
Unlock();
DoMessage();
Lock();
// although there was Unlock() used we can use the same iterator 'i' here
// it will *not* be invalidated (MessageTab is a std::list)
// and we are deleting only here
i->errors = message_work.errors;
if( message_work.can_remove )
message_tab.erase(i++);
end = false;
}
else
{
end = true;
}
WaitForSignalSleep(1);
Unlock();
}
while( !end && !IsExitSignal() );
}
// second thread
// objects are not locked
// current message we have in 'message_work'
void ExportThread::DoMessage()
{
bool sent_ok = false;
Convert(message_work.url, url_a);
if( message_work.type == WINIX_PL_EXPORT_TYPE_CREATE_FILE )
{
if( Fetch(url_a.c_str()) )
{
ChangeAdresses(buffer);
if( Put() )
sent_ok = true;
}
}
else
{
if( Put() )
sent_ok = true;
}
if( sent_ok )
{
message_work.can_remove = true;
}
else
{
message_work.errors += 1;
message_work.can_remove = false;
if( message_work.errors > conn_max_errors )
{
message_work.can_remove = true;
Lock();
log << log1 << "Export: too many errors for uploading " << message_work.path << " (skipping)" << logend << logsave;
Unlock();
}
}
}
// second thread
// objects are not locked
bool ExportThread::Fetch(const char * url)
{
Lock();
CURL * curl = curl_easy_init();
Unlock();
if( !curl )
{
Lock();
log << log1 << "Export: I can't use curl" << logend;
Unlock();
return false;
}
error_buf[0] = 0;
exp_thread = this;
buffer.clear();
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, StaticSaveFunction);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_USERAGENT, browser_name.c_str());
curl_easy_setopt(curl, CURLOPT_TIMEOUT, conn_timeout);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, conn_timeout);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buf);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 20);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if( res != 0 )
{
Lock();
log << log1 << "Export: download failed: " << error_buf << logend << logsave;
Unlock();
return false;
}
return true;
}
size_t ExportThread::StaticSaveFunction(char * ptr, size_t size, size_t nmemb, void *userdata)
{
if( exp_thread )
return exp_thread->SaveFunction(ptr, size, nmemb, userdata);
return 0;
}
size_t ExportThread::SaveFunction(char * ptr, size_t size, size_t nmemb, void *userdata)
{
size_t len = size * nmemb;
if( len > 0 )
buffer.append(ptr, len);
return len;
}
// second thread
// objects are not locked
void ExportThread::Convert(const std::wstring & in, std::string & out, bool clear)
{
Lock();
PT::WideToUTF8(in, out, clear);
Unlock();
}
// second thread
// objects are not locked
bool ExportThread::Put()
{
FILE * file = 0;
if( message_work.type == WINIX_PL_EXPORT_TYPE_CREATE_FILE_STATIC )
{
Convert(message_work.url, local_path);
file = fopen(local_path.c_str(), "r");
if( !file )
{
Lock();
log << log1 << "Export: I cannot open the file: " << local_path << logend;
Unlock();
return false;
}
else
{
log << log3 << "Export: sending a static file: " << local_path << logend;
}
}
Lock();
CURL * curl = curl_easy_init();
Unlock();
if( !curl )
{
Lock();
log << log1 << "Export: I can't use curl (sending)" << logend;
Unlock();
if( file )
fclose(file);
return false;
}
exp_thread = this;
error_buf[0] = 0;
buffer_read_index = 0;
ftp_server = "ftp://";
Convert(message_work.ftp_server, ftp_server, false);
Convert(message_work.path, ftp_server, false);
Convert(message_work.ftp_login, ftp_login);
Convert(message_work.ftp_pass, ftp_pass);
curl_easy_setopt(curl, CURLOPT_URL, ftp_server.c_str());
curl_easy_setopt(curl, CURLOPT_USERNAME, ftp_login.c_str());
curl_easy_setopt(curl, CURLOPT_PASSWORD, ftp_pass.c_str());
curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 2);
curl_easy_setopt(curl, CURLOPT_USERAGENT, browser_name.c_str());
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
curl_easy_setopt(curl, CURLOPT_FTP_RESPONSE_TIMEOUT, conn_timeout);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buf);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
if( file )
{
curl_easy_setopt(curl, CURLOPT_READDATA, file);
}
else
{
curl_easy_setopt(curl, CURLOPT_READFUNCTION, StaticReadFunction);
curl_easy_setopt(curl, CURLOPT_INFILESIZE, buffer.size());
}
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if( file )
fclose(file);
if( res != 0 )
{
Lock();
log << log1 << "Export: upload failed: " << error_buf << " (" << ftp_server << ")" << logend << logsave;
Unlock();
return false;
}
else
{
Lock();
log << log2 << "Export: uploaded: " << ftp_server << logend << logsave;
Unlock();
}
return true;
}
size_t ExportThread::StaticReadFunction(char * ptr, size_t size, size_t nmemb, void *userdata)
{
if( exp_thread )
return exp_thread->ReadFunction(ptr, size, nmemb, userdata);
return 0;
}
size_t ExportThread::ReadFunction(char * ptr, size_t size, size_t nmemb, void *userdata)
{
size_t max_len = size * nmemb;
size_t i;
for(i=0 ; i<max_len && buffer_read_index < buffer.size() ; ++i, ++buffer_read_index )
{
ptr[i] = buffer[buffer_read_index];
}
return i;
}
// second thread
// objects locked
bool ExportThread::HasThumbInAdress(std::string & buf, size_t i)
{
const char * thumb1 = "/-/thumb";
const char * thumb2 = "/download/thumb";
size_t len1 = strlen(thumb1);
size_t len2 = strlen(thumb2);
for( ; i<buf.size() ; ++i)
{
if( IsSubStringp(thumb1, &buf[i]) )
{
buf.erase(i, len1);
return true;
}
if( IsSubStringp(thumb2, &buf[i]) )
{
buf.erase(i, len2);
return true;
}
if( buf[i] == 10 || buf[i] == '"' || buf[i] == ' ' || buf[i] == '\t' ||
buf[i] == '>' ||buf[i] == '<' )
{
return false;
}
}
return false;
}
// second thread
// objects locked
void ExportThread::ChangeAdressesThumb(std::string & buf, const char * http_prefix)
{
look_for_url = http_prefix;
Convert(base_url, look_for_url, false);
Convert(message_work.src_dir, look_for_url, false);
for(size_t i=0 ; i<buf.size() ; ++i)
{
if( IsSubStringp(look_for_url.c_str(), &buf[i]) )
{
i += look_for_url.size() - 1; // without skipping the last slash
if( HasThumbInAdress(buf, i) )
{
if( i <= buf.size() )
buf.insert(i, "/download"); //!! do konfiga (prefiks katalogu z miniaturami na serwerze docelowym)
}
}
}
}
// second thread
// objects not locked
void ExportThread::ChangeAdressesThumb(std::string & buf)
{
Lock();
ChangeAdressesThumb(buf, "http://");
ChangeAdressesThumb(buf, "https://");
Unlock();
}
// second thread
// objects locked
void ExportThread::ChangeLogStrings()
{
log << log3 << "Export: changing string: |" << look_for_url << "|, to: |" << repl_url << "|" << logend;
}
// second thread
// objects locked
void ExportThread::ChangeBaseAdress(std::string & buf,
const char * http_prefix, const char * dir_prefix, const char * dir_postfix,
const char * repl_dir_postfix, bool skip_dir_last_slash)
{
look_for_url = http_prefix;
Convert(base_url, look_for_url, false);
look_for_url += dir_prefix;
Convert(message_work.src_dir, look_for_url, false);
if( skip_dir_last_slash )
NoLastSlash(look_for_url);
look_for_url += dir_postfix;
Convert(message_work.http_server, repl_url);
repl_url += repl_dir_postfix;
ChangeLogStrings();
ReplaceString(buf, look_for_url, repl_url);
}
// second thread
// objects not locked
void ExportThread::ChangeBaseAdress(std::string & buf,
const char * dir_prefix, const char * dir_postfix,
const char * repl_dir_postfix, bool skip_dir_last_slash)
{
Lock();
ChangeBaseAdress(buf, "http://", dir_prefix, dir_postfix, repl_dir_postfix, skip_dir_last_slash);
ChangeBaseAdress(buf, "https://", dir_prefix, dir_postfix, repl_dir_postfix, skip_dir_last_slash);
Unlock();
}
// second thread
// objects not locked
void ExportThread::ChangeSiteNames(std::string & buf)
{
Lock();
// changing:
// /sitename/ -> /
Convert(message_work.src_dir, look_for_url);
repl_url = '/';
ChangeLogStrings();
ReplaceString(buf, look_for_url, repl_url);
// changing:
// /sitename" -> /"
NoLastSlash(look_for_url);
look_for_url += '\"';
repl_url = "/\"";
ChangeLogStrings();
ReplaceString(buf, look_for_url, repl_url);
Unlock();
}
// second thread
// objects not locked
void ExportThread::ChangeAdresses(std::string & buf)
{
// http:// in sources here means either http:// or https://
// changing:
// http://domain.tld/sitename/[...]/file.jpg/-/thumb -> http://otherdomain.tld/download/[...]/file.jpg
// http://domain.tld/sitename/[...]/file.jpg/download/thumb -> http://otherdomain.tld/download/[...]/file.jpg
ChangeAdressesThumb(buf);
// changing:
// http://domain.tld/static/sitename/ -> http://otherdomain.tld/static/
ChangeBaseAdress(buf, "/static", "", "/static/");
// changing:
// http://domain.tld/common/sitename/ -> http://otherdomain.tld/common/
//ChangeAdresss(buf, "/common", "", "/common/");
// changing:
// http://domain.tld/sitename/ -> http://otherdomain.tld/
ChangeBaseAdress(buf, "", "", "/");
// changing:
// http://domain.tld/sitename" -> http://otherdomain.tld"
ChangeBaseAdress(buf, "", "\"", "\"", true);
// changing:
// /sitename/ -> /
// /sitename" -> /"
ChangeSiteNames(buf);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,123 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_export_exportthread
#define headerfile_winix_plugins_export_exportthread
#include <vector>
#include <list>
#include <curl/curl.h>
#include "core/basethread.h"
#include "message.h"
namespace Winix
{
namespace Export
{
class ExportThread : public BaseThread
{
public:
ExportThread();
void SetBaseUrl(const std::wstring & url);
void AddMessage(const Message & message);
void AddMessage(int type, const std::wstring & url, const std::wstring & path);
private:
typedef std::list<Message> MessageTab;
MessageTab message_tab;
Message message_add_temp;
Message message_work; // a message used by the second thread
static ExportThread * exp_thread;
std::string url_a;
std::string buffer;
size_t buffer_read_index;
std::wstring base_url;
std::string browser_name;
std::string ftp_server;
std::string ftp_login;
std::string ftp_pass;
char error_buf[CURL_ERROR_SIZE];
int conn_timeout; // timeout in seconds
int conn_max_errors; // maximum errors (if there are more then a message is treated as undeliverable)
std::string look_for_url;
std::string repl_url;
std::string local_path;
virtual bool SignalReceived();
virtual void Do();
void DoMessage();
bool Fetch(const char * url);
bool Put();
static size_t StaticSaveFunction(char * ptr, size_t size, size_t nmemb, void *userdata);
size_t SaveFunction(char * ptr, size_t size, size_t nmemb, void *userdata);
static size_t StaticReadFunction(char * ptr, size_t size, size_t nmemb, void *userdata);
size_t ReadFunction(char * ptr, size_t size, size_t nmemb, void *userdata);
void Convert(const std::wstring & in, std::string & out, bool clear = true);
void ChangeAdresses(std::string & buf);
bool HasThumbInAdress(std::string & buf, size_t i);
void ChangeAdressesThumb(std::string & buf, const char * http_prefix);
void ChangeAdressesThumb(std::string & buf);
void ChangeLogStrings();
void ChangeBaseAdress(std::string & buf,
const char * http_prefix, const char * dir_prefix, const char * dir_postfix,
const char * repl_dir_postfix, bool skip_dir_last_slash = false);
void ChangeBaseAdress(std::string & buf,
const char * dir_prefix, const char * dir_postfix,
const char * repl_dir_postfix, bool skip_dir_last_slash = false);
void ChangeSiteNames(std::string & buf);
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,151 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2012-2014, 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.
*
*/
#include "funexport.h"
namespace Winix
{
namespace Export
{
FunExport::FunExport()
{
fun.url = L"export";
}
void FunExport::SetExportInfo(ExportInfo * pexport_info)
{
export_info = pexport_info;
}
bool FunExport::HasAccess()
{
// temporarily only a logged user can use this function
// !! IMPROVEME we have to change to only some users can use this function in a specified directory
return cur->session->puser;
}
void FunExport::ExportFile(const Item & item)
{
log << log4 << "Export: exporting file: url: " << item.url << ", id: " << item.id << logend;
if( item.file_type == WINIX_ITEM_FILETYPE_NONE )
{
export_info->SendFile(item, false, true);
}
else
{
export_info->SendFile(item, false, false);
export_info->SendFile(item, true, true);
}
}
void FunExport::ExportDir(const Item & dir, bool static_files_too)
{
export_info->SendDir(dir);
log << log4 << "Export: exporting directory: url: " << dir.url << ", id: " << dir.id << logend;
iq_dir.SetAll(false, false);
iq_dir.sel_parent_id = true;
iq_dir.sel_url = true;
iq_dir.sel_file = true;
iq_dir.WhereParentId(dir.id);
iq_dir.WhereType(Item::file);
if( !static_files_too )
iq_dir.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
db->GetItems(dir_items, iq_dir);
for(size_t i=0 ; i<dir_items.size() ; ++i)
{
ExportFile(dir_items[i]);
}
DirContainer::ParentIterator i = system->dirs.FindFirstChild(dir.id);
for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextChild(i) )
{
ExportDir(*i->second, static_files_too);
}
}
void FunExport::Export()
{
export_info->ResetRecurrenceCheck();
bool static_files_too = cur->request->IsPostVar(L"staticfilestoo");
if( cur->request->is_item )
ExportFile(cur->request->item);
else
ExportDir(*cur->request->dir_tab.back(), static_files_too);
}
void FunExport::MakePost()
{
Export();
}
void FunExport::MakeGet()
{
// if( cur->request->IsParam(L"noconfirm") )
// Export();
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,84 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2012-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_export_funexport
#define headerfile_winix_plugins_export_funexport
#include "functions/functionbase.h"
#include "db/db.h"
#include "exportinfo.h"
namespace Winix
{
namespace Export
{
class FunExport : public FunctionBase
{
public:
FunExport();
void SetExportInfo(ExportInfo * pexport_info);
bool HasAccess();
void MakePost();
void MakeGet();
void ExportFile(const Item & item);
void ExportDir(const Item & dir, bool static_files_too = false);
private:
ExportInfo * export_info;
DbItemQuery iq_dir;
std::vector<Item> dir_items;
void Export();
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,297 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "core/log.h"
#include "core/plugin.h"
#include "exportthread.h"
#include "exportinfo.h"
#include "edb.h"
#include "funexport.h"
namespace Winix
{
extern "C" void Init(PluginInfo &);
namespace Export
{
const wchar_t plugin_name[] = L"export";
int mount_par_export_conf = -1;
ExportThread export_thread;
EDb edb;
ExportInfo export_info;
FunExport fun_export;
void AddWinixFunctions(PluginInfo & info)
{
info.functions->Add(fun_export);
}
void AddMountParams(PluginInfo & info)
{
using TemplatesFunctions::system;
mount_par_export_conf = system->mounts.AddMountPar(L"export_conf");
}
void FstabChanged(PluginInfo & info)
{
}
void InitPlugin(PluginInfo & info)
{
export_thread.SetBaseUrl(info.config->base_url);
info.system->thread_manager.Add(&export_thread, L"export");
export_info.ReadExportDirs();
}
void SendDir(PluginInfo & info)
{
const Item * dir = reinterpret_cast<Item*>(info.p1);
if( dir )
{
export_info.ResetRecurrenceCheck();
export_info.SendDir(*dir);
export_info.SendAllFilesFromDir(dir->id);
}
}
void SendFileAdded(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
{
if( item->file_type == WINIX_ITEM_FILETYPE_IMAGE && info.config->image_resize )
{
// there'll be a next message WINIX_IMAGE_RESIZED
log << log4 << "Export: image will be resized, waiting..." << logend;
}
else
{
export_info.ResetRecurrenceCheck();
export_info.SendFile(*item);
export_info.SendDir(item->parent_id);
if( item->file_type == WINIX_ITEM_FILETYPE_NONE )
export_info.SendAllFilesFromDir(item->parent_id);
}
}
}
void SendFileChanged(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
{
export_info.ResetRecurrenceCheck();
export_info.SendFile(*item);
export_info.SendDir(item->parent_id);
if( item->file_type == WINIX_ITEM_FILETYPE_NONE )
export_info.SendAllFilesFromDir(item->parent_id);
}
}
void SendFileCopied(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
{
export_info.ResetRecurrenceCheck();
export_info.SendDir(item->parent_id);
if( item->file_type == WINIX_ITEM_FILETYPE_NONE )
{
export_info.SendAllFilesFromDir(item->parent_id);
}
else
{
export_info.SendFile(*item);
export_info.SendFile(*item, true);
}
}
}
void SendFileResized(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
{
export_info.ResetRecurrenceCheck();
export_info.SendFile(*item);
export_info.SendDir(item->parent_id);
}
}
void SendFileThumb(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
{
export_info.ResetRecurrenceCheck();
export_info.SendFile(*item, true);
export_info.SendDir(item->parent_id);
}
}
void SendFilePrepareMove(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
{
if( item->file_type == WINIX_ITEM_FILETYPE_NONE )
{
export_info.ResetRecurrenceCheck();
export_info.SendAllFilesFromDir(item->parent_id);
}
}
}
void FileRemoved(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
{
export_info.ResetRecurrenceCheck();
export_info.SendDir(item->parent_id);
if( item->file_type == WINIX_ITEM_FILETYPE_NONE )
export_info.SendAllFilesFromDir(item->parent_id);
}
}
void ProcessRequest(PluginInfo & info)
{
if( info.cur->request->function == &info.functions->fun_reload )
{
if( info.cur->request->IsParam(L"export") )
export_info.ReadExportDirs();
}
}
void AddEzcFunctions(PluginInfo & info);
} // namespace
void Init(PluginInfo & info)
{
using namespace Export;
edb.SetConn(info.db->GetConn());
edb.LogQueries(info.config->log_db_query);
edb.SetDirs(&info.system->dirs);
export_info.SetSystem(info.system);
export_info.SetConfig(info.config);
export_info.SetEDb(&edb);
export_info.SetDb(info.db);
export_info.SetExportThread(&export_thread);
fun_export.SetExportInfo(&export_info);
// plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_ADD_MOUNTS, AddMountParams);
// plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged);
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddWinixFunctions);
plugin.Assign(WINIX_FILE_ADDED, SendFileAdded);
plugin.Assign(WINIX_FILE_CHANGED, SendFileChanged);
plugin.Assign(WINIX_CREATED_THUMB, SendFileThumb);
plugin.Assign(WINIX_IMAGE_RESIZED, SendFileResized);
plugin.Assign(WINIX_FILE_PREPARE_TO_MOVE, SendFilePrepareMove);
plugin.Assign(WINIX_FILE_MOVED, SendFileCopied);
plugin.Assign(WINIX_FILE_COPIED, SendFileCopied);
plugin.Assign(WINIX_DIR_CONTENT_SORTED, SendDir);
plugin.Assign(WINIX_FILE_REMOVED, FileRemoved);
plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
plugin.Assign(WINIX_PLUGIN_INIT, InitPlugin);
info.p1 = (void*)(plugin_name);
}
} // namespace Winix

View File

@@ -0,0 +1,103 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_export_message
#define headerfile_winix_plugins_export_message
#include <string>
namespace Winix
{
// message types
#define WINIX_PL_EXPORT_TYPE_CREATE_FILE 1
#define WINIX_PL_EXPORT_TYPE_CREATE_FILE_STATIC 2
struct Message
{
// message type
int type;
// original (source) url (if message is WINIX_PL_EXPORT_TYPE_CREATE_FILE)
// or a file path (WINIX_PL_EXPORT_TYPE_CREATE_FILE_STATIC)
std::wstring url;
// source directory
std::wstring src_dir;
// output file (directory) name
// relative path
// with a slash at the beginning (and at the end if it is a directory)
std::wstring path;
std::wstring ftp_server;
std::wstring ftp_login;
std::wstring ftp_pass;
// server on which the site will be visible
std::wstring http_server;
// how many errors were with this message
int errors;
// shoud be removed
bool can_remove;
void Clear()
{
type = 0;
errors = 0;
can_remove = true;
url.clear();
src_dir.clear();
path.clear();
ftp_server.clear();
ftp_login.clear();
ftp_pass.clear();
http_server.clear();
}
};
} // namespace Winix
#endif

View File

@@ -0,0 +1,28 @@
include Makefile.o.dep
name = gallery.so
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name) -o $(name) $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $(LDFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -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
rm -f *.so
rm -f $(name)
include Makefile.dep

View File

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

View File

@@ -0,0 +1 @@
o = gallery.o galleryinfo.o init.o templates.o

View File

@@ -0,0 +1,123 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "gallery.h"
namespace Winix
{
namespace Gallery
{
Gallery::Gallery()
{
fun.url = L"gallery";
}
void Gallery::SetGalleryInfo(GalleryInfo * pinfo)
{
gallery_info = pinfo;
}
bool Gallery::HasAccess()
{
return true;
}
void Gallery::CreatePointers()
{
gallery_info->item_sort_tab.resize(gallery_info->item_tab.size());
for(size_t i=0 ; i<gallery_info->item_tab.size() ; ++i)
gallery_info->item_sort_tab[i] = &gallery_info->item_tab[i];
}
void Gallery::SortPointers()
{
}
void Gallery::MakeGetDir()
{
iq.SetAll(false, false);
iq.sel_parent_id = true;
iq.sel_subject = true;
iq.sel_url = true;
iq.sel_type = true;
iq.sel_file = true;
iq.sel_sort_index = true;
iq.sel_meta = true;
iq.WhereParentId(cur->request->dir_tab.back()->id);
iq.WhereFileType(WINIX_ITEM_FILETYPE_IMAGE);
db->GetItems(gallery_info->item_tab, iq);
CreatePointers();
}
void Gallery::MakeGetFile()
{
gallery_info->item_sort_tab.resize(1);
gallery_info->item_sort_tab[0] = &cur->request->item;
}
void Gallery::MakeGet()
{
if( cur->request->is_item )
MakeGetFile();
else
MakeGetDir();
SortPointers();
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,75 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_gallery_gallery
#define headerfile_winix_plugins_gallery_gallery
#include "functions/functionbase.h"
#include "galleryinfo.h"
namespace Winix
{
namespace Gallery
{
class Gallery : public FunctionBase
{
public:
Gallery();
bool HasAccess();
void MakeGet();
void SetGalleryInfo(GalleryInfo * pinfo);
private:
GalleryInfo * gallery_info;
DbItemQuery iq;
void CreatePointers();
void SortPointers();
void MakeGetDir();
void MakeGetFile();
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,65 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "galleryinfo.h"
namespace Winix
{
namespace Gallery
{
void GalleryInfo::Clear()
{
item_tab.clear();
item_sort_tab.clear();
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,89 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_gallery_galleryinfo
#define headerfile_winix_plugins_gallery_galleryinfo
#include <vector>
#include "core/item.h"
namespace Winix
{
namespace Gallery
{
class GalleryInfo
{
public:
// id of a mount type
int mount_type_gallery;
// enable a thread in a specific directory
// and set sort type (asc, desc)
int mount_par_gallery;
int mount_par_gallery_size;
int mount_par_gallery_theme;
// "lightbox" (default)
// "galleria" (http://galleria.aino.se/)
// "galleriathumb" (http://galleria.aino.se/)
int mount_par_gallery_type;
// id of the current plugin
int plugin_id;
void Clear();
std::vector<Item> item_tab;
std::vector<Item*> item_sort_tab;
private:
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,121 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "gallery.h"
#include "core/log.h"
#include "core/plugin.h"
namespace Winix
{
extern "C" void Init(PluginInfo &);
namespace Gallery
{
Gallery fun_gallery;
GalleryInfo gallery_info;
const wchar_t plugin_name[] = L"gallery";
void AddFunctions(PluginInfo & info)
{
info.functions->Add(fun_gallery);
}
void SelectDefaultFunction(PluginInfo & info)
{
if( !info.cur->request->is_item && info.system->mounts.pmount->type == gallery_info.mount_type_gallery )
info.cur->request->function = &fun_gallery;
}
void AddMounts(PluginInfo & info)
{
Mounts & m = info.system->mounts;
gallery_info.mount_type_gallery = m.AddMountType(L"gallery");
gallery_info.mount_par_gallery = m.AddMountPar(L"gallery");
gallery_info.mount_par_gallery_size = m.AddMountPar(L"gallery_size");
gallery_info.mount_par_gallery_type = m.AddMountPar(L"gallery_type");
gallery_info.mount_par_gallery_theme = m.AddMountPar(L"gallery_theme");
}
void EndRequest(PluginInfo & info)
{
gallery_info.Clear();
}
void AddEzcFunctions(PluginInfo & info);
} // namespace
void Init(PluginInfo & info)
{
using namespace Gallery;
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
plugin.Assign(WINIX_ADD_MOUNTS, AddMounts);
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_END_REQUEST, EndRequest);
gallery_info.plugin_id = info.plugin_id;
fun_gallery.SetGalleryInfo(&gallery_info);
info.p1 = (void*)(plugin_name);
}
} // namespace Winix

View File

@@ -0,0 +1,263 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "gallery.h"
#include "core/request.h"
#include "core/misc.h"
#include "core/plugin.h"
#include "templates/templates.h"
#include "functions/functions.h"
#include "templates/miscspace.h"
namespace Winix
{
namespace Gallery
{
using namespace TemplatesFunctions;
using TemplatesFunctions::system;
extern GalleryInfo gallery_info;
extern Gallery fun_gallery;
static size_t gallery_index;
static std::wstring item_dir;
void gallery_tab(Info & i)
{
gallery_index = i.iter;
i.res = gallery_index < gallery_info.item_sort_tab.size();
}
void gallery_tab_index(Info & i)
{
i.out << gallery_index;
}
void gallery_tab_dir(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
system->dirs.MakePath(item.parent_id, item_dir);
i.out << item_dir;
}
}
void gallery_tab_url(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
i.out << item.url;
}
}
void gallery_tab_subject(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
i.out << item.subject;
}
}
void gallery_tab_link(Info & i)
{
doc_proto(i);
i.out << config->base_url;// !! IMPROVE ME what about subdomains?
gallery_tab_dir(i);
gallery_tab_url(i);
}
void gallery_tab_meta_str(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
item.meta.Serialize(i.out, true, false);
}
}
void gallery_tab_meta(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
space(i, item.meta);
}
}
void gallery_tab_meta_tab(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
spaces_tab(i, item.meta);
}
}
void gallery_tab_meta_tab_value(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
spaces_tab_value(i, item.meta);
}
}
void gallery_tab_meta_tab_has_next(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
spaces_tab_has_next(i, item.meta);
}
}
void gallery_width(Info & i)
{
if( !system->mounts.pmount )
return;
Mount & m = *system->mounts.pmount;
if( !m.param[gallery_info.mount_par_gallery_size].defined || m.param[gallery_info.mount_par_gallery_size].arg.size() != 2 )
{
i.out << "800px";
}
else
{
i.out << m.param[gallery_info.mount_par_gallery_size].arg[0];
}
}
void gallery_height(Info & i)
{
if( !system->mounts.pmount )
return;
Mount & m = *system->mounts.pmount;
if( !m.param[gallery_info.mount_par_gallery_size].defined || m.param[gallery_info.mount_par_gallery_size].arg.size() != 2 )
{
i.out << "500px";
}
else
{
i.out << m.param[gallery_info.mount_par_gallery_size].arg[1];
}
}
void gallery_has_not_mount_type(Info & i)
{
i.res = !system->mounts.pmount->IsPar(gallery_info.mount_par_gallery_type);
}
void gallery_mount_type_arg_is(Info & i)
{
i.res = system->mounts.pmount->IsArg(gallery_info.mount_par_gallery_type, i.par);
}
void gallery_mount_theme_arg_is(Info & i)
{
i.res = system->mounts.pmount->IsArg(gallery_info.mount_par_gallery_theme, i.par);
}
void AddEzcFunctions(PluginInfo & info)
{
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
fun->Insert("gallery_tab", gallery_tab);
fun->Insert("gallery_tab_index", gallery_tab_index);
fun->Insert("gallery_tab_dir", gallery_tab_dir);
fun->Insert("gallery_tab_url", gallery_tab_url);
fun->Insert("gallery_tab_subject", gallery_tab_subject);
fun->Insert("gallery_tab_link", gallery_tab_link);
fun->Insert("gallery_tab_meta_str", gallery_tab_meta_str);
fun->Insert("gallery_tab_meta", gallery_tab_meta);
fun->Insert("gallery_tab_meta_tab", gallery_tab_meta_tab);
fun->Insert("gallery_tab_meta_tab_value", gallery_tab_meta_tab_value);
fun->Insert("gallery_tab_meta_tab_has_next", gallery_tab_meta_tab_has_next);
fun->Insert("gallery_width", gallery_width);
fun->Insert("gallery_height", gallery_height);
fun->Insert("gallery_has_not_mount_type", gallery_has_not_mount_type);
fun->Insert("gallery_mount_type_arg_is", gallery_mount_type_arg_is);
fun->Insert("gallery_mount_theme_arg_is", gallery_mount_theme_arg_is);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,28 @@
include Makefile.o.dep
name = group.so
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name) -o $(name) $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $(LDFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -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
rm -f *.so
rm -f $(name)
include Makefile.dep

View File

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

View File

@@ -0,0 +1 @@
o = groupinfo.o groups.o init.o templates.o

View File

@@ -0,0 +1,207 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "groupinfo.h"
#include "core/log.h"
#include "core/system.h"
namespace Winix
{
namespace GroupItem
{
GroupInfo::GroupInfo()
{
mount_par_group_conf = -1;
}
void GroupInfo::SetSystem(System * psystem)
{
system = psystem;
}
void GroupInfo::SetConfig(Config * pconfig)
{
config = pconfig;
}
Groups * GroupInfo::FindGroups(long dir_id)
{
GroupsWrap::iterator i = groups_wrap.find(dir_id);
if( i == groups_wrap.end() )
return 0;
return &(i->second.groups);
}
bool GroupInfo::ParseGroups(const std::wstring & str, Groups & groups)
{
groups.Clear();
PT::Space & space = *groups.GetSpace();
conf_parser.SetSpace(space);
if( conf_parser.ParseString(str) == PT::SpaceParser::ok )
{
groups.Reindex();
}
else
{
slog << logerror << "Syntax error in line: " << conf_parser.line << logend;
log << log1 << "Syntax error in line: " << conf_parser.line << logend;
groups.Clear();
}
return conf_parser.status == PT::SpaceParser::ok;
}
void GroupInfo::MarkAllGroupsToDelete()
{
GroupsWrap::iterator i = groups_wrap.begin();
for( ; i != groups_wrap.end() ; ++i)
i->second.to_delete = true;
}
void GroupInfo::DeleteAllMarkedGroups()
{
GroupsWrap::iterator inext;
GroupsWrap::iterator i = groups_wrap.begin();
while( i != groups_wrap.end() )
{
inext = i;
++inext;
if( i->second.to_delete )
{
log << log3 << "GroupItem: deleting group for dir id: " << i->first << logend;
groups_wrap.erase(i);
}
i = inext;
}
}
bool GroupInfo::GetConfContent(const std::wstring & path)
{
int status = system->FollowAllLinks(path, config_dir_tab, config_file, false, false, false);
if( status != 1 )
{
log << log1 << "GroupItem: problem with reading a config file: " << path << ", status: " << status << logend;
return false;
}
return true;
}
// if skip_existing_configs is true then only new config files will be parsed
void GroupInfo::ReadGroupsConf(Mounts & mounts, bool skip_existing_configs)
{
Mounts::MountTab::const_iterator i;
const Mounts::MountTab * mtab = mounts.GetMountTab();
// loop through all mount points
for(i=mtab->begin() ; i!=mtab->end() ; ++i)
{
const Mount & mount = i->second;
if( mount.param[mount_par_group_conf].defined &&
mount.param[mount_par_group_conf].arg.size() == 1 )
{
const std::wstring & file_name = mount.param[mount_par_group_conf].arg[0];
GroupsWrap::iterator c = groups_wrap.find(mount.dir_id);
bool exists = (c != groups_wrap.end() && c->second.file_name == file_name);
if( exists )
c->second.to_delete = false;
if( !(skip_existing_configs && exists) )
{
if( GetConfContent(file_name) )
{
log << log3 << "GroupItem: parsing conf file: " << config_file.url << logend;
groups_wrap[mount.dir_id].file_name = file_name;
if( !ParseGroups(config_file.content, groups_wrap[mount.dir_id].groups) )
groups_wrap[mount.dir_id].to_delete = true;
}
else
{
if( exists )
c->second.to_delete = true;
}
}
}
}
}
// if skip_existing_configs is true then only new config files will be parsed
void GroupInfo::ReadGroupsConfigs(bool skip_existing_configs)
{
MarkAllGroupsToDelete();
ReadGroupsConf(system->mounts, skip_existing_configs);
DeleteAllMarkedGroups();
}
}
} // namespace Winix

View File

@@ -0,0 +1,115 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_groupitem_groupinfo
#define headerfile_winix_plugins_groupitem_groupinfo
#include <string>
#include <vector>
#include "groups.h"
#include "space/spaceparser.h"
#include "core/item.h"
#include "core/system.h"
#include "core/config.h"
namespace Winix
{
namespace GroupItem
{
struct GroupsWrapItem
{
bool to_delete;
std::wstring file_name;
Groups groups;
GroupsWrapItem()
{
to_delete = false;
}
};
class GroupInfo
{
public:
GroupInfo();
void SetSystem(System * psystem);
void SetConfig(Config * pconfig);
void ReadGroupsConfigs(bool skip_existing_configs);
Groups * FindGroups(long dir_id); // can return a null pointer
int mount_par_group_conf;
private:
System * system;
Config * config;
// map[mount_dir_id] -> GroupsWrapItem
typedef std::map<long, GroupsWrapItem> GroupsWrap;
GroupsWrap groups_wrap;
PT::SpaceParser conf_parser;
std::vector<Item*> config_dir_tab;
Item config_file;
void MarkAllGroupsToDelete();
void DeleteAllMarkedGroups();
bool GetConfContent(const std::wstring & path);
bool ParseGroupsConf(long mount_dir_id, const std::wstring & path);
bool ParseGroups(const std::wstring & str, Groups & groups);
void ReadGroupsConf(Mounts & mounts, bool skip_existing_configs);
};
}
} // namespace Winix
#endif

View File

@@ -0,0 +1,254 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include <limits>
#include "groups.h"
#include "core/log.h"
namespace Winix
{
namespace GroupItem
{
PT::Space * Groups::GetSpace()
{
return &space;
}
void Groups::Reindex()
{
set_index.clear();
group_index_tab.clear();
size_t seti = 0;
while( seti < space.spaces.size() )
{
const std::wstring & name = space.spaces[seti]->name;
if( set_index.find(name) == set_index.end() )
{
set_index[name] = seti;
group_index_tab.push_back(GroupIndex());
ReindexGroups(group_index_tab.back(), *space.spaces[seti]);
seti += 1;
}
else
{
slog << logerror << "set: " << name << " already defined (skipping)" << logend;
space.spaces.erase(space.spaces.begin() + seti);
}
}
}
void Groups::ReindexGroups(GroupIndex & group_index, PT::Space & set)
{
size_t i, v;
// loop through all groups in the set
for( i=0 ; i < set.spaces.size() ; ++i )
{
PT::Space & group = *set.spaces[i];
// !! IMPROVE ME will be safer to copy the value out
// if we used accidently the group.Text later the key
// would be overwritten
const std::wstring & key = group.Text(L"key", L"value");
// loop through all values in the group
for(v=0 ; v<group.spaces.size() ; )
{
std::wstring * vali = group.spaces[v]->GetValue(key);
if( vali )
{
GroupIndex::iterator g = group_index.find(*vali);
if( g == group_index.end() )
{
group_index[*vali] = i;
v += 1;
}
else
{
slog << logwarning << "set: " << set.name << " has a group with a duplicated value: "
<< *vali << " (skipping)" << logend;
group.spaces.erase(group.spaces.begin() + v);
}
}
else
{
log << log1 << "key: " << key << " was not found" << logend;
slog << logwarning << "set: " << set.name
<< " has a group without a value (skipping)" << logend;
group.spaces.erase(group.spaces.begin() + v);
}
}
SortValues(group);
}
}
void Groups::SortValues(PT::Space & group)
{
sort_by = group.Text(L"sort_by");
sort_asc = (group.Text(L"sort_asc", L"true") == L"true");
if( !sort_by.empty() )
{
group.ListText(L"sort", sort_value);
std::sort(group.spaces.begin(), group.spaces.end(), SortFunHelper(this));
}
}
bool Groups::SortFunHelper::operator()(PT::Space * sp1, PT::Space * sp2)
{
const std::wstring & val1 = sp1->Text(groups->sort_by, L"");
const std::wstring & val2 = sp2->Text(groups->sort_by, L"");
if( groups->sort_asc )
return SortValue(val1) < SortValue(val2);
else
return SortValue(val1) > SortValue(val2);
}
size_t Groups::SortFunHelper::SortValue(const std::wstring & val)
{
for(size_t i=0 ; i<groups->sort_value.size() ; ++i)
if( val == groups->sort_value[i] )
return i;
return std::numeric_limits<size_t>::max();
}
bool Groups::Find(const std::wstring & set, const std::wstring & value, size_t & seti, size_t & groupi)
{
SetIndex::iterator i = set_index.find(set);
if( i != set_index.end() )
{
if( i->second < group_index_tab.size() )
{
GroupIndex::iterator viter = group_index_tab[i->second].find(value);
if( viter != group_index_tab[i->second].end() )
{
seti = i->second;
groupi = viter->second;
return true;
}
}
}
return false;
}
const std::wstring & Groups::GetOption(size_t seti, size_t groupi, size_t valuei, const wchar_t * option)
{
if( seti < space.spaces.size() )
{
PT::Space & groups = *space.spaces[seti];
if( groupi < groups.spaces.size() )
{
PT::Space & value = *groups.spaces[groupi];
if( valuei < value.spaces.size() )
return value.spaces[valuei]->Text(option);
}
}
return empty_str;
}
const std::wstring & Groups::GetOption(size_t seti, size_t groupi, size_t valuei, const std::wstring & option)
{
return GetOption(seti, groupi, valuei, option.c_str());
}
size_t Groups::Size(size_t seti, size_t groupi)
{
if( seti < space.spaces.size() )
{
PT::Space & groups = *space.spaces[seti];
if( groupi < groups.spaces.size() )
return groups.spaces[groupi]->spaces.size();
}
return 0;
}
void Groups::Clear()
{
space.Clear();
set_index.clear();
group_index_tab.clear();
}
}
} // namespace Winix

View File

@@ -0,0 +1,159 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_groupitem_groups
#define headerfile_winix_plugins_groupitem_groups
#include <map>
#include <vector>
#include <string>
#include "space/spaceparser.h"
namespace Winix
{
namespace GroupItem
{
class Groups
{
public:
/*
reading all space
(sets and groups)
*/
PT::Space * GetSpace();
/*
building all indexes
*/
void Reindex();
bool Find(const std::wstring & set, const std::wstring & value, size_t & seti, size_t & groupi);
/*
*/
size_t Size(size_t seti, size_t groupi);
const std::wstring & GetOption(size_t seti, size_t groupi, size_t valuei, const wchar_t * option);
const std::wstring & GetOption(size_t seti, size_t groupi, size_t valuei, const std::wstring & option);
/*
removing all groups
*/
void Clear();
private:
/*
our space:
set1 (
# group1
(
( value = "value1"
other = "foo" )
( value = "something"
other = "x" )
)
# group2
(
)
) # end of set1
# we can have more sets
# sets should have a unique name
# groups don't have a name
*/
PT::Space space;
/*
indexes to a set of groups
*/
typedef std::map<std::wstring, size_t> SetIndex;
SetIndex set_index;
/*
indexes to a groups in a set
mapping: value->group index
*/
typedef std::map<std::wstring, size_t> GroupIndex;
/*
group indexes in a specified set
std::vector<how many sets there are>
*/
std::vector<GroupIndex> group_index_tab;
const std::wstring empty_str;
std::wstring sort_by;
bool sort_asc;
PT::Space::Value sort_value;
struct SortFunHelper
{
Groups * groups;
SortFunHelper(Groups * pgroups) : groups(pgroups) {};
size_t SortValue(const std::wstring & val);
bool operator()(PT::Space * sp1, PT::Space * sp2);
};
void ReindexGroups(GroupIndex & group_index, PT::Space & set);
void SortValues(PT::Space & group);
};
}
} // namespace Winix
#endif

View File

@@ -0,0 +1,107 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "core/log.h"
#include "core/plugin.h"
#include "groupinfo.h"
namespace Winix
{
extern "C" void Init(PluginInfo &);
namespace GroupItem
{
const wchar_t plugin_name[] = L"group";
GroupInfo group_info;
void AddMountPar(PluginInfo & info)
{
group_info.mount_par_group_conf = info.system->mounts.AddMountPar(L"group_conf");
}
void FstabChanged(PluginInfo & info)
{
group_info.ReadGroupsConfigs(true);
}
void ProcessRequest(PluginInfo & info)
{
if( info.cur->request->function == &info.functions->fun_reload )
{
if( info.cur->request->IsParam(L"group") )
group_info.ReadGroupsConfigs(false);
}
}
void AddEzcFunctions(PluginInfo & info);
} // namespace
void Init(PluginInfo & info)
{
using namespace GroupItem;
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_ADD_MOUNTS, AddMountPar);
plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged);
plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
group_info.SetSystem(info.system);
group_info.SetConfig(info.config);
info.p1 = (void*)(plugin_name);
}
} // namespace Winix

View File

@@ -0,0 +1,187 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "templates/templates.h"
#include "core/plugin.h"
#include "groupinfo.h"
#include "core/misc.h"
namespace Winix
{
namespace GroupItem
{
using namespace TemplatesFunctions;
using TemplatesFunctions::system;
extern GroupInfo group_info;
static bool group_tab_found = false;
static Groups * pgroups;
static size_t req_id = 0;
static size_t set_index;
static size_t group_index;
static size_t value_index;
static std::wstring last_set, last_value;
static std::wstring path;
void group_tab_init(const std::wstring & set, const std::wstring & value)
{
if( req_id != cur->request->id || last_set != set || last_value != value )
{
req_id = cur->request->id;
pgroups = group_info.FindGroups(cur->mount->dir_id);
last_set = set;
last_value = value;
group_tab_found = false;
if( pgroups && pgroups->Find(set, value, set_index, group_index) )
group_tab_found = true;
}
}
void group_tab(Info & i)
{
if( i.params.size() == 2 )
{
group_tab_init(i.params[0].str, i.params[1].str);
value_index = i.iter;
if( group_tab_found )
i.res = value_index < pgroups->Size(set_index, group_index);
}
else
{
group_tab_found = false;
}
}
void build_current_path()
{
system->dirs.MakePath(cur->request->dir_tab, path);
if( cur->request->is_item )
{
path += cur->request->item.url;
}
else
{
// we assume that directories are without the last trailing slash
NoLastSlash(path);
}
}
void group_link_tab(Info & i)
{
if( i.params.size() == 1 )
{
build_current_path();
group_tab_init(i.params[0].str, path);
value_index = i.iter;
if( group_tab_found )
i.res = value_index < pgroups->Size(set_index, group_index);
}
else
{
group_tab_found = false;
}
}
void group_tab_value(Info & i)
{
if( group_tab_found )
{
if( !i.par.empty() )
i.out << pgroups->GetOption(set_index, group_index, value_index, i.par);
else
i.out << pgroups->GetOption(set_index, group_index, value_index, L"value");
}
}
void group_tab_is_current_link(Info & i)
{
if( group_tab_found )
{
build_current_path();
if( !i.par.empty() )
i.res = (pgroups->GetOption(set_index, group_index, value_index, i.par) == path);
else
i.res = (pgroups->GetOption(set_index, group_index, value_index, L"value") == path);
}
}
void AddEzcFunctions(PluginInfo & info)
{
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
/*
*/
fun->Insert("group_tab", group_tab);
fun->Insert("group_link_tab", group_link_tab);
fun->Insert("group_tab_value", group_tab_value);
fun->Insert("group_tab_is_current_link", group_tab_is_current_link);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,29 @@
include Makefile.o.dep
name = mailregister.so
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name) -o $(name) $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $(LDFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -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
rm -f *.so
rm -f $(name)
include Makefile.dep

View File

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

View File

@@ -0,0 +1 @@
o = funregistermail.o funregistermail_showusers.o init.o mdb.o registermail_info.o templates.o

View File

@@ -0,0 +1,116 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#include "funregistermail.h"
namespace Winix
{
namespace MailRegister
{
FunRegisterMail::FunRegisterMail()
{
fun.url = L"registermail";
pmdb = 0;
pinfo = 0;
}
void FunRegisterMail::SetMDb(MDb * pmdb_)
{
pmdb = pmdb_;
}
void FunRegisterMail::SetInfo(RegisterMailInfo * info)
{
pinfo = info;
}
bool FunRegisterMail::HasAccess()
{
return true;
}
void FunRegisterMail::MakePost()
{
}
void FunRegisterMail::MakeGet()
{
mail = cur->request->ParamValue(L"mail");
int list_id = Toi(cur->request->ParamValue(L"list_id"));
if( pinfo->HasListId(list_id) )
{
TrimWhite(mail);
if( ValidateEmail(mail) )
{
log << log3 << "RM: registering e-mail address: " << mail << logend;
slog << loginfo << "Thank you, your e-mail address has been added to our list" << logend;
pmdb->AddMail(list_id, mail);
}
else
{
log << log2 << "RM: email: " << mail << " doesn't seem to be correct (skipping)" << logend;
slog << logerror << "Sorry but the e-mail address: " << mail << " doesn't seem to be correct" << logend;
}
}
else
{
log << log2 << "RM: there is no a list with id: " << list_id << " (skipping request)" << logend;
}
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,84 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#ifndef headerfile_winix_plugins_mailregister_funregistermail
#define headerfile_winix_plugins_mailregister_funregistermail
#include "functions/functionbase.h"
#include "registermail_info.h"
#include "mdb.h"
namespace Winix
{
namespace MailRegister
{
class FunRegisterMail : public FunctionBase
{
public:
FunRegisterMail();
void SetMDb(MDb * pmdb_);
void SetInfo(RegisterMailInfo * info);
bool HasAccess();
void MakePost();
void MakeGet();
private:
std::wstring mail;
MDb * pmdb;
RegisterMailInfo * pinfo;
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,95 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#include "funregistermail_showusers.h"
namespace Winix
{
namespace MailRegister
{
FunRegisterMailShowUsers::FunRegisterMailShowUsers()
{
fun.url = L"registermailshowusers";
pmdb = 0;
pinfo = 0;
}
void FunRegisterMailShowUsers::SetMDb(MDb * pmdb_)
{
pmdb = pmdb_;
}
void FunRegisterMailShowUsers::SetInfo(RegisterMailInfo * info)
{
pinfo = info;
}
bool FunRegisterMailShowUsers::HasAccess()
{
return cur->session->puser;
}
void FunRegisterMailShowUsers::MakePost()
{
}
void FunRegisterMailShowUsers::MakeGet()
{
pmdb->GetUsers(pinfo->mail_list);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,83 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#ifndef headerfile_winix_plugins_mailregister_funregistermailshowusers
#define headerfile_winix_plugins_mailregister_funregistermailshowusers
#include "functions/functionbase.h"
#include "registermail_info.h"
#include "mdb.h"
namespace Winix
{
namespace MailRegister
{
class FunRegisterMailShowUsers : public FunctionBase
{
public:
FunRegisterMailShowUsers();
void SetMDb(MDb * pmdb_);
void SetInfo(RegisterMailInfo * info);
bool HasAccess();
void MakePost();
void MakeGet();
private:
MDb * pmdb;
RegisterMailInfo * pinfo;
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,188 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#include "core/log.h"
#include "core/plugin.h"
#include "mdb.h"
#include "funregistermail.h"
#include "registermail_info.h"
#include "funregistermail_showusers.h"
namespace Winix
{
extern "C" void Init(PluginInfo &);
namespace MailRegister
{
const wchar_t plugin_name[] = L"mailregister";
MDb mdb;
FunRegisterMail fun_rm;
FunRegisterMailShowUsers fun_rm_showusers;
RegisterMailInfo rm_info;
void AddWinixFunctions(PluginInfo & info)
{
info.functions->Add(fun_rm);
info.functions->Add(fun_rm_showusers);
}
// create a class from these methods
void ReloadConfigFile(PluginInfo & info, Item & file)
{
PT::Space space;
PT::SpaceParser parser;
parser.SetSpace(space);
PT::SpaceParser::Status status = parser.ParseString(file.content);
if( status == PT::SpaceParser::syntax_error )
{
log << log1 << "MR: syntax error in file: " << file.url << ", line: " << parser.line << " (skipping this file)" << logend;
}
else
if( status == PT::SpaceParser::ok )
{
std::wstring * list_id_str = space.GetValue(L"list_id");
if( list_id_str )
{
int list_id = Toi(*list_id_str);
rm_info.lists.insert( std::make_pair(list_id, file.url) );
log << log3 << "RM: file: " << file.url << " parsed successfully" << logend;
}
else
{
log << log1 << "MR: file: " << file.url << " doesn't have a list_id defined (skipping this file)" << logend;
}
}
}
void ConfigReload(PluginInfo & info)
{
rm_info.lists.clear();
std::wstring dir_str = info.config->Text(L"rm_directory", L"/etc/registermail.d"); // !! give a better config variable name
if( dir_str.empty() )
{
log << log1 << "RM: rm_directory config option is empty" << logend;
return;
}
Item * dir = info.system->dirs.GetDir(dir_str);
if( dir )
{
DbItemQuery iq;
std::vector<Item> items;
iq.SetAll(true, false);
iq.WhereParentId(dir->id);
info.db->GetItems(items, iq);
for(Item & item : items)
{
ReloadConfigFile(info, item);
}
}
}
void ProcessRequest(PluginInfo & info)
{
if( info.cur->request->function == &info.functions->fun_reload )
{
if( info.cur->request->IsParam(L"mailregister") )
ConfigReload(info);
}
}
void InitPlugin(PluginInfo & info)
{
ConfigReload(info);
}
void AddEzcFunctions(PluginInfo & info);
} // namespace
void Init(PluginInfo & info)
{
using namespace MailRegister;
mdb.SetConn(info.db->GetConn());
mdb.LogQueries(info.config->log_db_query);
fun_rm.SetMDb(&mdb);
fun_rm.SetInfo(&rm_info);
fun_rm_showusers.SetMDb(&mdb);
fun_rm_showusers.SetInfo(&rm_info);
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddWinixFunctions);
plugin.Assign(WINIX_PLUGIN_INIT, InitPlugin);
plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
info.p1 = (void*)(plugin_name);
}
} // namespace Winix

View File

@@ -0,0 +1,121 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#include "mdb.h"
#include "core/log.h"
namespace Winix
{
namespace MailRegister
{
bool MDb::AddMail(int list_id, const std::wstring & mail)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
try
{
query.Clear();
query << R("insert into plugins.registermail (list_id, mail) values (")
<< list_id
<< mail
<< R(");");
r = AssertQuery(query);
AssertResult(r, PGRES_COMMAND_OK);
//.id = AssertCurrval("core.user_id_seq");
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status == WINIX_ERR_OK;
}
bool MDb::GetUsers(std::vector<std::wstring> & container, bool clear_container)
{
PGresult * r = 0;
Error result = WINIX_ERR_OK;
container.clear();
try
{
query.Clear();
query << R("select * from plugins.registermail")
<< R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
int rows = Rows(r);
for(int i=0 ; i < rows ; ++i)
{
AssertValueWide(r, i, 0, mail);
container.push_back(mail);
}
}
catch(const Error & e)
{
result = e;
}
ClearResult(r);
return result == WINIX_ERR_OK;
}
}
} // namespace Winix

View File

@@ -0,0 +1,78 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#ifndef headerfile_winix_plugins_mailregister_mdb
#define headerfile_winix_plugins_mailregister_mdb
#include <string>
#include <vector>
#include "db/dbbase.h"
#include "core/dirs.h"
namespace Winix
{
namespace MailRegister
{
class MDb : public DbBase
{
public:
bool AddMail(int list_id, const std::wstring & mail);
bool GetUsers(std::vector<std::wstring> & container, bool clear_container = true);
private:
DbTextStream query;
std::wstring mail;
};
}
} // namespace Winix
#endif

View File

@@ -0,0 +1,46 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#include "registermail_info.h"
bool RegisterMailInfo::HasListId(int id)
{
return lists.find(id) != lists.end();
}

View File

@@ -0,0 +1,59 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#ifndef headerfile_winix_plugins_mailregister_registermail_info
#define headerfile_winix_plugins_mailregister_registermail_info
#include <string>
#include <vector>
#include <map>
class RegisterMailInfo
{
public:
std::vector<std::wstring> mail_list;
// list_id -> config_file (without dir)
std::map<int, std::wstring> lists;
bool HasListId(int id);
};
#endif

View File

@@ -0,0 +1,97 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2016, 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.
*
*/
#include "templates/templates.h"
#include "core/plugin.h"
#include "core/item.h"
#include "core/log.h"
#include "core/misc.h"
#include "cache.h"
#include "templates/miscspace.h"
#include "registermail_info.h"
namespace Winix
{
namespace MailRegister
{
using TemplatesFunctions::Info;
using TemplatesFunctions::EzcFun;
using TemplatesFunctions::R;
extern RegisterMailInfo rm_info;
static size_t mails_tab_index = 0;
void registermail_mails_tab(Info & i)
{
mails_tab_index = i.iter;
i.res = mails_tab_index < rm_info.mail_list.size();
}
void registermail_mails_tab_index(Info & i)
{
i.out << (mails_tab_index + 1);
}
void registermail_mails_tab_mail(Info & i)
{
if( mails_tab_index < rm_info.mail_list.size() )
i.out << rm_info.mail_list[mails_tab_index];
}
void AddEzcFunctions(PluginInfo & info)
{
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
fun->Insert("registermail_mails_tab", registermail_mails_tab);
fun->Insert("registermail_mails_tab_index", registermail_mails_tab_index);
fun->Insert("registermail_mails_tab_mail", registermail_mails_tab_mail);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,28 @@
include Makefile.o.dep
name = menu.so
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name) -o $(name) $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $(LDFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -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
rm -f *.so
rm -f $(name)
include Makefile.dep

View File

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

View File

@@ -0,0 +1 @@
o = cache.o init.o templates.o

View File

@@ -0,0 +1,127 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2012-2014, 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.
*
*/
#include "cache.h"
#include "core/misc.h"
namespace Winix
{
namespace Menu
{
void Cache::SetDirs(Dirs * pdirs)
{
dirs = pdirs;
}
CacheItem * Cache::Get(long dir_id, int param)
{
Tab::iterator i;
for(i=tab.begin() ; i!=tab.end() ; ++i)
{
if( i->dir_id == dir_id && i->param == param )
{
return &(*i);
}
}
return 0;
}
CacheItem * Cache::Insert(long dir_id, int param)
{
empty_cache_item.dir_id = dir_id;
empty_cache_item.param = param;
empty_cache_item.menu_items.clear();
if( !dirs->MakePath(dir_id, empty_cache_item.dir) )
empty_cache_item.dir.clear();
NoLastSlash(empty_cache_item.dir);
tab.push_back(empty_cache_item);
return &tab.back();
}
void Cache::Remove(long dir_id)
{
Tab::iterator i;
for(i=tab.begin() ; i!=tab.end() ; )
{
if( i->dir_id == dir_id )
{
tab.erase(i++);
}
else
{
++i;
}
}
}
void Cache::Clear()
{
tab.clear();
}
} // namespace
} // namespace Winix

105
winixd/plugins/menu/cache.h Normal file
View File

@@ -0,0 +1,105 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2012-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_menu_cache
#define headerfile_winix_plugins_menu_cache
#include <string>
#include <vector>
#include <list>
#include "core/item.h"
#include "core/dirs.h"
namespace Winix
{
namespace Menu
{
struct MenuItem
{
long id; // item id
std::wstring url;
std::wstring subject;
PT::Space meta;
Item::Type type;
int file_type;
};
struct CacheItem
{
long dir_id;
int param;
std::vector<MenuItem> menu_items;
std::wstring dir; // without the last slash
CacheItem()
{
dir_id = -1;
param = -1;
}
};
class Cache
{
public:
void SetDirs(Dirs * pdirs);
CacheItem * Get(long dir_id, int param);
CacheItem * Insert(long dir_id, int param);
void Remove(long dir_id);
void Clear();
private:
Dirs * dirs;
typedef std::list<CacheItem> Tab;
Tab tab;
CacheItem empty_cache_item;
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,172 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#include "core/log.h"
#include "core/plugin.h"
#include "cache.h"
namespace Winix
{
extern "C" void Init(PluginInfo &);
namespace Menu
{
const wchar_t plugin_name[] = L"menu";
int mount_par_menu_skip = -1;
Cache cache;
void AddMountParams(PluginInfo & info)
{
using TemplatesFunctions::system;
mount_par_menu_skip = system->mounts.AddMountPar(L"menu_skip");
}
void FstabChanged(PluginInfo & info)
{
if( mount_par_menu_skip == -1 )
return;
/*
// GetMountTab() returns a const pointer so we cannot sort menu_skip parameters
// may change it to non-const in the future?
const Mounts::MountTab * mt = system->mounts.GetMountTab();
Mounts::MountTab::const_iterator i;
for(i = mt->begin() ; i != mt->end() ; ++i)
SortMenuSkip(i->second);
*/
}
void InvalidateCache(long dir_id)
{
log << log4 << "Menu: removing cache for dir id: " << dir_id << logend;
cache.Remove(dir_id);
}
void InvalidateCacheByPointerParent(PluginInfo & info)
{
Item * pitem = reinterpret_cast<Item*>(info.p1);
if( pitem )
InvalidateCache(pitem->parent_id);
}
void InvalidateCacheByPointer(PluginInfo & info)
{
Item * pitem = reinterpret_cast<Item*>(info.p1);
if( pitem )
InvalidateCache(pitem->id);
}
void InvalidateCacheById(PluginInfo & info)
{
InvalidateCache(info.l1);
}
void ProcessRequest(PluginInfo & info)
{
if( info.cur->request->function == &info.functions->fun_reload )
{
if( info.cur->request->IsParam(L"menu") )
{
cache.Clear();
log << log3 << "Menu: cache has been cleared" << logend;
}
}
}
void AddEzcFunctions(PluginInfo & info);
} // namespace
void Init(PluginInfo & info)
{
using namespace Menu;
cache.SetDirs(&info.system->dirs);
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_ADD_MOUNTS, AddMountParams);
plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged);
// !! IMPROVE ME
// use modify parameter from a directory
// (not implemented yet)
plugin.Assign(WINIX_FILE_REMOVED, InvalidateCacheByPointerParent);
plugin.Assign(WINIX_DIR_ADDED, InvalidateCacheByPointerParent);
plugin.Assign(WINIX_DIR_PREPARE_TO_REMOVE, InvalidateCacheByPointerParent);
plugin.Assign(WINIX_DIR_REMOVED, InvalidateCacheById);
plugin.Assign(WINIX_FILE_ADDED, InvalidateCacheByPointerParent);
plugin.Assign(WINIX_FILE_CHANGED, InvalidateCacheByPointerParent);
plugin.Assign(WINIX_FILE_COPIED, InvalidateCacheByPointerParent);
plugin.Assign(WINIX_FILE_PREPARE_TO_MOVE, InvalidateCacheByPointerParent);
plugin.Assign(WINIX_FILE_MOVED, InvalidateCacheByPointerParent);
plugin.Assign(WINIX_DIR_CONTENT_SORTED, InvalidateCacheByPointer);
plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
// !! IMPROVE ME
// we need a WINIX_DIR_CHANGED message
// for example when changing the subject of a directory
info.p1 = (void*)(plugin_name);
}
} // namespace Winix

View File

@@ -0,0 +1,568 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2015, 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.
*
*/
#include "templates/templates.h"
#include "core/plugin.h"
#include "core/item.h"
#include "core/log.h"
#include "core/misc.h"
#include "cache.h"
#include "templates/miscspace.h"
namespace Winix
{
#define WINIX_PL_MENU_PARAM_NONE 0
#define WINIX_PL_MENU_PARAM_IMAGES 1
#define WINIX_PL_MENU_PARAM_DIRS 2
#define WINIX_PL_MENU_PARAM_FILES 3
namespace Menu
{
using namespace TemplatesFunctions;
using TemplatesFunctions::system;
extern int mount_par_menu_skip;
extern Cache cache;
static Ezc::Stack * stack = &empty_stack;
static DbItemQuery iq;
static std::vector<Item> item_tab;
static MenuItem menu_item;
struct StackItem : public Ezc::FunData
{
CacheItem * citem;
StackItem(CacheItem * ci)
{
citem = ci;
}
};
int string_to_param(const std::wstring & param, bool use_log = true)
{
if( param == L"images" )
return WINIX_PL_MENU_PARAM_IMAGES;
else
if( param == L"dirs" )
return WINIX_PL_MENU_PARAM_DIRS;
else
if( param == L"files" )
return WINIX_PL_MENU_PARAM_FILES;
else
if( !param.empty() )
{
if( use_log )
log << log1 << "Menu: unknown parameter: " << param << logend;
}
return WINIX_PL_MENU_PARAM_NONE;
}
void read_from_db(long dir_id, int param, bool with_meta)
{
iq.SetAll(false, false);
iq.sel_subject = true;
iq.sel_url = true;
iq.sel_sort_index = true;
iq.sort_date_asc = false; // !! FIXED ME we need an option for this
iq.sel_type = true;
iq.sel_file = true;
iq.sel_meta = with_meta;
iq.WhereParentId(dir_id);
if( param == WINIX_PL_MENU_PARAM_IMAGES )
{
iq.WhereType(Item::file);
iq.WhereFileType(WINIX_ITEM_FILETYPE_IMAGE);
}
else
if( param == WINIX_PL_MENU_PARAM_DIRS )
{
iq.WhereType(Item::dir);
}
else
if( param == WINIX_PL_MENU_PARAM_FILES )
{
iq.WhereType(Item::file);
}
db->GetItems(item_tab, iq);
log << log4 << "Menu: loaded directories/files from the database for parent_id: "
<< dir_id << logend;
}
// !! IMPROVE ME
// O(n^2) complexity
void skip_mount_items(CacheItem & citem)
{
Mount * m = system->mounts.CalcMount(citem.dir_id);
if( !m || mount_par_menu_skip==-1 || !m->param[mount_par_menu_skip].defined )
return;
const Mount::ParamRow::ParamArg & arg = m->param[mount_par_menu_skip].arg;
for(size_t i=0 ; i<arg.size() ; ++i)
{
for(size_t x=0 ; x<citem.menu_items.size() ; )
{
if( citem.menu_items[x].url == arg[i] )
citem.menu_items.erase(citem.menu_items.begin() + x);
else
x += 1;
}
}
}
void skip_static_files(CacheItem & citem)
{
for(size_t x=0 ; x<citem.menu_items.size() ; )
{
if( citem.menu_items[x].type == Item::file && citem.menu_items[x].file_type != WINIX_ITEM_FILETYPE_NONE )
citem.menu_items.erase(citem.menu_items.begin() + x);
else
x += 1;
}
}
void copy_items(CacheItem & citem)
{
size_t new_size = citem.menu_items.size() + item_tab.size();
if( new_size > citem.menu_items.capacity() )
citem.menu_items.reserve(new_size);
for(size_t i=0 ; i < item_tab.size() ; ++i)
{
menu_item.id = item_tab[i].id;
menu_item.subject = item_tab[i].subject;
menu_item.url = item_tab[i].url;
menu_item.meta = item_tab[i].meta;
menu_item.type = item_tab[i].type;
menu_item.file_type = item_tab[i].file_type;
citem.menu_items.push_back(menu_item);
}
}
void menu_dir_init(Info & i, long dir_id, int param, bool with_meta)
{
CacheItem * citem = cache.Get(dir_id, param);
if( !citem )
{
read_from_db(dir_id, param, with_meta);
citem = cache.Insert(dir_id, param);
copy_items(*citem);
skip_mount_items(*citem);
if( param == WINIX_PL_MENU_PARAM_NONE )
skip_static_files(*citem);
}
i.stack.fun_data = new StackItem(citem);
}
void menu_dir_init(Info & i, const std::wstring & dir, int param, bool with_meta)
{
Item * pdir = system->dirs.GetDir(dir);
if( pdir )
{
menu_dir_init(i, pdir->id, param, with_meta);
}
else
{
log << log1 << "Menu: there is not such a directory: " << dir << logend;
}
}
void menu_dir_init(Info & i)
{
int param = WINIX_PL_MENU_PARAM_NONE;
bool with_meta = false;
if( i.params.size() >= 2 )
param = string_to_param(i.params[1].str);
if( i.params.size() >=3 && i.params[2].str == L"withmeta" )
with_meta = true;
if( i.params.empty() || i.params[0].str.empty() )
{
menu_dir_init(i, cur->request->dir_tab.back()->id, param, with_meta);
}
else
if( !i.params.empty() )
{
if( i.params[0].str == L"current" )
{
if( stack->fun_data )
{
StackItem * previous_sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < previous_sitem->citem->menu_items.size() )
menu_dir_init(i, previous_sitem->citem->menu_items[stack->iter].id, param, with_meta);
}
}
else
if( i.params[0].str == L"this" )
{
menu_dir_init(i, cur->request->dir_tab.back()->id, param, with_meta);
}
else
if( !i.params[0].str.empty() && i.params[0].str[0] != '/' )
{
log << log1 << "Menu: path for a menu should not be relative" << logend;
return;
}
else
{
menu_dir_init(i, i.params[0].str, param, with_meta);
}
}
}
void menu_dir_tab(Info & i)
{
if( !i.stack.fun_data )
menu_dir_init(i);
if( i.stack.fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(i.stack.fun_data);
i.res = (i.stack.iter < sitem->citem->menu_items.size());
}
//
// we have 'current' items so we should remember the stack only from [for] statements
// this allows:
// [for menu_dir_tab "/path"]
// [if menu_dir_tab "current"] (here do not remember the stack)
// [for menu_dir_tab "current"]
// work correctly
// [end]
// [end]
// [end]
//
if( i.is_for )
stack = &i.stack;
}
void menu_dir_tab_index(Info & i)
{
i.out << stack->iter;
}
void menu_dir_tab_subject(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.out << sitem->citem->menu_items[stack->iter].subject;
}
}
void menu_dir_tab_url(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.out << sitem->citem->menu_items[stack->iter].url;
}
}
void menu_dir_tab_link(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.out << sitem->citem->dir << '/'
<< sitem->citem->menu_items[stack->iter].url;
}
}
void menu_dir_tab_meta_str(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
sitem->citem->menu_items[stack->iter].meta.Serialize(i.out, true, false);
}
}
void menu_dir_tab_meta(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
space(i, sitem->citem->menu_items[stack->iter].meta);
}
}
void menu_dir_tab_meta_tab(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
spaces_tab(i, sitem->citem->menu_items[stack->iter].meta);
}
}
void menu_dir_tab_meta_tab_value(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
spaces_tab_value(i, sitem->citem->menu_items[stack->iter].meta);
}
}
void menu_dir_tab_meta_tab_has_next(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
spaces_tab_has_next(i, sitem->citem->menu_items[stack->iter].meta);
}
}
void menu_dir_tab_is_dir(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.res = (sitem->citem->menu_items[stack->iter].type == Item::dir);
}
}
void menu_dir_tab_is_file(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.res = (sitem->citem->menu_items[stack->iter].type == Item::file);
}
}
void menu_dir_tab_is_symlink(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.res = (sitem->citem->menu_items[stack->iter].type == Item::symlink);
}
}
void menu_dir_tab_is_current(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.res = (sitem->citem->menu_items[stack->iter].id == cur->request->last_item->id);
}
}
void menu_dir_tab_is_current_the_same_dir(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.res = (sitem->citem->menu_items[stack->iter].id == cur->request->dir_tab.back()->id);
}
}
// returning true if the dir tab element is a first parent for current item
void menu_dir_tab_is_first_parent_for_current_item(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
i.res = (sitem->citem->menu_items[stack->iter].id == cur->request->last_item->parent_id);
}
}
// returning true if the dir tab element is a parent for current item
// (it don't have to be the first parent - it can be a descendant)
void menu_dir_tab_is_parent_for_current_item(Info & i)
{
if( stack->fun_data )
{
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
if( stack->iter < sitem->citem->menu_items.size() )
{
size_t len = cur->request->dir_tab.size(); // at least one
if( !cur->request->is_item )
{
// the last item is a directory so we don't get it into account
len -= 1;
}
for(size_t a=0 ; a<len ; ++a)
{
if( sitem->citem->menu_items[stack->iter].id == cur->request->dir_tab[a]->id )
{
i.res = true;
break;
}
}
}
}
}
void AddEzcFunctions(PluginInfo & info)
{
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
fun->Insert("menu_dir_tab", menu_dir_tab);
fun->Insert("menu_dir_tab_index", menu_dir_tab_index);
fun->Insert("menu_dir_tab_subject", menu_dir_tab_subject);
fun->Insert("menu_dir_tab_url", menu_dir_tab_url);
fun->Insert("menu_dir_tab_link", menu_dir_tab_link);
fun->Insert("menu_dir_tab_meta_str", menu_dir_tab_meta_str);
fun->Insert("menu_dir_tab_meta", menu_dir_tab_meta);
fun->Insert("menu_dir_tab_meta_tab", menu_dir_tab_meta_tab);
fun->Insert("menu_dir_tab_meta_tab_value", menu_dir_tab_meta_tab_value);
fun->Insert("menu_dir_tab_meta_tab_has_next", menu_dir_tab_meta_tab_has_next);
fun->Insert("menu_dir_tab_is_dir", menu_dir_tab_is_dir);
fun->Insert("menu_dir_tab_is_file", menu_dir_tab_is_file);
fun->Insert("menu_dir_tab_is_symlink", menu_dir_tab_is_symlink);
fun->Insert("menu_dir_tab_is_current", menu_dir_tab_is_current);
fun->Insert("menu_dir_tab_is_current_the_same_dir", menu_dir_tab_is_current_the_same_dir);
fun->Insert("menu_dir_tab_is_first_parent_for_current_item", menu_dir_tab_is_first_parent_for_current_item);
fun->Insert("menu_dir_tab_is_parent_for_current_item", menu_dir_tab_is_parent_for_current_item);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,28 @@
include Makefile.o.dep
name = stats.so
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name) -o $(name) $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $(LDFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -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
rm -f *.so
rm -f $(name)
include Makefile.dep

View File

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

View File

@@ -0,0 +1 @@
o = bot.o init.o stats.o templates.o

View File

@@ -0,0 +1,85 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include <string.h>
#include "bot.h"
namespace Winix
{
namespace Stats
{
void Bot::SetBrowserName(const std::wstring & name)
{
browser_name = &name;
}
bool Bot::BrowserNameHas(const wchar_t * name)
{
return (browser_name->find(name) != std::wstring::npos);
}
bool Bot::IsGoogle()
{
return BrowserNameHas(L"Googlebot") && BrowserNameHas(L"+http://www.google.com/bot.html");
}
bool Bot::IsYahoo()
{
return BrowserNameHas(L"Yahoo!") && BrowserNameHas(L"yahoo.com");
}
bool Bot::IsBing()
{
if( BrowserNameHas(L"msnbot") && BrowserNameHas(L"+http://search.msn.com/msnbot.htm") )
return true;
return BrowserNameHas(L"bingbot") && BrowserNameHas(L"+http://www.bing.com/bingbot.htm");
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,73 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_stats_bot
#define headerfile_winix_plugins_stats_bot
#include <string>
namespace Winix
{
namespace Stats
{
struct Bot
{
void SetBrowserName(const std::wstring & name);
bool IsGoogle();
bool IsYahoo();
bool IsBing();
private:
const std::wstring * browser_name;
bool BrowserNameHas(const wchar_t * name);
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,245 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include "core/log.h"
#include "core/request.h"
#include "core/config.h"
#include "db/db.h"
#include "bot.h"
#include "stats.h"
#include "templates.h"
#include "statssession.h"
namespace Winix
{
extern "C" void Init(PluginInfo &);
static const wchar_t plugin_name[] = L"stats";
// if there is a winix function parameter nostat_param used
// such as: http://mysite.com/uptime/nostat
// then the statistics will not be calculated
// and winix will not log about creating and destroying plugins date
// (useful when making performance tests so it not change the real statistics)
static const wchar_t nostat_param[] = L"nostat";
namespace Stats
{
Stats stats;
Bot bot;
long current_item_id;
void CalcItemId(Cur * cur)
{
if( cur->request->is_item )
current_item_id = cur->request->item.id;
else
if( !cur->request->dir_tab.empty() )
current_item_id = cur->request->dir_tab.back()->id;
else
current_item_id = -1;
}
void UpdateStats(PluginInfo & info, Stats::ItemStats & item_stats)
{
bot.SetBrowserName(info.cur->request->env_http_user_agent);
stats.global_all += 1;
item_stats.all += 1;
if( bot.IsGoogle() )
{
stats.global_google += 1;
item_stats.google += 1;
}
if( bot.IsYahoo() )
{
stats.global_yahoo += 1;
item_stats.yahoo += 1;
}
if( bot.IsBing() )
{
stats.global_bing += 1;
item_stats.bing += 1;
}
}
void ContentMake(PluginInfo & info)
{
StatsSession * stats_session = 0;
CalcItemId(info.cur);
if( current_item_id == - 1 || !info.plugin_data_base )
return;
stats_session = reinterpret_cast<StatsSession*>(info.plugin_data_base);
stats_session->nostat = info.cur->request->IsParam(nostat_param);
if( stats_session->nostat )
return;
// this simply prevents F5 (refresh) from a webbrowser
if( stats_session->last_visited != -1 &&
stats_session->last_visited == current_item_id )
return;
stats_session->last_visited = current_item_id;
UpdateStats(info, stats.stats_tab[current_item_id]);
if( !stats_session->calculated )
{
stats.global_unique += 1;
stats_session->calculated = true;
}
stats.PeriodicSave();
}
void SessionCreated(PluginInfo & info)
{
StatsSession * d = new StatsSession();
info.session->plugin_data.Assign(d);
if( !info.cur->request->IsParam(nostat_param) )
{
log << log4 << "Stats: created stats plugin data"
<< ", plugin id: " << info.plugin_id
<< ", pointer: " << d << logend;
}
}
void RemoveSession(PluginInfo & info)
{
if( !info.plugin_data_base )
{
// temporarily for debug
// sometimes the pointer is null here
log << log1 << "Stats: why the info.plugin_data_base is zero? !!!!, ses_id: " << info.session->id << logend;
return;
}
StatsSession * d = reinterpret_cast<StatsSession*>(info.plugin_data_base);
if( !d->nostat )
{
log << log4 << "Stats: deleting stats plugin data"
<< ", plugin id: " << info.plugin_id
<< ", pointer: " << info.plugin_data_base << logend;
}
delete info.plugin_data_base;
}
void Close(PluginInfo & info)
{
stats.SaveStats();
}
void RemoveFile(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
stats.RemoveItem(item->id);
}
void RemoveDir(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
stats.RemoveItem(item->id);
}
} // namespace
void Init(PluginInfo & info)
{
using namespace Stats;
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, CreateFunctions);
plugin.Assign(WINIX_CONTENT_MAKE, ContentMake);
plugin.Assign(WINIX_SESSION_CREATED, SessionCreated);
plugin.Assign(WINIX_PLUGIN_SESSION_DATA_REMOVE, RemoveSession);
plugin.Assign(WINIX_CLOSE, Close);
plugin.Assign(WINIX_FILE_REMOVED, RemoveFile);
plugin.Assign(WINIX_DIR_PREPARE_TO_REMOVE, RemoveDir);
stats.ReadConfig(info.config);
stats.ReadStats();
info.p1 = (void*)plugin_name;
}
} // namespace Winix

View File

@@ -0,0 +1,213 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include <ctime>
#include "stats.h"
#include "core/log.h"
#include "utf8/utf8.h"
namespace Winix
{
namespace Stats
{
Stats::Stats()
{
global_all = 0;
global_unique = 0;
global_google = 0;
global_yahoo = 0;
req_save_freq = 1000;
req_current = 0;
stats_start = time(0);
}
void Stats::ReadStats(std::ifstream & file)
{
file >> stats_start;
file >> global_all;
file >> global_unique;
file >> global_google;
file >> global_yahoo;
file >> global_bing;
size_t len;
file >> len;
ItemStats s;
long item_id;
for(size_t i = 0 ; i<len && !file.eof() ; ++i)
{
file >> item_id;
file >> s.all;
file >> s.google;
file >> s.yahoo;
file >> s.bing;
stats_tab.insert( std::make_pair(item_id, s) );
}
}
void Stats::ReadStats()
{
if( stats_file.empty() )
return;
PT::WideToUTF8(stats_file, astats_file);
std::ifstream file(astats_file.c_str());
if( !file )
{
log << log1 << "Stats: I cannot open a file: " << astats_file << logend;
return;
}
ReadStats(file);
file.close();
log << log3 << "Stats: statistics loaded from: " << astats_file
<< " (" << stats_tab.size() << " items)" << logend;
}
void Stats::SaveStats(std::ofstream & file)
{
file << stats_start << std::endl;
file << global_all << ' ';
file << global_unique << ' ';
file << global_google << ' ';
file << global_yahoo << ' ';
file << global_bing << ' ';
file << std::endl;
file << stats_tab.size() << std::endl;
StatsTab::iterator i = stats_tab.begin();
for( ; i != stats_tab.end() ; ++i)
{
file << i->first << ' ';
file << i->second.all << ' ';
file << i->second.google << ' ';
file << i->second.yahoo << ' ';
file << i->second.bing << ' ';
file << std::endl;
}
}
void Stats::SaveStats()
{
if( stats_file.empty() )
return;
PT::WideToUTF8(stats_file, astats_file);
std::ofstream file(astats_file.c_str());
if( !file )
{
log << log1 << "Stats: I cannot open a file: " << astats_file << logend;
return;
}
SaveStats(file);
file.close();
log << log3 << "Stats: statistics saved to: " << astats_file << logend;
}
void Stats::PeriodicSave()
{
req_current += 1;
if( req_save_freq != 0 && req_current >= req_save_freq )
{
SaveStats();
req_current = 0;
}
}
void Stats::ReadConfig(Config * config)
{
stats_file = config->Text(L"stats_file");
req_save_freq = config->Int(L"stats_req_save_freq", req_save_freq);
if( stats_file.empty() )
{
log << log1 << "you should set stats_file in your config to keep statistics between restarting winix" << logend;
}
else
{
log << log2 << "Stats: stats_file: " << stats_file << logend;
log << log2 << "Stats: statistics will be saved after each " << req_save_freq << " requests" << logend;
}
}
void Stats::RemoveItem(long id)
{
StatsTab::iterator i = stats_tab.find(id);
if( i == stats_tab.end() )
return;
stats_tab.erase(i);
log << log3 << "Stats: statistics erased for item: " << id << logend;
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,121 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_stats_stats
#define headerfile_winix_plugins_stats_stats
#include <string>
#include <map>
#include <fstream>
#include "core/config.h"
namespace Winix
{
namespace Stats
{
struct Stats
{
Stats();
void ReadStats();
void SaveStats();
void PeriodicSave();
void ReadConfig(Config * config);
void RemoveItem(long id);
// file name for reading/saving statistics
std::wstring stats_file;
std::string astats_file;
// when the statistics start
time_t stats_start;
int global_all;
int global_unique;
int global_google;
int global_yahoo;
int global_bing;
// statistics for files/dirs
struct ItemStats
{
int all;
int google;
int yahoo;
int bing;
ItemStats()
{
all = 0;
google = 0;
yahoo = 0;
bing = 0;
}
};
// <item_id, Item_stats>
typedef std::map<long, ItemStats> StatsTab;
StatsTab stats_tab;
private:
// when to save the config (how many requests should have gone)
// (for safety: power failure etc)
// default: 1000
// you can set: stats_req_save_freq in the config file to overwrite it
// 0 - turn it off
int req_save_freq;
int req_current; // helper
void ReadStats(std::ifstream & file);
void SaveStats(std::ofstream & file);
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,68 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_stats_statssession
#define headerfile_winix_plugins_stats_statssession
#include "core/plugindata.h"
namespace Winix
{
namespace Stats
{
// session data for the plugin
struct StatsSession : public PluginDataBase
{
// whether this session has been calculated
bool calculated;
long last_visited;
bool nostat; // is nostat parameter
StatsSession()
{
calculated = false;
last_visited = -1;
nostat = false;
}
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,139 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include "templates.h"
#include "ezc.h"
#include "core/misc.h"
#include "stats.h"
#include "templates/misc.h"
namespace Winix
{
namespace Stats
{
using TemplatesFunctions::Info;
extern long current_item_id;
extern Stats stats;
void stats_from(Info & i)
{
i.out << DateToStrWithoutHours(stats.stats_start);
}
void stats_all(Info & i)
{
i.out << stats.global_all;
}
void stats_unique(Info & i)
{
i.out << stats.global_unique;
}
void stats_google(Info & i)
{
i.out << stats.global_google;
}
void stats_yahoo(Info & i)
{
i.out << stats.global_yahoo;
}
void stats_bing(Info & i)
{
i.out << stats.global_bing;
}
void stats_item_all(Info & i)
{
i.out << stats.stats_tab[current_item_id].all;
}
void stats_item_google(Info & i)
{
i.out << stats.stats_tab[current_item_id].google;
}
void stats_item_yahoo(Info & i)
{
i.out << stats.stats_tab[current_item_id].yahoo;
}
void stats_item_bing(Info & i)
{
i.out << stats.stats_tab[current_item_id].bing;
}
void CreateFunctions(PluginInfo & info)
{
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
fun->Insert("stats_from", stats_from);
fun->Insert("stats_all", stats_all);
fun->Insert("stats_unique", stats_unique);
fun->Insert("stats_google", stats_google);
fun->Insert("stats_yahoo", stats_yahoo);
fun->Insert("stats_bing", stats_bing);
fun->Insert("stats_item_all", stats_item_all);
fun->Insert("stats_item_google", stats_item_google);
fun->Insert("stats_item_yahoo", stats_item_yahoo);
fun->Insert("stats_item_bing", stats_item_bing);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,56 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_stats_templates
#define headerfile_winix_plugins_stats_templates
#include "core/plugin.h"
namespace Winix
{
namespace Stats
{
void CreateFunctions(PluginInfo & info);
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,28 @@
include Makefile.o.dep
name = thread.so
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name) -o $(name) $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $(LDFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -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
rm -f *.so
rm -f $(name)
include Makefile.dep

View File

@@ -0,0 +1,623 @@
# DO NOT DELETE
createthread.o: createthread.h ../../../winix/functions/functionbase.h
createthread.o: ../../../winix/core/item.h ../../../pikotools/space/space.h
createthread.o: ../../../pikotools/textstream/types.h
createthread.o: ../../../pikotools/date/date.h ../../../winix/db/db.h
createthread.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
createthread.o: ../../../winix/db/dbtextstream.h
createthread.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
createthread.o: ../../../winix/core/item.h ../../../winix/core/requesttypes.h
createthread.o: ../../../pikotools/textstream/textstream.h
createthread.o: ../../../pikotools/convert/convert.h
createthread.o: ../../../pikotools/convert/inttostr.h
createthread.o: ../../../pikotools/membuffer/membuffer.h
createthread.o: ../../../pikotools/textstream/types.h
createthread.o: ../../../pikotools/utf8/utf8.h
createthread.o: ../../../winix/core/winix_const.h ../../../winix/core/error.h
createthread.o: ../../../pikotools/space/spaceparser.h
createthread.o: ../../../pikotools/space/space.h
createthread.o: ../../../winix/db/dbitemquery.h
createthread.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
createthread.o: ../../../winix/core/group.h
createthread.o: ../../../winix/core/dircontainer.h
createthread.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
createthread.o: ../../../winix/core/textstream.h
createthread.o: ../../../winix/core/logmanipulators.h
createthread.o: ../../../winix/core/slog.h ../../../winix/core/cur.h
createthread.o: ../../../winix/core/request.h ../../../winix/core/error.h
createthread.o: ../../../winix/core/config.h ../../../winix/core/htmlfilter.h
createthread.o: ../../../winix/templates/htmltextstream.h
createthread.o: ../../../pikotools/space/spacetojson.h
createthread.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
createthread.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
createthread.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
createthread.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
createthread.o: ../../../winix/core/request.h ../../../winix/core/config.h
createthread.o: ../../../winix/core/system.h ../../../winix/core/job.h
createthread.o: ../../../winix/core/basethread.h
createthread.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
createthread.o: ../../../winix/core/dircontainer.h
createthread.o: ../../../winix/notify/notify.h
createthread.o: ../../../winix/notify/notifypool.h
createthread.o: ../../../winix/templates/patterns.h
createthread.o: ../../../winix/templates/locale.h
createthread.o: ../../../winix/templates/localefilter.h
createthread.o: ../../../ezc/src/ezc.h ../../../ezc/src/generator.h
createthread.o: ../../../ezc/src/blocks.h ../../../ezc/src/cache.h
createthread.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h
createthread.o: ../../../ezc/src/objects.h ../../../ezc/src/pattern.h
createthread.o: ../../../ezc/src/patternparser.h
createthread.o: ../../../winix/notify/notifythread.h
createthread.o: ../../../winix/core/basethread.h
createthread.o: ../../../winix/notify/templatesnotify.h
createthread.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
createthread.o: ../../../winix/core/lastcontainer.h
createthread.o: ../../../winix/core/mounts.h
createthread.o: ../../../winix/core/mountparser.h ../../../winix/core/crypt.h
createthread.o: ../../../winix/core/run.h ../../../winix/core/users.h
createthread.o: ../../../winix/core/groups.h ../../../winix/core/group.h
createthread.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
createthread.o: ../../../winix/core/threadmanager.h
createthread.o: ../../../winix/core/timezones.h
createthread.o: ../../../winix/core/timezone.h ../../../winix/core/synchro.h
createthread.o: tdb.h thread.h ../../../winix/db/dbbase.h threadinfo.h
createthread.o: ../../../winix/functions/functions.h
createthread.o: ../../../winix/functions/functionbase.h
createthread.o: ../../../winix/functions/functionparser.h
createthread.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
createthread.o: ../../../winix/functions/adduser.h
createthread.o: ../../../winix/functions/cat.h
createthread.o: ../../../winix/functions/chmod.h
createthread.o: ../../../winix/functions/privchanger.h
createthread.o: ../../../winix/functions/chown.h
createthread.o: ../../../winix/functions/ckeditor.h
createthread.o: ../../../winix/functions/cp.h
createthread.o: ../../../winix/functions/default.h
createthread.o: ../../../winix/functions/download.h
createthread.o: ../../../winix/functions/emacs.h
createthread.o: ../../../winix/functions/env.h
createthread.o: ../../../winix/functions/imgcrop.h
createthread.o: ../../../winix/functions/last.h
createthread.o: ../../../winix/functions/login.h
createthread.o: ../../../winix/functions/logout.h
createthread.o: ../../../winix/functions/ln.h ../../../winix/functions/ls.h
createthread.o: ../../../winix/functions/man.h
createthread.o: ../../../winix/functions/meta.h
createthread.o: ../../../winix/functions/mkdir.h
createthread.o: ../../../winix/functions/mv.h
createthread.o: ../../../winix/functions/nicedit.h
createthread.o: ../../../winix/functions/node.h
createthread.o: ../../../winix/functions/passwd.h
createthread.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
createthread.o: ../../../winix/functions/reload.h
createthread.o: ../../../winix/functions/rm.h
createthread.o: ../../../winix/functions/rmuser.h
createthread.o: ../../../winix/functions/sort.h
createthread.o: ../../../winix/functions/specialdefault.h
createthread.o: ../../../winix/functions/stat.h
createthread.o: ../../../winix/functions/subject.h
createthread.o: ../../../winix/functions/template.h
createthread.o: ../../../winix/functions/tinymce.h
createthread.o: ../../../winix/functions/uname.h
createthread.o: ../../../winix/functions/upload.h
createthread.o: ../../../winix/functions/uptime.h
createthread.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
createthread.o: ../../../winix/core/htmlfilter.h
funthread.o: ../../../winix/core/misc.h ../../../winix/core/item.h
funthread.o: ../../../winix/core/requesttypes.h
funthread.o: ../../../pikotools/textstream/textstream.h
funthread.o: ../../../pikotools/space/space.h
funthread.o: ../../../pikotools/textstream/types.h
funthread.o: ../../../pikotools/date/date.h
funthread.o: ../../../pikotools/convert/convert.h
funthread.o: ../../../pikotools/convert/inttostr.h
funthread.o: ../../../pikotools/membuffer/membuffer.h
funthread.o: ../../../pikotools/textstream/types.h
funthread.o: ../../../pikotools/utf8/utf8.h ../../../winix/core/winix_const.h
funthread.o: funthread.h ../../../winix/functions/functionbase.h
funthread.o: ../../../winix/core/item.h ../../../winix/db/db.h
funthread.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
funthread.o: ../../../winix/db/dbtextstream.h
funthread.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
funthread.o: ../../../winix/core/error.h
funthread.o: ../../../pikotools/space/spaceparser.h
funthread.o: ../../../pikotools/space/space.h ../../../winix/db/dbitemquery.h
funthread.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
funthread.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
funthread.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
funthread.o: ../../../winix/core/textstream.h
funthread.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
funthread.o: ../../../winix/core/cur.h ../../../winix/core/request.h
funthread.o: ../../../winix/core/error.h ../../../winix/core/config.h
funthread.o: ../../../winix/core/htmlfilter.h
funthread.o: ../../../winix/templates/htmltextstream.h
funthread.o: ../../../pikotools/space/spacetojson.h
funthread.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
funthread.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
funthread.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
funthread.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
funthread.o: ../../../winix/core/request.h ../../../winix/core/config.h
funthread.o: ../../../winix/core/system.h ../../../winix/core/job.h
funthread.o: ../../../winix/core/basethread.h ../../../winix/core/synchro.h
funthread.o: ../../../winix/core/dirs.h ../../../winix/core/dircontainer.h
funthread.o: ../../../winix/notify/notify.h
funthread.o: ../../../winix/notify/notifypool.h
funthread.o: ../../../winix/templates/patterns.h
funthread.o: ../../../winix/templates/locale.h
funthread.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
funthread.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
funthread.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
funthread.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
funthread.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
funthread.o: ../../../winix/notify/notifythread.h
funthread.o: ../../../winix/core/basethread.h
funthread.o: ../../../winix/notify/templatesnotify.h
funthread.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
funthread.o: ../../../winix/core/lastcontainer.h ../../../winix/core/mounts.h
funthread.o: ../../../winix/core/mountparser.h ../../../winix/core/crypt.h
funthread.o: ../../../winix/core/run.h ../../../winix/core/users.h
funthread.o: ../../../winix/core/groups.h ../../../winix/core/group.h
funthread.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
funthread.o: ../../../winix/core/threadmanager.h
funthread.o: ../../../winix/core/timezones.h ../../../winix/core/timezone.h
funthread.o: ../../../winix/core/synchro.h tdb.h thread.h
funthread.o: ../../../winix/db/dbbase.h threadinfo.h
init.o: tdb.h thread.h ../../../pikotools/date/date.h
init.o: ../../../winix/db/dbbase.h ../../../winix/core/error.h reply.h
init.o: ../../../winix/functions/functionbase.h ../../../winix/core/item.h
init.o: ../../../pikotools/space/space.h
init.o: ../../../pikotools/textstream/types.h ../../../winix/db/db.h
init.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
init.o: ../../../winix/db/dbtextstream.h ../../../winix/core/textstream.h
init.o: ../../../winix/core/misc.h ../../../winix/core/item.h
init.o: ../../../winix/core/requesttypes.h
init.o: ../../../pikotools/textstream/textstream.h
init.o: ../../../pikotools/convert/convert.h
init.o: ../../../pikotools/convert/inttostr.h
init.o: ../../../pikotools/membuffer/membuffer.h
init.o: ../../../pikotools/textstream/types.h ../../../pikotools/utf8/utf8.h
init.o: ../../../winix/core/winix_const.h
init.o: ../../../pikotools/space/spaceparser.h
init.o: ../../../pikotools/space/space.h ../../../winix/db/dbitemquery.h
init.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
init.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
init.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
init.o: ../../../winix/core/textstream.h
init.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
init.o: ../../../winix/core/cur.h ../../../winix/core/request.h
init.o: ../../../winix/core/error.h ../../../winix/core/config.h
init.o: ../../../winix/core/htmlfilter.h
init.o: ../../../winix/templates/htmltextstream.h
init.o: ../../../pikotools/space/spacetojson.h ../../../ezc/src/outstreams.h
init.o: ../../../winix/core/session.h ../../../winix/core/user.h
init.o: ../../../winix/core/plugindata.h ../../../winix/core/rebus.h
init.o: ../../../winix/core/ipban.h ../../../winix/core/mount.h
init.o: ../../../winix/templates/locale.h ../../../winix/core/request.h
init.o: ../../../winix/core/config.h ../../../winix/core/system.h
init.o: ../../../winix/core/job.h ../../../winix/core/basethread.h
init.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
init.o: ../../../winix/core/dircontainer.h ../../../winix/notify/notify.h
init.o: ../../../winix/notify/notifypool.h
init.o: ../../../winix/templates/patterns.h ../../../winix/templates/locale.h
init.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
init.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
init.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
init.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
init.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
init.o: ../../../winix/notify/notifythread.h ../../../winix/core/basethread.h
init.o: ../../../winix/notify/templatesnotify.h ../../../winix/core/users.h
init.o: ../../../winix/core/ugcontainer.h ../../../winix/core/lastcontainer.h
init.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
init.o: ../../../winix/core/crypt.h ../../../winix/core/run.h
init.o: ../../../winix/core/users.h ../../../winix/core/groups.h
init.o: ../../../winix/core/group.h ../../../winix/core/loadavg.h
init.o: ../../../winix/core/image.h ../../../winix/core/threadmanager.h
init.o: ../../../winix/core/timezones.h ../../../winix/core/timezone.h
init.o: ../../../winix/core/synchro.h threadinfo.h funthread.h createthread.h
init.o: showthreads.h ../../../winix/core/log.h ../../../winix/core/plugin.h
init.o: pluginmsg.h ../../../winix/core/system.h
init.o: ../../../winix/core/sessionmanager.h
init.o: ../../../winix/core/sessioncontainer.h
init.o: ../../../winix/core/ipbancontainer.h
init.o: ../../../winix/core/sessionidmanager.h ../../../tito/src/base64.h
init.o: ../../../tito/src/aes.h ../../../winix/functions/functions.h
init.o: ../../../winix/functions/functionbase.h
init.o: ../../../winix/functions/functionparser.h ../../../winix/core/cur.h
init.o: ../../../winix/functions/account.h ../../../winix/functions/adduser.h
init.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
init.o: ../../../winix/functions/privchanger.h
init.o: ../../../winix/functions/chown.h ../../../winix/functions/ckeditor.h
init.o: ../../../winix/functions/cp.h ../../../winix/functions/default.h
init.o: ../../../winix/functions/download.h ../../../winix/functions/emacs.h
init.o: ../../../winix/functions/env.h ../../../winix/functions/imgcrop.h
init.o: ../../../winix/functions/last.h ../../../winix/functions/login.h
init.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
init.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
init.o: ../../../winix/functions/meta.h ../../../winix/functions/mkdir.h
init.o: ../../../winix/functions/mv.h ../../../winix/functions/nicedit.h
init.o: ../../../winix/functions/node.h ../../../winix/functions/passwd.h
init.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
init.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
init.o: ../../../winix/functions/rmuser.h ../../../winix/functions/sort.h
init.o: ../../../winix/functions/specialdefault.h
init.o: ../../../winix/functions/stat.h ../../../winix/functions/subject.h
init.o: ../../../winix/functions/template.h
init.o: ../../../winix/functions/tinymce.h ../../../winix/functions/uname.h
init.o: ../../../winix/functions/upload.h ../../../winix/functions/uptime.h
init.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
init.o: ../../../winix/core/htmlfilter.h ../../../winix/templates/templates.h
init.o: ../../../winix/templates/patterncacher.h
init.o: ../../../winix/templates/indexpatterns.h
init.o: ../../../winix/templates/patterns.h
init.o: ../../../winix/templates/changepatterns.h
init.o: ../../../winix/templates/htmltextstream.h
init.o: ../../../winix/core/sessionmanager.h templates.h
reply.o: ../../../winix/core/plugin.h pluginmsg.h ../../../winix/core/log.h
reply.o: ../../../winix/core/textstream.h
reply.o: ../../../winix/core/logmanipulators.h
reply.o: ../../../pikotools/textstream/textstream.h
reply.o: ../../../pikotools/space/space.h
reply.o: ../../../pikotools/textstream/types.h ../../../pikotools/date/date.h
reply.o: ../../../pikotools/convert/convert.h
reply.o: ../../../pikotools/convert/inttostr.h
reply.o: ../../../pikotools/membuffer/membuffer.h
reply.o: ../../../pikotools/textstream/types.h ../../../winix/core/slog.h
reply.o: ../../../winix/core/cur.h ../../../winix/core/request.h
reply.o: ../../../winix/core/requesttypes.h ../../../winix/core/item.h
reply.o: ../../../winix/core/error.h ../../../winix/core/config.h
reply.o: ../../../pikotools/space/spaceparser.h
reply.o: ../../../pikotools/space/space.h ../../../winix/core/htmlfilter.h
reply.o: ../../../winix/templates/htmltextstream.h
reply.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
reply.o: ../../../pikotools/utf8/utf8.h ../../../winix/core/winix_const.h
reply.o: ../../../pikotools/space/spacetojson.h ../../../ezc/src/outstreams.h
reply.o: ../../../winix/core/session.h ../../../winix/core/user.h
reply.o: ../../../winix/core/plugindata.h ../../../winix/core/rebus.h
reply.o: ../../../winix/core/ipban.h ../../../winix/core/mount.h
reply.o: ../../../winix/templates/locale.h ../../../winix/core/system.h
reply.o: ../../../winix/core/sessionmanager.h
reply.o: ../../../winix/core/sessioncontainer.h
reply.o: ../../../winix/core/ipbancontainer.h
reply.o: ../../../winix/core/lastcontainer.h ../../../winix/core/synchro.h
reply.o: ../../../winix/core/basethread.h
reply.o: ../../../winix/core/sessionidmanager.h ../../../tito/src/base64.h
reply.o: ../../../tito/src/aes.h ../../../winix/functions/functions.h
reply.o: ../../../winix/functions/functionbase.h
reply.o: ../../../winix/functions/functionparser.h ../../../winix/db/db.h
reply.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
reply.o: ../../../winix/db/dbtextstream.h ../../../winix/core/error.h
reply.o: ../../../winix/db/dbitemquery.h ../../../winix/core/item.h
reply.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
reply.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
reply.o: ../../../winix/core/ugcontainer.h ../../../winix/core/cur.h
reply.o: ../../../winix/core/system.h ../../../winix/core/job.h
reply.o: ../../../winix/core/dirs.h ../../../winix/core/dircontainer.h
reply.o: ../../../winix/notify/notify.h ../../../winix/notify/notifypool.h
reply.o: ../../../winix/templates/patterns.h
reply.o: ../../../winix/templates/locale.h
reply.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
reply.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
reply.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
reply.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
reply.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
reply.o: ../../../winix/notify/notifythread.h
reply.o: ../../../winix/core/basethread.h
reply.o: ../../../winix/notify/templatesnotify.h ../../../winix/core/config.h
reply.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
reply.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
reply.o: ../../../winix/core/crypt.h ../../../winix/core/run.h
reply.o: ../../../winix/core/users.h ../../../winix/core/groups.h
reply.o: ../../../winix/core/group.h ../../../winix/core/loadavg.h
reply.o: ../../../winix/core/image.h ../../../winix/core/threadmanager.h
reply.o: ../../../winix/core/timezones.h ../../../winix/core/timezone.h
reply.o: ../../../winix/functions/account.h
reply.o: ../../../winix/functions/adduser.h ../../../winix/functions/cat.h
reply.o: ../../../winix/functions/chmod.h
reply.o: ../../../winix/functions/privchanger.h ../../../winix/core/request.h
reply.o: ../../../winix/functions/chown.h ../../../winix/functions/ckeditor.h
reply.o: ../../../winix/functions/cp.h ../../../winix/functions/default.h
reply.o: ../../../winix/functions/download.h ../../../winix/functions/emacs.h
reply.o: ../../../winix/functions/env.h ../../../winix/functions/imgcrop.h
reply.o: ../../../winix/functions/last.h ../../../winix/functions/login.h
reply.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
reply.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
reply.o: ../../../winix/functions/meta.h ../../../winix/functions/mkdir.h
reply.o: ../../../winix/functions/mv.h ../../../winix/functions/nicedit.h
reply.o: ../../../winix/functions/node.h ../../../winix/functions/passwd.h
reply.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
reply.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
reply.o: ../../../winix/functions/rmuser.h ../../../winix/functions/sort.h
reply.o: ../../../winix/functions/specialdefault.h
reply.o: ../../../winix/functions/stat.h ../../../winix/functions/subject.h
reply.o: ../../../winix/functions/template.h
reply.o: ../../../winix/functions/tinymce.h ../../../winix/functions/uname.h
reply.o: ../../../winix/functions/upload.h ../../../winix/functions/uptime.h
reply.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
reply.o: ../../../winix/core/htmlfilter.h
reply.o: ../../../winix/templates/templates.h
reply.o: ../../../winix/templates/patterncacher.h
reply.o: ../../../winix/templates/indexpatterns.h
reply.o: ../../../winix/templates/patterns.h
reply.o: ../../../winix/templates/changepatterns.h
reply.o: ../../../winix/templates/htmltextstream.h
reply.o: ../../../winix/core/sessionmanager.h reply.h
reply.o: ../../../winix/functions/functionbase.h
reply.o: ../../../winix/core/synchro.h tdb.h thread.h
reply.o: ../../../winix/db/dbbase.h threadinfo.h ../../../winix/core/misc.h
showthreads.o: showthreads.h ../../../winix/functions/functionbase.h
showthreads.o: ../../../winix/core/item.h ../../../pikotools/space/space.h
showthreads.o: ../../../pikotools/textstream/types.h
showthreads.o: ../../../pikotools/date/date.h ../../../winix/db/db.h
showthreads.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
showthreads.o: ../../../winix/db/dbtextstream.h
showthreads.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
showthreads.o: ../../../winix/core/item.h ../../../winix/core/requesttypes.h
showthreads.o: ../../../pikotools/textstream/textstream.h
showthreads.o: ../../../pikotools/convert/convert.h
showthreads.o: ../../../pikotools/convert/inttostr.h
showthreads.o: ../../../pikotools/membuffer/membuffer.h
showthreads.o: ../../../pikotools/textstream/types.h
showthreads.o: ../../../pikotools/utf8/utf8.h
showthreads.o: ../../../winix/core/winix_const.h ../../../winix/core/error.h
showthreads.o: ../../../pikotools/space/spaceparser.h
showthreads.o: ../../../pikotools/space/space.h
showthreads.o: ../../../winix/db/dbitemquery.h
showthreads.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
showthreads.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
showthreads.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
showthreads.o: ../../../winix/core/textstream.h
showthreads.o: ../../../winix/core/logmanipulators.h
showthreads.o: ../../../winix/core/slog.h ../../../winix/core/cur.h
showthreads.o: ../../../winix/core/request.h ../../../winix/core/error.h
showthreads.o: ../../../winix/core/config.h ../../../winix/core/htmlfilter.h
showthreads.o: ../../../winix/templates/htmltextstream.h
showthreads.o: ../../../pikotools/space/spacetojson.h
showthreads.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
showthreads.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
showthreads.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
showthreads.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
showthreads.o: ../../../winix/core/request.h ../../../winix/core/config.h
showthreads.o: ../../../winix/core/system.h ../../../winix/core/job.h
showthreads.o: ../../../winix/core/basethread.h ../../../winix/core/synchro.h
showthreads.o: ../../../winix/core/dirs.h ../../../winix/core/dircontainer.h
showthreads.o: ../../../winix/notify/notify.h
showthreads.o: ../../../winix/notify/notifypool.h
showthreads.o: ../../../winix/templates/patterns.h
showthreads.o: ../../../winix/templates/locale.h
showthreads.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
showthreads.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
showthreads.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
showthreads.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
showthreads.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
showthreads.o: ../../../winix/notify/notifythread.h
showthreads.o: ../../../winix/core/basethread.h
showthreads.o: ../../../winix/notify/templatesnotify.h
showthreads.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
showthreads.o: ../../../winix/core/lastcontainer.h
showthreads.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
showthreads.o: ../../../winix/core/crypt.h ../../../winix/core/run.h
showthreads.o: ../../../winix/core/users.h ../../../winix/core/groups.h
showthreads.o: ../../../winix/core/group.h ../../../winix/core/loadavg.h
showthreads.o: ../../../winix/core/image.h
showthreads.o: ../../../winix/core/threadmanager.h
showthreads.o: ../../../winix/core/timezones.h ../../../winix/core/timezone.h
showthreads.o: ../../../winix/core/synchro.h tdb.h thread.h
showthreads.o: ../../../winix/db/dbbase.h threadinfo.h
tdb.o: tdb.h thread.h ../../../pikotools/date/date.h
tdb.o: ../../../winix/db/dbbase.h ../../../winix/core/error.h
tdb.o: ../../../winix/core/log.h
templates.o: threadinfo.h ../../../winix/core/item.h
templates.o: ../../../pikotools/space/space.h
templates.o: ../../../pikotools/textstream/types.h
templates.o: ../../../pikotools/date/date.h ../../../winix/core/system.h
templates.o: ../../../winix/core/job.h ../../../winix/core/basethread.h
templates.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
templates.o: ../../../winix/core/item.h ../../../winix/core/dircontainer.h
templates.o: ../../../winix/db/db.h ../../../winix/db/dbbase.h
templates.o: ../../../winix/db/dbconn.h ../../../winix/db/dbtextstream.h
templates.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
templates.o: ../../../winix/core/requesttypes.h
templates.o: ../../../pikotools/textstream/textstream.h
templates.o: ../../../pikotools/convert/convert.h
templates.o: ../../../pikotools/convert/inttostr.h
templates.o: ../../../pikotools/membuffer/membuffer.h
templates.o: ../../../pikotools/textstream/types.h
templates.o: ../../../pikotools/utf8/utf8.h ../../../winix/core/winix_const.h
templates.o: ../../../winix/core/error.h
templates.o: ../../../pikotools/space/spaceparser.h
templates.o: ../../../pikotools/space/space.h ../../../winix/db/dbitemquery.h
templates.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
templates.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
templates.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
templates.o: ../../../winix/core/textstream.h
templates.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
templates.o: ../../../winix/core/cur.h ../../../winix/core/request.h
templates.o: ../../../winix/core/error.h ../../../winix/core/config.h
templates.o: ../../../winix/core/htmlfilter.h
templates.o: ../../../winix/templates/htmltextstream.h
templates.o: ../../../pikotools/space/spacetojson.h
templates.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
templates.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
templates.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
templates.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
templates.o: ../../../winix/notify/notify.h
templates.o: ../../../winix/notify/notifypool.h
templates.o: ../../../winix/templates/patterns.h
templates.o: ../../../winix/templates/locale.h
templates.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
templates.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
templates.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
templates.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
templates.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
templates.o: ../../../winix/notify/notifythread.h
templates.o: ../../../winix/core/basethread.h
templates.o: ../../../winix/notify/templatesnotify.h
templates.o: ../../../winix/core/config.h ../../../winix/core/users.h
templates.o: ../../../winix/core/ugcontainer.h
templates.o: ../../../winix/core/lastcontainer.h ../../../winix/core/mounts.h
templates.o: ../../../winix/core/mountparser.h ../../../winix/core/crypt.h
templates.o: ../../../winix/core/run.h ../../../winix/core/users.h
templates.o: ../../../winix/core/groups.h ../../../winix/core/group.h
templates.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
templates.o: ../../../winix/core/threadmanager.h
templates.o: ../../../winix/core/timezones.h ../../../winix/core/timezone.h
templates.o: thread.h tdb.h ../../../winix/db/dbbase.h reply.h
templates.o: ../../../winix/functions/functionbase.h
templates.o: ../../../winix/core/request.h ../../../winix/core/synchro.h
templates.o: funthread.h createthread.h showthreads.h
templates.o: ../../../winix/core/misc.h ../../../winix/core/plugin.h
templates.o: pluginmsg.h ../../../winix/core/system.h
templates.o: ../../../winix/core/sessionmanager.h
templates.o: ../../../winix/core/sessioncontainer.h
templates.o: ../../../winix/core/ipbancontainer.h
templates.o: ../../../winix/core/sessionidmanager.h
templates.o: ../../../tito/src/base64.h ../../../tito/src/aes.h
templates.o: ../../../winix/functions/functions.h
templates.o: ../../../winix/functions/functionbase.h
templates.o: ../../../winix/functions/functionparser.h
templates.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
templates.o: ../../../winix/functions/adduser.h
templates.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
templates.o: ../../../winix/functions/privchanger.h
templates.o: ../../../winix/functions/chown.h
templates.o: ../../../winix/functions/ckeditor.h
templates.o: ../../../winix/functions/cp.h ../../../winix/functions/default.h
templates.o: ../../../winix/functions/download.h
templates.o: ../../../winix/functions/emacs.h ../../../winix/functions/env.h
templates.o: ../../../winix/functions/imgcrop.h
templates.o: ../../../winix/functions/last.h ../../../winix/functions/login.h
templates.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
templates.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
templates.o: ../../../winix/functions/meta.h ../../../winix/functions/mkdir.h
templates.o: ../../../winix/functions/mv.h ../../../winix/functions/nicedit.h
templates.o: ../../../winix/functions/node.h
templates.o: ../../../winix/functions/passwd.h
templates.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
templates.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
templates.o: ../../../winix/functions/rmuser.h
templates.o: ../../../winix/functions/sort.h
templates.o: ../../../winix/functions/specialdefault.h
templates.o: ../../../winix/functions/stat.h
templates.o: ../../../winix/functions/subject.h
templates.o: ../../../winix/functions/template.h
templates.o: ../../../winix/functions/tinymce.h
templates.o: ../../../winix/functions/uname.h
templates.o: ../../../winix/functions/upload.h
templates.o: ../../../winix/functions/uptime.h ../../../winix/functions/who.h
templates.o: ../../../winix/functions/vim.h ../../../winix/core/htmlfilter.h
templates.o: ../../../winix/templates/templates.h
templates.o: ../../../winix/templates/patterncacher.h
templates.o: ../../../winix/templates/indexpatterns.h
templates.o: ../../../winix/templates/patterns.h
templates.o: ../../../winix/templates/changepatterns.h
templates.o: ../../../winix/templates/htmltextstream.h
templates.o: ../../../winix/core/sessionmanager.h
threadinfo.o: threadinfo.h ../../../winix/core/item.h
threadinfo.o: ../../../pikotools/space/space.h
threadinfo.o: ../../../pikotools/textstream/types.h
threadinfo.o: ../../../pikotools/date/date.h ../../../winix/core/system.h
threadinfo.o: ../../../winix/core/job.h ../../../winix/core/basethread.h
threadinfo.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
threadinfo.o: ../../../winix/core/item.h ../../../winix/core/dircontainer.h
threadinfo.o: ../../../winix/db/db.h ../../../winix/db/dbbase.h
threadinfo.o: ../../../winix/db/dbconn.h ../../../winix/db/dbtextstream.h
threadinfo.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
threadinfo.o: ../../../winix/core/requesttypes.h
threadinfo.o: ../../../pikotools/textstream/textstream.h
threadinfo.o: ../../../pikotools/convert/convert.h
threadinfo.o: ../../../pikotools/convert/inttostr.h
threadinfo.o: ../../../pikotools/membuffer/membuffer.h
threadinfo.o: ../../../pikotools/textstream/types.h
threadinfo.o: ../../../pikotools/utf8/utf8.h
threadinfo.o: ../../../winix/core/winix_const.h ../../../winix/core/error.h
threadinfo.o: ../../../pikotools/space/spaceparser.h
threadinfo.o: ../../../pikotools/space/space.h
threadinfo.o: ../../../winix/db/dbitemquery.h
threadinfo.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
threadinfo.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
threadinfo.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
threadinfo.o: ../../../winix/core/textstream.h
threadinfo.o: ../../../winix/core/logmanipulators.h
threadinfo.o: ../../../winix/core/slog.h ../../../winix/core/cur.h
threadinfo.o: ../../../winix/core/request.h ../../../winix/core/error.h
threadinfo.o: ../../../winix/core/config.h ../../../winix/core/htmlfilter.h
threadinfo.o: ../../../winix/templates/htmltextstream.h
threadinfo.o: ../../../pikotools/space/spacetojson.h
threadinfo.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
threadinfo.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
threadinfo.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
threadinfo.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
threadinfo.o: ../../../winix/notify/notify.h
threadinfo.o: ../../../winix/notify/notifypool.h
threadinfo.o: ../../../winix/templates/patterns.h
threadinfo.o: ../../../winix/templates/locale.h
threadinfo.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
threadinfo.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
threadinfo.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
threadinfo.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
threadinfo.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
threadinfo.o: ../../../winix/notify/notifythread.h
threadinfo.o: ../../../winix/core/basethread.h
threadinfo.o: ../../../winix/notify/templatesnotify.h
threadinfo.o: ../../../winix/core/config.h ../../../winix/core/users.h
threadinfo.o: ../../../winix/core/ugcontainer.h
threadinfo.o: ../../../winix/core/lastcontainer.h
threadinfo.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
threadinfo.o: ../../../winix/core/crypt.h ../../../winix/core/run.h
threadinfo.o: ../../../winix/core/users.h ../../../winix/core/groups.h
threadinfo.o: ../../../winix/core/group.h ../../../winix/core/loadavg.h
threadinfo.o: ../../../winix/core/image.h ../../../winix/core/threadmanager.h
threadinfo.o: ../../../winix/core/timezones.h ../../../winix/core/timezone.h
threadinfo.o: thread.h tdb.h ../../../winix/db/dbbase.h
threadinfo.o: ../../../winix/core/plugin.h pluginmsg.h
threadinfo.o: ../../../winix/core/system.h
threadinfo.o: ../../../winix/core/sessionmanager.h
threadinfo.o: ../../../winix/core/sessioncontainer.h
threadinfo.o: ../../../winix/core/ipbancontainer.h
threadinfo.o: ../../../winix/core/sessionidmanager.h
threadinfo.o: ../../../tito/src/base64.h ../../../tito/src/aes.h
threadinfo.o: ../../../winix/functions/functions.h
threadinfo.o: ../../../winix/functions/functionbase.h
threadinfo.o: ../../../winix/functions/functionparser.h
threadinfo.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
threadinfo.o: ../../../winix/functions/adduser.h
threadinfo.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
threadinfo.o: ../../../winix/functions/privchanger.h
threadinfo.o: ../../../winix/core/request.h ../../../winix/functions/chown.h
threadinfo.o: ../../../winix/functions/ckeditor.h
threadinfo.o: ../../../winix/functions/cp.h
threadinfo.o: ../../../winix/functions/default.h
threadinfo.o: ../../../winix/functions/download.h
threadinfo.o: ../../../winix/functions/emacs.h ../../../winix/functions/env.h
threadinfo.o: ../../../winix/functions/imgcrop.h
threadinfo.o: ../../../winix/functions/last.h
threadinfo.o: ../../../winix/functions/login.h
threadinfo.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
threadinfo.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
threadinfo.o: ../../../winix/functions/meta.h
threadinfo.o: ../../../winix/functions/mkdir.h ../../../winix/functions/mv.h
threadinfo.o: ../../../winix/functions/nicedit.h
threadinfo.o: ../../../winix/functions/node.h
threadinfo.o: ../../../winix/functions/passwd.h
threadinfo.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
threadinfo.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
threadinfo.o: ../../../winix/functions/rmuser.h
threadinfo.o: ../../../winix/functions/sort.h
threadinfo.o: ../../../winix/functions/specialdefault.h
threadinfo.o: ../../../winix/functions/stat.h
threadinfo.o: ../../../winix/functions/subject.h
threadinfo.o: ../../../winix/functions/template.h
threadinfo.o: ../../../winix/functions/tinymce.h
threadinfo.o: ../../../winix/functions/uname.h
threadinfo.o: ../../../winix/functions/upload.h
threadinfo.o: ../../../winix/functions/uptime.h
threadinfo.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
threadinfo.o: ../../../winix/core/htmlfilter.h
threadinfo.o: ../../../winix/templates/templates.h
threadinfo.o: ../../../winix/templates/patterncacher.h
threadinfo.o: ../../../winix/templates/indexpatterns.h
threadinfo.o: ../../../winix/templates/patterns.h
threadinfo.o: ../../../winix/templates/changepatterns.h
threadinfo.o: ../../../winix/templates/htmltextstream.h
threadinfo.o: ../../../winix/core/sessionmanager.h

View File

@@ -0,0 +1 @@
o = createthread.o funthread.o init.o reply.o showthreads.o tdb.o templates.o threadinfo.o

View File

@@ -0,0 +1,140 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, 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.
*
*/
#include "createthread.h"
#include "functions.h"
#include "functions/functions.h"
namespace Winix
{
namespace Thread
{
CreateThread::CreateThread()
{
fun.url = L"createthread";
}
void CreateThread::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void CreateThread::SetThreadInfo(ThreadInfo * pthread_info)
{
thread_info = pthread_info;
}
// returning true if we can create a thread in the current directory
bool CreateThread::HasAccess()
{
if( cur->request->is_item || !system->HasWriteAccess(*cur->request->dir_tab.back()) )
return false;
if( system->mounts.pmount->type != thread_info->mount_type_thread )
return false;
return true;
}
void CreateThread::SendNotify(const Item & item)
{
// sending notification
notify_msg.code = WINIX_NOTIFY_CODE_ADD;
notify_msg.template_index = thread_info->template_index;
notify_msg.dir_link = config->url_proto;
notify_msg.dir_link += config->base_url;// !! IMPROVE ME what about subdomains?
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
notify_msg.item_link = notify_msg.dir_link;
notify_msg.item_link += item.url;
system->notify.ItemChanged(notify_msg);
}
void CreateThread::MakePost()
{
cur->request->item.Clear();
functions->ReadItem(cur->request->item, Item::file);
functions->SetUser(cur->request->item);
functions->PrepareUrl(cur->request->item);
cur->request->item.parent_id = cur->request->dir_tab.back()->id;
cur->request->item.privileges = system->NewFilePrivileges();
if( functions->CheckAbuse() )
return;
cur->request->status = system->AddFile(cur->request->item);
if( cur->request->status == WINIX_ERR_OK )
{
thread.Clear();
thread.file_id = cur->request->item.id;
cur->request->status = tdb->AddThread(thread);
}
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "CreateThread: added a new thread" << logend;
thread_info->MakeRedirectIfPossible(cur->request->item);
SendNotify(cur->request->item);
}
else
{
log << log1 << "CreateThread: problem with adding a new thread, error code: "
<< cur->request->status << logend;
}
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,76 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_createthread
#define headerfile_winix_plugins_thread_createthread
#include "functions/functionbase.h"
#include "tdb.h"
#include "threadinfo.h"
#include "notify/notify.h"
namespace Winix
{
namespace Thread
{
class CreateThread : public FunctionBase
{
public:
CreateThread();
bool HasAccess();
void MakePost();
void SetTDb(TDb * ptdb);
void SetThreadInfo(ThreadInfo * pthread_info);
private:
TDb * tdb;
ThreadInfo * thread_info;
Thread thread;
NotifyMsg notify_msg;
void SendNotify(const Item & item);
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,118 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, 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.
*
*/
#include <algorithm>
#include "core/misc.h"
#include "funthread.h"
namespace Winix
{
namespace Thread
{
FunThread::FunThread()
{
fun.url = L"thread";
}
void FunThread::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void FunThread::SetThreadInfo(ThreadInfo * pthread_info)
{
thread_info = pthread_info;
}
bool FunThread::HasAccess()
{
if( !cur->request->is_item )
return false;
if( system->mounts.pmount->type != thread_info->mount_type_thread )
return false;
return true;
}
void FunThread::PrepareThread(long file_id)
{
thread_info->Clear();
cur->request->status = tdb->GetAnswers(file_id, id_tab);
if( !id_tab.empty() )
{
DbItemQuery iq;
if( system->mounts.pmount->IsArg(thread_info->mount_par_thread, L"sort_desc") )
iq.sort_date_asc = false; // sort_index_asc we are ignoring
iq.WhereIdIn(id_tab);
iq.WhereType(Item::file);
iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
db->GetItems(thread_info->item_tab, iq);
system->CheckAccessToItems(thread_info->item_tab);
thread_info->item_sort_tab.resize(thread_info->item_tab.size());
// thread_info.item_tab is already sorted (by the database)
for(size_t i=0 ; i<thread_info->item_tab.size() ; ++i)
thread_info->item_sort_tab[i] = &thread_info->item_tab[i];
}
}
void FunThread::MakeGet()
{
PrepareThread(cur->request->item.id);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,75 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_funthread
#define headerfile_winix_plugins_thread_funthread
#include "functions/functionbase.h"
#include "tdb.h"
#include "threadinfo.h"
namespace Winix
{
namespace Thread
{
class FunThread : public FunctionBase
{
public:
FunThread();
bool HasAccess();
void MakeGet();
void PrepareThread(long file_id);
void SetTDb(TDb * ptdb);
void SetThreadInfo(ThreadInfo * pthread_info);
private:
TDb * tdb;
ThreadInfo * thread_info;
std::vector<long> id_tab;
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,232 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include "tdb.h"
#include "reply.h"
#include "funthread.h"
#include "createthread.h"
#include "showthreads.h"
#include "core/log.h"
#include "core/plugin.h"
#include "pluginmsg.h"
#include "templates.h"
namespace Winix
{
extern "C" void Init(PluginInfo &);
namespace Thread
{
const wchar_t plugin_name[] = L"thread";
TDb tdb;
ThreadInfo thread_info;
Reply fun_reply;
FunThread fun_thread;
CreateThread fun_create_thread;
ShowThreads fun_show_threads;
void AddFunctions(PluginInfo & info)
{
info.functions->Add(fun_reply);
info.functions->Add(fun_thread);
info.functions->Add(fun_create_thread);
info.functions->Add(fun_show_threads);
}
void SelectDefaultFunction(PluginInfo & info)
{
if( info.system->mounts.pmount->type == thread_info.mount_type_thread )
{
if( info.cur->request->is_item )
info.cur->request->function = &fun_thread;
else
info.cur->request->function = &fun_show_threads;
}
}
void AddMounts(PluginInfo & info)
{
Mounts & m = info.system->mounts;
thread_info.mount_type_thread = m.AddMountType(L"thread");
thread_info.mount_par_thread = m.AddMountPar(L"thread");
thread_info.mount_par_thread_dir = m.AddMountPar(L"thread_dir");
}
void RemoveThread(PluginInfo & info)
{
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
{
thread_info.RemoveThread(item->id);
thread_info.RemoveThreadAnswer(item->id);
}
}
void AddNotifyTemplate(PluginInfo & info)
{
thread_info.template_index = info.system->notify.AddTemplate(L"notify_email_thread.txt");
}
void SetSortTab(PluginInfo & info)
{
if( !info.p1 )
{
log << log1 << "Thread: sort_tab pointer is not set" << logend;
return;
}
typedef std::vector<Item*> SortTab;
SortTab * psort_tab = reinterpret_cast<SortTab*>(info.p1);
// !! IMPROVE ME
// !! dodac jakies czyszczenie tej tablicy wskaznikow na koncu przetwarzania requestu
// aby kiedys przypadkowo nie odwolac sie do nie istniejacego obiektu
// poprzez bezposrednie uzycie jakiejs funkcji z ezc
thread_info.item_sort_tab = *psort_tab;
}
void ReadThreads(PluginInfo & info)
{
fun_show_threads.ReadThreads();
}
void SetSortTabIndex(PluginInfo & info)
{
thread_sort_tab(info.l1);
}
void PrepareThread(PluginInfo & info)
{
fun_thread.PrepareThread(info.l1);
}
void EndRequest(PluginInfo & info)
{
thread_info.Clear();
}
// !! temporarily
void Rescan(PluginInfo & info)
{
if( info.config->Bool(L"thread_rescan", false) == true )
{
log << log1 << "---------- rescanning thread db ------------- " << logend;
thread_info.Repair();
log << log1 << "---------- thread db rescanning is finished ------------- " << logend;
}
}
} // namespace
void Init(PluginInfo & info)
{
using namespace Thread;
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
plugin.Assign(WINIX_ADD_MOUNTS, AddMounts);
plugin.Assign(WINIX_FILE_REMOVED, RemoveThread);
plugin.Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_END_REQUEST, EndRequest);
// for other plugins
plugin.Assign(WINIX_PL_THREAD_SET_SORTTAB, SetSortTab);
plugin.Assign(WINIX_PL_THREAD_READ_THREADS, ReadThreads);
plugin.Assign(WINIX_PL_THREAD_SET_SORTTAB_INDEX, SetSortTabIndex);
plugin.Assign(WINIX_PL_THREAD_PREPARE_THREAD, PrepareThread);
// temporarily
plugin.Assign(WINIX_PLUGIN_INIT, Rescan);
tdb.SetConn(info.db->GetConn());
tdb.LogQueries(info.config->log_db_query);
// thread_info and fun_show_threads are used in 'ticket' plugins too
thread_info.SetDb(info.db);
thread_info.SetTDb(&tdb);
thread_info.SetSystem(info.system);
thread_info.plugin_id = info.plugin_id;
fun_reply.SetTDb(&tdb);
fun_reply.SetThreadInfo(&thread_info);
fun_thread.SetTDb(&tdb);
fun_thread.SetThreadInfo(&thread_info);
fun_create_thread.SetTDb(&tdb);
fun_create_thread.SetThreadInfo(&thread_info);
fun_show_threads.SetTDb(&tdb);
fun_show_threads.SetThreadInfo(&thread_info);
info.p1 = (void*)(plugin_name);
}
} // namespace Winix

View File

@@ -0,0 +1,67 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_pluginmsg
#define headerfile_winix_plugins_thread_pluginmsg
namespace Winix
{
// values from 4000 - 4099 reserved for 'thread' plugin
#define WINIX_PL_THREAD_SET_SORTTAB 4000
#define WINIX_PL_THREAD_READ_THREADS 4001
#define WINIX_PL_THREAD_SET_SORTTAB_INDEX 4002
#define WINIX_PL_THREAD_PREPARE_THREAD 4003
#define WINIX_PL_THREAD_SEARCH_THREAD_DIR 4004
#define WINIX_PL_THREAD_CAN_MAKE_REDIRECT 4005
// a new answer is going to add in a thread
// in p1 you have a pointer to the new Item struct
// cur->request->item is the 'main' thread file
#define WINIX_PL_THREAD_PREPARE_TO_REPLY_IN_THREAD 4006
} // namespace Winix
#endif

View File

@@ -0,0 +1,165 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include "core/plugin.h"
#include "reply.h"
#include "functions/functions.h"
#include "core/misc.h"
#include "core/plugin.h"
#include "pluginmsg.h"
namespace Winix
{
namespace Thread
{
Reply::Reply()
{
fun.url = L"reply";
files_dir = 0;
}
void Reply::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void Reply::SetThreadInfo(ThreadInfo * pthread_info)
{
thread_info = pthread_info;
}
/*
we can use 'reply' function everywhere where 'thread_dir' mount option is defined
if there is no such a thread in 'thread' table it will be added automatically
*/
bool Reply::HasAccess()
{
if( !cur->request->is_item )
return false;
files_dir = thread_info->FindThreadDir();
if( !files_dir || !system->HasWriteAccess(*files_dir) )
return false;
PT::Space * thread_space = cur->request->item.ameta.FindSpace(L"thread");
if( thread_space )
{
if( thread_space->Bool(L"closed", false) )
return false;
}
return true;
}
void Reply::SendNotify(const Item & item)
{
// sending notification
notify_msg.code = WINIX_NOTIFY_CODE_REPLY;
notify_msg.template_index = thread_info->template_index;
notify_msg.dir_link = config->url_proto;
notify_msg.dir_link += config->base_url;// !! IMPROVE ME what about subdomains?
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
notify_msg.item_link = notify_msg.dir_link;
notify_msg.item_link += item.url;
system->notify.ItemChanged(notify_msg);
}
void Reply::MakePost()
{
// !! jak bedzie dostepne assert
// ASSERT(files_dir)
if( tdb->GetThread(cur->request->item.id, thread) != WINIX_ERR_OK )
{
thread.Clear();
thread.file_id = cur->request->item.id;
tdb->AddThread(thread);
}
answer.Clear();
answer.url = cur->request->item.url;
answer.url += L"_msg_";
answer.url += Toa(thread.replies + 1);
answer.subject = answer.url;
functions->ReadItem(answer, Item::file);
functions->SetUser(answer);
functions->PrepareUrl(answer);
answer.parent_id = files_dir->id;
answer.privileges = system->NewFilePrivileges();
if( functions->CheckAbuse() )
return;
plugin.Call(WINIX_PL_THREAD_PREPARE_TO_REPLY_IN_THREAD, &answer);
cur->request->status = system->AddFile(answer);
if( cur->request->status == WINIX_ERR_OK )
cur->request->status = tdb->AddAnswer(cur->request->item.id, answer.id);
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "Reply: added an answer in a thread" << logend;
thread_info->MakeRedirectIfPossible(cur->request->item);
SendNotify(cur->request->item);
}
else
{
log << log1 << "Reply: problem with adding an answer, error code: "
<< cur->request->status << logend;
}
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,80 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_reply
#define headerfile_winix_plugins_thread_reply
#include "functions/functionbase.h"
#include "tdb.h"
#include "threadinfo.h"
#include "notify/notify.h"
namespace Winix
{
namespace Thread
{
class Reply : public FunctionBase
{
public:
Reply();
bool HasAccess();
void MakePost();
void SetTDb(TDb * ptdb);
void SetThreadInfo(ThreadInfo * pthread_info);
private:
TDb * tdb;
ThreadInfo * thread_info;
Item answer;
Thread thread;
Item * files_dir;
NotifyMsg notify_msg;
void SendNotify(const Item & item);
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,175 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include <algorithm>
#include "showthreads.h"
#include "functions.h"
namespace Winix
{
namespace Thread
{
ShowThreads::ShowThreads()
{
fun.url = L"showthreads";
}
void ShowThreads::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void ShowThreads::SetThreadInfo(ThreadInfo * pthread_info)
{
thread_info = pthread_info;
}
bool ShowThreads::HasAccess()
{
if( cur->request->is_item )
return false;
if( system->mounts.pmount->type != thread_info->mount_type_thread )
return false;
return true;
}
bool ShowThreads::Sort::operator()(const Item * item1, const Item * item2)
{
if( sort_type == 0 )
{
// sorting by url
return item1->url < item2->url;
}
else
{
// sorting by date
return item1->date_creation > item2->date_creation;
}
}
void ShowThreads::ReadFiles()
{
// reading files
DbItemQuery iq;
iq.SetAll(false, false);
iq.sel_url = true;
iq.sel_subject = true;
iq.sel_date = true;
iq.sel_user_id = true;
iq.sel_group_id = true;
iq.sel_guest_name = true;
iq.sel_privileges = true;
iq.sel_date = true;
iq.WhereParentId(cur->request->dir_tab.back()->id);
iq.WhereType(Item::file);
iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
db->GetItems(thread_info->item_tab, iq);
system->CheckAccessToItems(thread_info->item_tab);
}
void ShowThreads::CreatePointers()
{
// creating a pointers table
thread_info->item_sort_tab.resize(thread_info->item_tab.size());
for(size_t i=0 ; i<thread_info->item_tab.size() ; ++i)
thread_info->item_sort_tab[i] = &thread_info->item_tab[i];
}
void ShowThreads::SortPointers()
{
int sort_type = 1;
if( cur->request->ParamValue(L"sort") == L"url" )
sort_type = 0;
std::vector<Item*> & table = thread_info->item_sort_tab;
std::sort(table.begin(), table.end(), Sort(this, sort_type));
}
void ShowThreads::ReadThreads()
{
// reading threads for the files
file_id_tab.resize(thread_info->item_sort_tab.size());
for(size_t i=0 ; i<thread_info->item_sort_tab.size() ; ++i)
file_id_tab[i] = thread_info->item_sort_tab[i]->id;
tdb->GetThreads(file_id_tab, thread_info->thread_tab);
}
void ShowThreads::MakeGet()
{
thread_info->Clear();
ReadFiles();
CreatePointers();
SortPointers();
ReadThreads();
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,92 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_showthreads
#define headerfile_winix_plugins_thread_showthreads
#include "functions/functionbase.h"
#include "tdb.h"
#include "threadinfo.h"
namespace Winix
{
namespace Thread
{
class ShowThreads : public FunctionBase
{
public:
ShowThreads();
bool HasAccess();
void MakeGet();
void SetTDb(TDb * ptdb);
void SetThreadInfo(ThreadInfo * pthread_info);
void ReadThreads();
private:
TDb * tdb;
ThreadInfo * thread_info;
std::vector<long> file_id_tab;
void ReadFiles();
void CreatePointers();
void SortPointers();
struct Sort
{
ShowThreads * show_threads;
int sort_type;
Sort(ShowThreads * show, int type) : show_threads(show), sort_type(type) {}
bool operator()(const Item * item1, const Item * item2);
};
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,502 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include "tdb.h"
#include "core/log.h"
namespace Winix
{
namespace Thread
{
Error TDb::AddThread(const Thread & thread)
{
query.Clear();
query << R("insert into plugins.thread (file_id, replies, last_item, closed) values (")
<< thread.file_id
<< thread.replies
<< thread.last_item_id
<< (thread.closed ? 1 : 0 )
<< R(");");
return DoCommand(query);
}
void TDb::SetThreadColumns(PGresult * r)
{
cfile_id = AssertColumn(r, "file_id");
creplies = AssertColumn(r, "replies");
cclosed = AssertColumn(r, "closed");
clast_item = AssertColumn(r, "last_item");
cdate_modification = AssertColumn(r, "date_modification");
cuser_id = AssertColumn(r, "user_id");
cguest = AssertColumn(r, "guest_name");
}
void TDb::SetThread(PGresult * r, int col, Thread & thread)
{
thread.file_id = AssertValueLong(r, col, cfile_id);
thread.replies = AssertValueLong(r, col, creplies);
thread.closed = AssertValueBool(r, col, cclosed);
thread.last_item_id = AssertValueLong(r, col, clast_item);
thread.last_item_date_modification = AssertValueDate(r, col, cdate_modification);
thread.last_item_user_id = AssertValueLong(r, col, cuser_id);
AssertValueWide(r, col, cguest, thread.last_item_guest_name);
}
Error TDb::GetThread(long file_id, Thread & thread)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
try
{
query.Clear();
query << R("select thread.file_id, thread.replies, thread.closed, thread.last_item, "
"item.date_modification, item.user_id, item.guest_name "
"from plugins.thread left join core.item on thread.last_item = item.id "
"where thread.file_id = ") << file_id << R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
int rows = Rows(r);
if( rows > 1 )
log << log1 << "ThreadDb: there is more than one thread with file_id: " << file_id << logend;
else
if( rows == 0 )
throw Error(WINIX_ERR_NO_THREAD);
SetThreadColumns(r);
SetThread(r, 0, thread);
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
Error TDb::GetThreads(const std::vector<long> & file_id_tab, std::vector<Thread> & thread_tab)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
thread_tab.clear();
if( file_id_tab.empty() )
return status;
try
{
CreateIdList(file_id_tab, list_id);
// they should be sorted by file_id (they are used in a binary search later)
query.Clear();
query << R("select thread.file_id, thread.replies, thread.closed, thread.last_item, "
"item.date_modification, item.user_id, item.guest_name "
"from plugins.thread left join core.item on thread.last_item = item.id "
"where thread.file_id in ") << R(list_id) << R(" order by file_id asc;");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
int rows = Rows(r);
SetThreadColumns(r);
for(int i=0 ; i<rows ; ++i)
{
SetThread(r, i, thread_temp);
thread_tab.push_back(thread_temp);
}
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
Error TDb::GetAnswers(long file_id, std::vector<long> & answer_id_tab)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
answer_id_tab.clear();
try
{
query.Clear();
query << R("select answer_id from plugins.thread_files "
"where file_id = ") << file_id << R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
int rows = Rows(r);
answer_id_tab.resize(rows);
for(int i=0 ; i<rows ; ++i)
answer_id_tab[i] = AssertValueLong(r, i, 0);
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
Error TDb::AddAnswer(long file_id, long answer_id)
{
query.Clear();
query << R("insert into plugins.thread_files (file_id, answer_id) values (")
<< file_id
<< answer_id
<< R(");");
Error status = DoCommand(query);
if( status != WINIX_ERR_OK )
return status;
query.Clear();
query << R("update plugins.thread set (last_item, replies) = (")
<< answer_id
<< R(", replies+1) where file_id=")
<< file_id
<< R(";");
return DoCommand(query);
}
long TDb::FindLastAnswer(long file_id)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
long last_item_id = -1;
try
{
query.Clear();
query << R("select id from plugins.thread_files left join core.item on item.id=answer_id where file_id=")
<< file_id
<< R(" order by date_creation desc limit 1;");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
if( Rows(r) == 1 )
last_item_id = AssertValueLong(r, 0, 0);
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return last_item_id;
}
Error TDb::RemoveAnswer(long answer_id)
{
PGresult * r1 = 0;
PGresult * r2 = 0;
Error status = WINIX_ERR_OK;
try
{
// selecting files which have answer_id as an answer
query.Clear();
query << R("select file_id from plugins.thread_files where answer_id = ")
<< answer_id
<< R(";");
r1 = AssertQuery(query);
AssertResult(r1, PGRES_TUPLES_OK);
int rows = Rows(r1);
file_id_tab.resize(rows);
for(int i=0 ; i<rows ; ++i)
file_id_tab[i] = AssertValueLong(r1, i, 0);
// deleting those answers
query.Clear();
query << R("delete from plugins.thread_files where answer_id = ")
<< answer_id
<< R(";");
r2 = AssertQuery(query);
AssertResult(r2, PGRES_COMMAND_OK);
rows = AffectedRows(r2);
if( rows > 0 )
log << log2 << "ThreadDb: deleted " << rows << " rows from plugins.thread_files" << logend;
// setting new last_items to the files
status = RemoveAnswerRecalcLast(file_id_tab);
}
catch(const Error & e)
{
status = e;
}
ClearResult(r1);
ClearResult(r2);
return status;
}
Error TDb::RemoveAnswerRecalcLast(long file_id)
{
long last_item_id = FindLastAnswer(file_id);
query.Clear();
query << R("update plugins.thread set (replies, last_item) = (replies-1,")
<< last_item_id
<< R(") where file_id=")
<< file_id
<< R(";");
return DoCommand(query);
}
Error TDb::RemoveAnswerRecalcLast(const std::vector<long> & file_id_tab)
{
for(size_t i=0 ; i<file_id_tab.size() ; ++i)
{
long file_id = file_id_tab[i];
Error status = RemoveAnswerRecalcLast(file_id);
if( status != WINIX_ERR_OK )
return status;
}
return WINIX_ERR_OK;
}
Error TDb::RecalcThread(long file_id)
{
long replies = CalcAnswers(file_id);
long last_item = FindLastAnswer(file_id);
query.Clear();
query << R("update plugins.thread set (replies, last_item) = (")
<< replies
<< last_item
<< R(") where file_id=")
<< file_id
<< R(";");
return DoCommand(query);
}
long TDb::CalcAnswers(long file_id)
{
PGresult * r = 0;
long answers = 0;
try
{
query.Clear();
query << R("select count(file_id) from plugins.thread_files where file_id=") << file_id << R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
if( Rows(r) == 1 )
answers = AssertValueLong(r, 0, 0);
}
catch(const Error &)
{
}
ClearResult(r);
return answers;
}
Error TDb::RemoveThread(long file_id)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
try
{
query.Clear();
query << R("delete from plugins.thread where file_id=") << file_id << R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_COMMAND_OK);
long rows = AffectedRows(r);
if( rows > 0 )
log << log2 << "ThreadDb: deleted " << rows << " rows from plugins.thread" << logend;
ClearResult(r);
query.Clear();
query << R("delete from plugins.thread_files where file_id=") << file_id << R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_COMMAND_OK);
rows = AffectedRows(r);
if( rows > 0 )
log << log2 << "ThreadDb: deleted " << rows << " rows from plugins.thread_files" << logend;
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
Error TDb::RemoveAnswerOnly(long answer_id)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
try
{
query.Clear();
query << R("delete from plugins.thread_files where answer_id=") << answer_id << R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_COMMAND_OK);
long rows = AffectedRows(r);
if( rows > 0 )
log << log2 << "ThreadDb: deleted " << rows << " rows from plugins.thread_files" << logend;
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
void TDb::GetAllThreadsId(std::vector<long> & file_id)
{
PGresult * r = 0;
file_id.clear();
try
{
query.Clear();
query << R("select file_id from plugins.thread;");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
int rows = Rows(r);
file_id.resize(rows);
for(int i=0 ; i<rows ; ++i)
file_id[i] = AssertValueLong(r, i, 0);
}
catch(const Error &)
{
}
ClearResult(r);
}
} // namespace
} // namespace Winix

114
winixd/plugins/thread/tdb.h Normal file
View File

@@ -0,0 +1,114 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_tdb
#define headerfile_winix_plugins_thread_tdb
#include <vector>
#include "thread.h"
#include "db/dbbase.h"
#include "core/error.h"
namespace Winix
{
namespace Thread
{
class TDb : public DbBase
{
public:
/*
high level interface
*/
Error AddThread(const Thread & thread);
Error GetThread(long file_id, Thread & thread);
Error GetThreads(const std::vector<long> & file_id_tab, std::vector<Thread> & thread_tab);
Error RemoveThread(long file_id);
Error AddAnswer(long file_id, long answer_id);
Error GetAnswers(long file_id, std::vector<long> & answer_id_tab);
Error RemoveAnswer(long answer_id);
/*
low level interface
*/
// looking for the last answer in a thread (in 'thread_files' table)
// this is not the value from 'thread' table
long FindLastAnswer(long file_id);
// returning all threads id (file_id) (from 'thread' table)
void GetAllThreadsId(std::vector<long> & file_id);
// removing only the answer in 'thread_files' table without updating 'thread' table
Error RemoveAnswerOnly(long answer_id);
// returning how many answers there are
// calculating from 'thread_files' table
// this is not the value from 'thread' table
long CalcAnswers(long file_id);
// recalculating last_item, replies in 'thread' table on a given thread
Error RecalcThread(long file_id);
private:
DbTextStream query;
std::wstring list_id;
int cfile_id, creplies, cclosed, clast_item, cdate_modification, cuser_id, cguest;
Thread thread_temp;
std::vector<long> file_id_tab;
void SetThreadColumns(PGresult * r);
void SetThread(PGresult * r, int col, Thread & thread);
Error RemoveAnswerRecalcLast(long file_id);
Error RemoveAnswerRecalcLast(const std::vector<long> & file_id_tab);
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,567 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, 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.
*
*/
#include "threadinfo.h"
#include "reply.h"
#include "funthread.h"
#include "createthread.h"
#include "showthreads.h"
#include "core/request.h"
#include "core/misc.h"
#include "core/plugin.h"
#include "templates/templates.h"
#include "functions/functions.h"
namespace Winix
{
namespace Thread
{
using namespace TemplatesFunctions;
using TemplatesFunctions::system;
extern ThreadInfo thread_info;
extern Reply fun_reply;
extern FunThread fun_thread;
extern CreateThread fun_create_thread;
extern ShowThreads fun_show_threads;
static size_t item_sort_index;
static HtmlTextStream item_run_content;
static EzcGen ezc_generator;
static bool has_thread;
static size_t thread_index;
// binary search for file_id in thread_tab (thread_tab must be sorted by id)
bool FindThread(const std::vector<Thread> & thread_tab, long file_id, size_t & thread_index)
{
if( thread_tab.empty() )
return false;
size_t o1 = 0;
size_t o2 = thread_tab.size() - 1;
if( thread_tab[o1].file_id == file_id )
{
thread_index = o1;
return true;
}
if( file_id < thread_tab[o1].file_id )
return false;
if( thread_tab[o2].file_id == file_id )
{
thread_index = o2;
return true;
}
if( file_id > thread_tab[o2].file_id )
return false;
while( o1 + 1 < o2 )
{
thread_index = (o1 + o2) / 2;
if( thread_tab[thread_index].file_id == file_id )
return true;
if( thread_tab[thread_index].file_id < file_id )
o1 = thread_index;
else
o2 = thread_index;
}
return false;
}
bool thread_sort_tab(size_t sort_index)
{
bool res;
item_sort_index = sort_index;
res = item_sort_index < thread_info.item_sort_tab.size();
has_thread = false;
if( res )
{
long file_id = thread_info.item_sort_tab[item_sort_index]->id;
has_thread = FindThread(thread_info.thread_tab, file_id, thread_index);
}
return res;
}
void thread_sort_tab(Info & i)
{
i.res = thread_sort_tab(i.iter);
}
void thread_sort_tab_id(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << thread_info.item_sort_tab[item_sort_index]->id;
}
void thread_sort_tab_subject(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << thread_info.item_sort_tab[item_sort_index]->subject;
}
void thread_sort_tab_subject_noescape(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << R(thread_info.item_sort_tab[item_sort_index]->subject);
}
void thread_sort_tab_content(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << thread_info.item_sort_tab[item_sort_index]->content;
}
void thread_sort_tab_content_noescape(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << R(thread_info.item_sort_tab[item_sort_index]->content);
}
void thread_sort_tab_print_content(Info & i)
{
if( item_sort_index >= thread_info.item_sort_tab.size() )
return;
std::wstring & content = thread_info.item_sort_tab[item_sort_index]->content;
Item::ContentType type = thread_info.item_sort_tab[item_sort_index]->content_type;
item_print_content(i.out, content, type);
}
void thread_sort_tab_privileges(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << "0" << Toa(thread_info.item_sort_tab[item_sort_index]->privileges, 8);
}
void thread_sort_tab_dir(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
std::wstring path;
if( system->dirs.MakePath(thread_info.item_sort_tab[item_sort_index]->parent_id, path) )
i.out << path;
else
i.out << "/the path does not exist/"; // !! do konfiga
}
}
void thread_sort_tab_url(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << thread_info.item_sort_tab[item_sort_index]->url;
}
void thread_sort_tab_link(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
doc_proto(i);
i.out << config->base_url;
thread_sort_tab_dir(i);
thread_sort_tab_url(i);
}
}
void thread_sort_tab_can_read(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
if( system->HasReadAccess(*thread_info.item_sort_tab[item_sort_index]) )
i.res = true;
}
}
void thread_sort_tab_can_write(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = system->HasWriteAccess(*thread_info.item_sort_tab[item_sort_index]);
}
void thread_sort_tab_user(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->guest_name);
}
}
void thread_sort_tab_modification_user(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->modification_user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->guest_name);
}
}
void thread_sort_tab_users_different(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
i.res = (thread_info.item_sort_tab[item_sort_index]->user_id != thread_info.item_sort_tab[item_sort_index]->modification_user_id);
}
}
void thread_sort_tab_group(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
long group_id = thread_info.item_sort_tab[item_sort_index]->group_id;
Group * pgroup = system->groups.GetGroup(group_id);
if( pgroup )
i.out << pgroup->name;
else
i.out << group_id;
}
}
void thread_sort_tab_date_creation(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
PT::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->date_creation);
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
}
}
void thread_sort_tab_date_modification(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
PT::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->date_modification);
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
}
}
void thread_sort_tab_date_creation_nice(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->date_creation);
}
}
void thread_sort_tab_date_modification_nice(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->date_modification);
}
}
void thread_sort_tab_dates_equal(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
PT::Date & date1 = thread_info.item_sort_tab[item_sort_index]->date_creation;
PT::Date & date2 = thread_info.item_sort_tab[item_sort_index]->date_modification;
i.res = date1 == date2;
}
}
void thread_sort_tab_run(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
if( system->HasReadExecAccess(*thread_info.item_sort_tab[item_sort_index]) )
{
Ezc::Pattern * p = pattern_cacher.GetPattern(*thread_info.item_sort_tab[item_sort_index]);
item_run_content.Clear();
InitGenerator(ezc_generator);
ezc_generator.SetPattern(*p);
ezc_generator.Generate(item_run_content);
item_print_content(i.out, item_run_content.Str(), thread_info.item_sort_tab[item_sort_index]->content_type);
}
else
{
i.out << "<!-- run: permission denied -->";
}
}
}
void thread_sort_tab_has_static_file(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
i.res = thread_info.item_sort_tab[item_sort_index]->file_type != WINIX_ITEM_FILETYPE_NONE &&
!thread_info.item_sort_tab[item_sort_index]->file_path.empty();
}
}
void thread_sort_tab_has_thumb(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = thread_info.item_sort_tab[item_sort_index]->has_thumb;
}
void thread_sort_tab_type_is_dir(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = thread_info.item_sort_tab[item_sort_index]->type == Item::dir;
}
void thread_sort_tab_type_is_file(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = thread_info.item_sort_tab[item_sort_index]->type == Item::file;
}
void thread_sort_tab_type_is_symlink(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = thread_info.item_sort_tab[item_sort_index]->type == Item::symlink;
}
void thread_sort_tab_is_link_to(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = !thread_info.item_sort_tab[item_sort_index]->link_to.empty();
}
void thread_sort_tab_link_to(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << thread_info.item_sort_tab[item_sort_index]->link_to;
}
void thread_sort_tab_is_link_redirect(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = thread_info.item_sort_tab[item_sort_index]->link_redirect == 1;
}
void thread_sort_tab_has_thread(Info & i)
{
i.res = has_thread;
}
void thread_sort_tab_replies(Info & i)
{
if( has_thread && thread_index < thread_info.thread_tab.size() )
i.out << thread_info.thread_tab[thread_index].replies;
}
void thread_sort_tab_last_item_date_modification_nice(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
if( has_thread && thread_index < thread_info.thread_tab.size() )
{
Thread & thread = thread_info.thread_tab[thread_index];
if( thread.last_item_id != -1 )
print_date_nice(i, thread.last_item_date_modification);
else
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->date_modification);
}
}
}
void thread_sort_tab_last_item_user(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
if( has_thread && thread_index < thread_info.thread_tab.size() )
{
Thread & thread = thread_info.thread_tab[thread_index];
if( thread.last_item_id != -1 )
{
User * puser = system->users.GetUser(thread.last_item_user_id);
print_user_name(i, puser, thread.last_item_guest_name);
}
else
{
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->guest_name);
}
}
}
}
void thread_can_reply(Info & i)
{
i.res = fun_reply.HasAccess();
}
void thread_can_create(Info & i)
{
i.res = fun_create_thread.HasAccess();
}
void thread_mount_arg_is(Info & i)
{
if( system->mounts.pmount )
i.res = system->mounts.pmount->IsArg(thread_info.mount_par_thread, i.par);
}
void AddEzcFunctions(PluginInfo & info)
{
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
fun->Insert("thread_sort_tab", thread_sort_tab);
fun->Insert("thread_sort_tab_id", thread_sort_tab_id);
fun->Insert("thread_sort_tab_subject", thread_sort_tab_subject);
fun->Insert("thread_sort_tab_subject_noescape", thread_sort_tab_subject_noescape);
fun->Insert("thread_sort_tab_content", thread_sort_tab_content);
fun->Insert("thread_sort_tab_content_noescape", thread_sort_tab_content_noescape);
fun->Insert("thread_sort_tab_print_content", thread_sort_tab_print_content);
fun->Insert("thread_sort_tab_privileges", thread_sort_tab_privileges);
fun->Insert("thread_sort_tab_dir", thread_sort_tab_dir);
fun->Insert("thread_sort_tab_url", thread_sort_tab_url);
fun->Insert("thread_sort_tab_link", thread_sort_tab_link);
fun->Insert("thread_sort_tab_can_read", thread_sort_tab_can_read);
fun->Insert("thread_sort_tab_can_write", thread_sort_tab_can_write);
fun->Insert("thread_sort_tab_user", thread_sort_tab_user);
fun->Insert("thread_sort_tab_modification_user", thread_sort_tab_modification_user);
fun->Insert("thread_sort_tab_users_different", thread_sort_tab_users_different);
fun->Insert("thread_sort_tab_group", thread_sort_tab_group);
fun->Insert("thread_sort_tab_date_creation", thread_sort_tab_date_creation);
fun->Insert("thread_sort_tab_date_modification", thread_sort_tab_date_modification);
fun->Insert("thread_sort_tab_date_creation_nice", thread_sort_tab_date_creation_nice);
fun->Insert("thread_sort_tab_date_modification_nice", thread_sort_tab_date_modification_nice);
fun->Insert("thread_sort_tab_dates_equal", thread_sort_tab_dates_equal);
fun->Insert("thread_sort_tab_run", thread_sort_tab_run);
fun->Insert("thread_sort_tab_has_static_file", thread_sort_tab_has_static_file);
fun->Insert("thread_sort_tab_has_thumb", thread_sort_tab_has_thumb);
fun->Insert("thread_sort_tab_type_is_dir", thread_sort_tab_type_is_dir);
fun->Insert("thread_sort_tab_type_is_file", thread_sort_tab_type_is_file);
fun->Insert("thread_sort_tab_type_is_symlink", thread_sort_tab_type_is_symlink);
fun->Insert("thread_sort_tab_is_link_to", thread_sort_tab_is_link_to);
fun->Insert("thread_sort_tab_link_to", thread_sort_tab_link_to);
fun->Insert("thread_sort_tab_is_link_redirect", thread_sort_tab_is_link_redirect);
fun->Insert("thread_sort_tab_has_thread", thread_sort_tab_has_thread);
fun->Insert("thread_sort_tab_replies", thread_sort_tab_replies);
fun->Insert("thread_sort_tab_last_item_date_modification_nice", thread_sort_tab_last_item_date_modification_nice);
fun->Insert("thread_sort_tab_last_item_user", thread_sort_tab_last_item_user);
fun->Insert("thread_can_reply", thread_can_reply);
fun->Insert("thread_can_create", thread_can_create);
fun->Insert("thread_mount_arg_is", thread_mount_arg_is);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,60 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_templates
#define headerfile_winix_plugins_thread_templates
#include "core/plugin.h"
namespace Winix
{
namespace Thread
{
bool thread_sort_tab(size_t sort_index);
void AddEzcFunctions(PluginInfo & info);
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,91 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2009-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_thread
#define headerfile_winix_plugins_thread_thread
#include <string>
#include <string.h>
#include "date/date.h"
namespace Winix
{
namespace Thread
{
class Thread
{
public:
long file_id;
long replies;
bool closed;
// the last file in a thread
long last_item_id;
PT::Date last_item_date_modification;
long last_item_user_id;
std::wstring last_item_guest_name;
void Clear()
{
file_id = -1;
closed = false;
replies = 0;
last_item_id = -1;
last_item_user_id = -1;
last_item_date_modification.Clear();
last_item_guest_name.clear();
}
Thread()
{
Clear();
}
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,195 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include "threadinfo.h"
#include "core/plugin.h"
#include "pluginmsg.h"
namespace Winix
{
namespace Thread
{
void ThreadInfo::SetDb(Db * pdb)
{
db = pdb;
}
void ThreadInfo::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void ThreadInfo::SetSystem(System * psystem)
{
system = psystem;
}
void ThreadInfo::Clear()
{
item_tab.clear();
thread_tab.clear();
item_sort_tab.clear();
}
Item * ThreadInfo::FindThreadDir()
{
Item * plugin_dir = 0;
plugin.Call(WINIX_PL_THREAD_SEARCH_THREAD_DIR, &plugin_dir);
if( plugin_dir )
return plugin_dir;
const std::wstring & dir_str = system->mounts.pmount->FirstArg(mount_par_thread_dir);
if( dir_str.empty() )
return 0;
int res = system->FollowAllLinks(dir_str, out_dir_tab, out_item);
if( res != 0 )
return 0;
return out_dir_tab.back();
}
void ThreadInfo::RemoveThread(long file_id)
{
if( tdb->GetAnswers(file_id, remove_answer_id_tab) == WINIX_ERR_OK )
{
for(size_t i=0 ; i<remove_answer_id_tab.size() ; ++i)
db->DelFileById(remove_answer_id_tab[i]);
}
tdb->RemoveThread(file_id);
}
void ThreadInfo::RemoveThreadAnswer(long answer_id)
{
tdb->RemoveAnswer(answer_id);
}
void ThreadInfo::RepairAnswer(long answer_id)
{
iq.Clear();
iq.SetAll(false, false);
iq.WhereId(answer_id);
iq.WhereType(Item::file); // !! moze w przyszlosci pozwolic takze na symlinki?
if( db->GetItem(repair_item, iq) == WINIX_ERR_NO_ITEM )
{
log << log3 << "ThreadInfo: there is no a file for thread answer_id: " << answer_id << logend;
tdb->RemoveAnswerOnly(answer_id);
}
}
void ThreadInfo::RepairAnswers(long file_id)
{
tdb->GetAnswers(file_id, repair_answer_tab);
for(size_t i=0 ; i<repair_answer_tab.size() ; ++i)
RepairAnswer(repair_answer_tab[i]);
}
void ThreadInfo::Repair(long file_id)
{
iq.Clear();
iq.SetAll(false, false);
iq.WhereId(file_id);
iq.WhereType(Item::file); // !! moze w przyszlosci pozwolic takze na symlinki?
if( db->GetItem(repair_item, iq) == WINIX_ERR_NO_ITEM )
{
log << log3 << "ThreadInfo: there is no a file for thread file_id: " << file_id << logend;
tdb->RemoveThread(file_id);
}
else
{
RepairAnswers(file_id);
tdb->RecalcThread(file_id);
}
}
void ThreadInfo::Repair()
{
tdb->GetAllThreadsId(repair_id_tab);
for(size_t i=0 ; i<repair_id_tab.size() ; ++i)
Repair(repair_id_tab[i]);
}
void ThreadInfo::MakeRedirectIfPossible(const Item & item)
{
PluginRes res = plugin.Call(WINIX_PL_THREAD_CAN_MAKE_REDIRECT);
if( res.res_false > 0 )
{
log << log4 << "Thread: redirect prevented" << logend;
return;
}
system->RedirectTo(item);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,125 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_thread_threadinfo
#define headerfile_winix_plugins_thread_threadinfo
#include <vector>
#include "core/item.h"
#include "core/system.h"
#include "db/db.h"
#include "thread.h"
#include "tdb.h"
namespace Winix
{
namespace Thread
{
class ThreadInfo
{
public:
void SetDb(Db * pdb);
void SetTDb(TDb * ptdb);
void SetSystem(System * psystem);
void Clear();
Item * FindThreadDir();
// id of a mount type
int mount_type_thread;
// enable a thread in a specific directory
// and set sort type (asc, desc)
int mount_par_thread;
// a special directory in which we store the answers
int mount_par_thread_dir;
// id of the current plugin
int plugin_id;
// files in the current directory
// used for 'show_threads' or 'thread' function
std::vector<Item> item_tab;
// additional info to the above files if 'show_threads' is used
// sorted by file_id
std::vector<Thread> thread_tab;
// for sorting
std::vector<Item*> item_sort_tab;
// template index for notifications
size_t template_index;
void RemoveThread(long file_id);
void RemoveThreadAnswer(long answer_id);
// repairing the database
void Repair();
void MakeRedirectIfPossible(const Item & item);
private:
Db * db;
TDb * tdb;
System * system;
std::vector<Item*> out_dir_tab;
std::vector<long> remove_answer_id_tab, repair_id_tab, repair_answer_tab;
Item out_item, repair_item;
DbItemQuery iq;
void RepairAnswer(long answer_id);
void RepairAnswers(long file_id);
void Repair(long file_id);
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,28 @@
include Makefile.o.dep
name = ticket.so
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name) -o $(name) $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $(LDFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -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
rm -f *.so
rm -f $(name)
include Makefile.dep

View File

@@ -0,0 +1,774 @@
# DO NOT DELETE
createticket.o: ../../../winix/core/plugin.h pluginmsg.h
createticket.o: ../../../winix/core/log.h ../../../winix/core/textstream.h
createticket.o: ../../../winix/core/misc.h ../../../winix/core/item.h
createticket.o: ../../../pikotools/space/space.h
createticket.o: ../../../pikotools/textstream/types.h
createticket.o: ../../../pikotools/date/date.h
createticket.o: ../../../winix/core/requesttypes.h
createticket.o: ../../../pikotools/textstream/textstream.h
createticket.o: ../../../pikotools/convert/convert.h
createticket.o: ../../../pikotools/convert/inttostr.h
createticket.o: ../../../pikotools/membuffer/membuffer.h
createticket.o: ../../../pikotools/textstream/types.h
createticket.o: ../../../pikotools/utf8/utf8.h
createticket.o: ../../../winix/core/winix_const.h
createticket.o: ../../../winix/core/logmanipulators.h
createticket.o: ../../../winix/core/slog.h ../../../winix/core/cur.h
createticket.o: ../../../winix/core/request.h ../../../winix/core/error.h
createticket.o: ../../../winix/core/config.h
createticket.o: ../../../pikotools/space/spaceparser.h
createticket.o: ../../../pikotools/space/space.h
createticket.o: ../../../winix/core/htmlfilter.h
createticket.o: ../../../winix/templates/htmltextstream.h
createticket.o: ../../../winix/core/textstream.h
createticket.o: ../../../pikotools/space/spacetojson.h
createticket.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
createticket.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
createticket.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
createticket.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
createticket.o: ../../../winix/core/system.h ../../../winix/core/job.h
createticket.o: ../../../winix/core/basethread.h
createticket.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
createticket.o: ../../../winix/core/dircontainer.h ../../../winix/db/db.h
createticket.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
createticket.o: ../../../winix/db/dbtextstream.h ../../../winix/core/error.h
createticket.o: ../../../winix/db/dbitemquery.h ../../../winix/core/item.h
createticket.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
createticket.o: ../../../winix/core/group.h
createticket.o: ../../../winix/core/dircontainer.h
createticket.o: ../../../winix/core/ugcontainer.h
createticket.o: ../../../winix/notify/notify.h
createticket.o: ../../../winix/notify/notifypool.h
createticket.o: ../../../winix/templates/patterns.h
createticket.o: ../../../winix/templates/locale.h
createticket.o: ../../../winix/templates/localefilter.h
createticket.o: ../../../ezc/src/ezc.h ../../../ezc/src/generator.h
createticket.o: ../../../ezc/src/blocks.h ../../../ezc/src/cache.h
createticket.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h
createticket.o: ../../../ezc/src/objects.h ../../../ezc/src/pattern.h
createticket.o: ../../../ezc/src/patternparser.h
createticket.o: ../../../winix/notify/notifythread.h
createticket.o: ../../../winix/core/basethread.h
createticket.o: ../../../winix/notify/templatesnotify.h
createticket.o: ../../../winix/core/config.h ../../../winix/core/users.h
createticket.o: ../../../winix/core/ugcontainer.h
createticket.o: ../../../winix/core/lastcontainer.h
createticket.o: ../../../winix/core/mounts.h
createticket.o: ../../../winix/core/mountparser.h ../../../winix/core/crypt.h
createticket.o: ../../../winix/core/run.h ../../../winix/core/users.h
createticket.o: ../../../winix/core/groups.h ../../../winix/core/group.h
createticket.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
createticket.o: ../../../winix/core/threadmanager.h
createticket.o: ../../../winix/core/timezones.h
createticket.o: ../../../winix/core/timezone.h
createticket.o: ../../../winix/core/sessionmanager.h
createticket.o: ../../../winix/core/sessioncontainer.h
createticket.o: ../../../winix/core/ipbancontainer.h
createticket.o: ../../../winix/core/sessionidmanager.h
createticket.o: ../../../tito/src/base64.h ../../../tito/src/aes.h
createticket.o: ../../../winix/functions/functions.h
createticket.o: ../../../winix/functions/functionbase.h
createticket.o: ../../../winix/core/request.h ../../../winix/core/system.h
createticket.o: ../../../winix/core/synchro.h
createticket.o: ../../../winix/functions/functionparser.h
createticket.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
createticket.o: ../../../winix/functions/adduser.h
createticket.o: ../../../winix/functions/cat.h
createticket.o: ../../../winix/functions/chmod.h
createticket.o: ../../../winix/functions/privchanger.h
createticket.o: ../../../winix/functions/chown.h
createticket.o: ../../../winix/functions/ckeditor.h
createticket.o: ../../../winix/functions/cp.h
createticket.o: ../../../winix/functions/default.h
createticket.o: ../../../winix/functions/download.h
createticket.o: ../../../winix/functions/emacs.h
createticket.o: ../../../winix/functions/env.h
createticket.o: ../../../winix/functions/imgcrop.h
createticket.o: ../../../winix/functions/last.h
createticket.o: ../../../winix/functions/login.h
createticket.o: ../../../winix/functions/logout.h
createticket.o: ../../../winix/functions/ln.h ../../../winix/functions/ls.h
createticket.o: ../../../winix/functions/man.h
createticket.o: ../../../winix/functions/meta.h
createticket.o: ../../../winix/functions/mkdir.h
createticket.o: ../../../winix/functions/mv.h
createticket.o: ../../../winix/functions/nicedit.h
createticket.o: ../../../winix/functions/node.h
createticket.o: ../../../winix/functions/passwd.h
createticket.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
createticket.o: ../../../winix/functions/reload.h
createticket.o: ../../../winix/functions/rm.h
createticket.o: ../../../winix/functions/rmuser.h
createticket.o: ../../../winix/functions/sort.h
createticket.o: ../../../winix/functions/specialdefault.h
createticket.o: ../../../winix/functions/stat.h
createticket.o: ../../../winix/functions/subject.h
createticket.o: ../../../winix/functions/template.h
createticket.o: ../../../winix/functions/tinymce.h
createticket.o: ../../../winix/functions/uname.h
createticket.o: ../../../winix/functions/upload.h
createticket.o: ../../../winix/functions/uptime.h
createticket.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
createticket.o: ../../../winix/core/htmlfilter.h
createticket.o: ../../../winix/templates/templates.h
createticket.o: ../../../winix/templates/patterncacher.h
createticket.o: ../../../winix/templates/indexpatterns.h
createticket.o: ../../../winix/templates/patterns.h
createticket.o: ../../../winix/templates/changepatterns.h
createticket.o: ../../../winix/templates/htmltextstream.h
createticket.o: ../../../winix/core/sessionmanager.h createticket.h tdb.h
createticket.o: ticket.h ../../../winix/db/dbbase.h
createticket.o: ../../../winix/functions/functionbase.h ticketinfo.h
createticket.o: sessiondata.h ../../../winix/core/plugindata.h
createticket.o: ../../../winix/functions/rm.h
editticket.o: editticket.h tdb.h ticket.h ../../../winix/db/dbbase.h
editticket.o: ../../../winix/core/error.h ticketinfo.h
editticket.o: ../../../winix/core/item.h ../../../winix/core/system.h
editticket.o: ../../../winix/functions/functions.h
editticket.o: ../../../winix/functions/functionbase.h ../../../winix/db/db.h
editticket.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
editticket.o: ../../../winix/db/dbtextstream.h
editticket.o: ../../../winix/core/textstream.h
editticket.o: ../../../pikotools/textstream/textstream.h
editticket.o: ../../../pikotools/space/space.h
editticket.o: ../../../pikotools/textstream/types.h
editticket.o: ../../../pikotools/date/date.h
editticket.o: ../../../pikotools/convert/convert.h
editticket.o: ../../../pikotools/convert/inttostr.h
editticket.o: ../../../pikotools/membuffer/membuffer.h
editticket.o: ../../../pikotools/textstream/types.h
editticket.o: ../../../pikotools/space/spaceparser.h
editticket.o: ../../../pikotools/space/space.h
editticket.o: ../../../winix/db/dbitemquery.h
editticket.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
editticket.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
editticket.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
editticket.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
editticket.o: ../../../winix/core/item.h ../../../winix/core/requesttypes.h
editticket.o: ../../../pikotools/utf8/utf8.h
editticket.o: ../../../winix/core/winix_const.h
editticket.o: ../../../winix/core/logmanipulators.h
editticket.o: ../../../winix/core/slog.h ../../../winix/core/cur.h
editticket.o: ../../../winix/core/request.h ../../../winix/core/error.h
editticket.o: ../../../winix/core/config.h ../../../winix/core/htmlfilter.h
editticket.o: ../../../winix/templates/htmltextstream.h
editticket.o: ../../../pikotools/space/spacetojson.h
editticket.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
editticket.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
editticket.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
editticket.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
editticket.o: ../../../winix/core/request.h ../../../winix/core/config.h
editticket.o: ../../../winix/core/synchro.h ../../../winix/notify/notify.h
editticket.o: ../../../winix/notify/notifypool.h
editticket.o: ../../../winix/templates/patterns.h
editticket.o: ../../../winix/templates/locale.h
editticket.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
editticket.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
editticket.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
editticket.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
editticket.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
editticket.o: ../../../winix/notify/notifythread.h
editticket.o: ../../../winix/core/basethread.h
editticket.o: ../../../winix/notify/templatesnotify.h
editticket.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
editticket.o: ../../../winix/core/lastcontainer.h
editticket.o: ../../../winix/functions/functionparser.h
editticket.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
editticket.o: ../../../winix/functions/adduser.h
editticket.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
editticket.o: ../../../winix/functions/privchanger.h
editticket.o: ../../../winix/functions/chown.h
editticket.o: ../../../winix/functions/ckeditor.h
editticket.o: ../../../winix/functions/cp.h
editticket.o: ../../../winix/functions/default.h
editticket.o: ../../../winix/functions/download.h
editticket.o: ../../../winix/functions/emacs.h ../../../winix/functions/env.h
editticket.o: ../../../winix/functions/imgcrop.h
editticket.o: ../../../winix/functions/last.h
editticket.o: ../../../winix/functions/login.h
editticket.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
editticket.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
editticket.o: ../../../winix/functions/meta.h
editticket.o: ../../../winix/functions/mkdir.h ../../../winix/functions/mv.h
editticket.o: ../../../winix/functions/nicedit.h
editticket.o: ../../../winix/functions/node.h
editticket.o: ../../../winix/functions/passwd.h
editticket.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
editticket.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
editticket.o: ../../../winix/functions/rmuser.h ../../../winix/core/run.h
editticket.o: ../../../winix/functions/sort.h
editticket.o: ../../../winix/functions/specialdefault.h
editticket.o: ../../../winix/functions/stat.h
editticket.o: ../../../winix/functions/subject.h
editticket.o: ../../../winix/functions/template.h
editticket.o: ../../../winix/core/timezone.h
editticket.o: ../../../winix/functions/tinymce.h
editticket.o: ../../../winix/functions/uname.h
editticket.o: ../../../winix/functions/upload.h
editticket.o: ../../../winix/functions/uptime.h
editticket.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
editticket.o: ../../../winix/core/htmlfilter.h
editticket.o: ../../../winix/functions/functionbase.h sessiondata.h
editticket.o: ../../../winix/core/plugindata.h ../../../winix/functions/rm.h
editticket.o: ../../../winix/core/plugin.h pluginmsg.h
editticket.o: ../../../winix/core/system.h ../../../winix/core/job.h
editticket.o: ../../../winix/core/basethread.h ../../../winix/core/synchro.h
editticket.o: ../../../winix/core/dirs.h ../../../winix/core/dircontainer.h
editticket.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
editticket.o: ../../../winix/core/crypt.h ../../../winix/core/users.h
editticket.o: ../../../winix/core/groups.h ../../../winix/core/group.h
editticket.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
editticket.o: ../../../winix/core/threadmanager.h
editticket.o: ../../../winix/core/timezones.h
editticket.o: ../../../winix/core/sessionmanager.h
editticket.o: ../../../winix/core/sessioncontainer.h
editticket.o: ../../../winix/core/ipbancontainer.h
editticket.o: ../../../winix/core/sessionidmanager.h
editticket.o: ../../../tito/src/base64.h ../../../tito/src/aes.h
editticket.o: ../../../winix/templates/templates.h
editticket.o: ../../../winix/templates/patterncacher.h
editticket.o: ../../../winix/templates/indexpatterns.h
editticket.o: ../../../winix/templates/patterns.h
editticket.o: ../../../winix/templates/changepatterns.h
editticket.o: ../../../winix/templates/htmltextstream.h
editticket.o: ../../../winix/core/sessionmanager.h
funticket.o: funticket.h tdb.h ticket.h ../../../winix/db/dbbase.h
funticket.o: ../../../winix/core/error.h ticketinfo.h
funticket.o: ../../../winix/core/item.h ../../../winix/core/system.h
funticket.o: ../../../winix/functions/functions.h
funticket.o: ../../../winix/functions/functionbase.h ../../../winix/db/db.h
funticket.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
funticket.o: ../../../winix/db/dbtextstream.h
funticket.o: ../../../winix/core/textstream.h
funticket.o: ../../../pikotools/textstream/textstream.h
funticket.o: ../../../pikotools/space/space.h
funticket.o: ../../../pikotools/textstream/types.h
funticket.o: ../../../pikotools/date/date.h
funticket.o: ../../../pikotools/convert/convert.h
funticket.o: ../../../pikotools/convert/inttostr.h
funticket.o: ../../../pikotools/membuffer/membuffer.h
funticket.o: ../../../pikotools/textstream/types.h
funticket.o: ../../../pikotools/space/spaceparser.h
funticket.o: ../../../pikotools/space/space.h ../../../winix/db/dbitemquery.h
funticket.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
funticket.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
funticket.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
funticket.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
funticket.o: ../../../winix/core/item.h ../../../winix/core/requesttypes.h
funticket.o: ../../../pikotools/utf8/utf8.h ../../../winix/core/winix_const.h
funticket.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
funticket.o: ../../../winix/core/cur.h ../../../winix/core/request.h
funticket.o: ../../../winix/core/error.h ../../../winix/core/config.h
funticket.o: ../../../winix/core/htmlfilter.h
funticket.o: ../../../winix/templates/htmltextstream.h
funticket.o: ../../../pikotools/space/spacetojson.h
funticket.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
funticket.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
funticket.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
funticket.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
funticket.o: ../../../winix/core/request.h ../../../winix/core/config.h
funticket.o: ../../../winix/core/synchro.h ../../../winix/notify/notify.h
funticket.o: ../../../winix/notify/notifypool.h
funticket.o: ../../../winix/templates/patterns.h
funticket.o: ../../../winix/templates/locale.h
funticket.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
funticket.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
funticket.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
funticket.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
funticket.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
funticket.o: ../../../winix/notify/notifythread.h
funticket.o: ../../../winix/core/basethread.h
funticket.o: ../../../winix/notify/templatesnotify.h
funticket.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
funticket.o: ../../../winix/core/lastcontainer.h
funticket.o: ../../../winix/functions/functionparser.h
funticket.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
funticket.o: ../../../winix/functions/adduser.h
funticket.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
funticket.o: ../../../winix/functions/privchanger.h
funticket.o: ../../../winix/functions/chown.h
funticket.o: ../../../winix/functions/ckeditor.h
funticket.o: ../../../winix/functions/cp.h ../../../winix/functions/default.h
funticket.o: ../../../winix/functions/download.h
funticket.o: ../../../winix/functions/emacs.h ../../../winix/functions/env.h
funticket.o: ../../../winix/functions/imgcrop.h
funticket.o: ../../../winix/functions/last.h ../../../winix/functions/login.h
funticket.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
funticket.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
funticket.o: ../../../winix/functions/meta.h ../../../winix/functions/mkdir.h
funticket.o: ../../../winix/functions/mv.h ../../../winix/functions/nicedit.h
funticket.o: ../../../winix/functions/node.h
funticket.o: ../../../winix/functions/passwd.h
funticket.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
funticket.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
funticket.o: ../../../winix/functions/rmuser.h ../../../winix/core/run.h
funticket.o: ../../../winix/functions/sort.h
funticket.o: ../../../winix/functions/specialdefault.h
funticket.o: ../../../winix/functions/stat.h
funticket.o: ../../../winix/functions/subject.h
funticket.o: ../../../winix/functions/template.h
funticket.o: ../../../winix/core/timezone.h
funticket.o: ../../../winix/functions/tinymce.h
funticket.o: ../../../winix/functions/uname.h
funticket.o: ../../../winix/functions/upload.h
funticket.o: ../../../winix/functions/uptime.h ../../../winix/functions/who.h
funticket.o: ../../../winix/functions/vim.h ../../../winix/core/htmlfilter.h
funticket.o: ../../../winix/functions/functionbase.h
funticket.o: ../../../winix/core/plugin.h pluginmsg.h
funticket.o: ../../../winix/core/system.h ../../../winix/core/job.h
funticket.o: ../../../winix/core/basethread.h ../../../winix/core/synchro.h
funticket.o: ../../../winix/core/dirs.h ../../../winix/core/dircontainer.h
funticket.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
funticket.o: ../../../winix/core/crypt.h ../../../winix/core/users.h
funticket.o: ../../../winix/core/groups.h ../../../winix/core/group.h
funticket.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
funticket.o: ../../../winix/core/threadmanager.h
funticket.o: ../../../winix/core/timezones.h
funticket.o: ../../../winix/core/sessionmanager.h
funticket.o: ../../../winix/core/sessioncontainer.h
funticket.o: ../../../winix/core/ipbancontainer.h
funticket.o: ../../../winix/core/sessionidmanager.h
funticket.o: ../../../tito/src/base64.h ../../../tito/src/aes.h
funticket.o: ../../../winix/templates/templates.h
funticket.o: ../../../winix/templates/patterncacher.h
funticket.o: ../../../winix/templates/indexpatterns.h
funticket.o: ../../../winix/templates/patterns.h
funticket.o: ../../../winix/templates/changepatterns.h
funticket.o: ../../../winix/templates/htmltextstream.h
funticket.o: ../../../winix/core/sessionmanager.h
funticket.o: ../../../winix/plugins/thread/pluginmsg.h
init.o: tdb.h ticket.h ../../../winix/db/dbbase.h ../../../winix/core/error.h
init.o: funticket.h ticketinfo.h ../../../winix/core/item.h
init.o: ../../../winix/core/system.h ../../../winix/functions/functions.h
init.o: ../../../winix/functions/functionbase.h ../../../winix/db/db.h
init.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
init.o: ../../../winix/db/dbtextstream.h ../../../winix/core/textstream.h
init.o: ../../../pikotools/textstream/textstream.h
init.o: ../../../pikotools/space/space.h
init.o: ../../../pikotools/textstream/types.h ../../../pikotools/date/date.h
init.o: ../../../pikotools/convert/convert.h
init.o: ../../../pikotools/convert/inttostr.h
init.o: ../../../pikotools/membuffer/membuffer.h
init.o: ../../../pikotools/textstream/types.h
init.o: ../../../pikotools/space/spaceparser.h
init.o: ../../../pikotools/space/space.h ../../../winix/db/dbitemquery.h
init.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
init.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
init.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
init.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
init.o: ../../../winix/core/item.h ../../../winix/core/requesttypes.h
init.o: ../../../pikotools/utf8/utf8.h ../../../winix/core/winix_const.h
init.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
init.o: ../../../winix/core/cur.h ../../../winix/core/request.h
init.o: ../../../winix/core/error.h ../../../winix/core/config.h
init.o: ../../../winix/core/htmlfilter.h
init.o: ../../../winix/templates/htmltextstream.h
init.o: ../../../pikotools/space/spacetojson.h ../../../ezc/src/outstreams.h
init.o: ../../../winix/core/session.h ../../../winix/core/user.h
init.o: ../../../winix/core/plugindata.h ../../../winix/core/rebus.h
init.o: ../../../winix/core/ipban.h ../../../winix/core/mount.h
init.o: ../../../winix/templates/locale.h ../../../winix/core/request.h
init.o: ../../../winix/core/config.h ../../../winix/core/synchro.h
init.o: ../../../winix/notify/notify.h ../../../winix/notify/notifypool.h
init.o: ../../../winix/templates/patterns.h ../../../winix/templates/locale.h
init.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
init.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
init.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
init.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
init.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
init.o: ../../../winix/notify/notifythread.h ../../../winix/core/basethread.h
init.o: ../../../winix/notify/templatesnotify.h ../../../winix/core/users.h
init.o: ../../../winix/core/ugcontainer.h ../../../winix/core/lastcontainer.h
init.o: ../../../winix/functions/functionparser.h ../../../winix/core/cur.h
init.o: ../../../winix/functions/account.h ../../../winix/functions/adduser.h
init.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
init.o: ../../../winix/functions/privchanger.h
init.o: ../../../winix/functions/chown.h ../../../winix/functions/ckeditor.h
init.o: ../../../winix/functions/cp.h ../../../winix/functions/default.h
init.o: ../../../winix/functions/download.h ../../../winix/functions/emacs.h
init.o: ../../../winix/functions/env.h ../../../winix/functions/imgcrop.h
init.o: ../../../winix/functions/last.h ../../../winix/functions/login.h
init.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
init.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
init.o: ../../../winix/functions/meta.h ../../../winix/functions/mkdir.h
init.o: ../../../winix/functions/mv.h ../../../winix/functions/nicedit.h
init.o: ../../../winix/functions/node.h ../../../winix/functions/passwd.h
init.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
init.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
init.o: ../../../winix/functions/rmuser.h ../../../winix/core/run.h
init.o: ../../../winix/functions/sort.h
init.o: ../../../winix/functions/specialdefault.h
init.o: ../../../winix/functions/stat.h ../../../winix/functions/subject.h
init.o: ../../../winix/functions/template.h ../../../winix/core/timezone.h
init.o: ../../../winix/functions/tinymce.h ../../../winix/functions/uname.h
init.o: ../../../winix/functions/upload.h ../../../winix/functions/uptime.h
init.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
init.o: ../../../winix/core/htmlfilter.h
init.o: ../../../winix/functions/functionbase.h editticket.h createticket.h
init.o: showtickets.h ../../../winix/core/log.h ../../../winix/core/plugin.h
init.o: pluginmsg.h ../../../winix/core/system.h ../../../winix/core/job.h
init.o: ../../../winix/core/basethread.h ../../../winix/core/synchro.h
init.o: ../../../winix/core/dirs.h ../../../winix/core/dircontainer.h
init.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
init.o: ../../../winix/core/crypt.h ../../../winix/core/users.h
init.o: ../../../winix/core/groups.h ../../../winix/core/group.h
init.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
init.o: ../../../winix/core/threadmanager.h ../../../winix/core/timezones.h
init.o: ../../../winix/core/sessionmanager.h
init.o: ../../../winix/core/sessioncontainer.h
init.o: ../../../winix/core/ipbancontainer.h
init.o: ../../../winix/core/sessionidmanager.h ../../../tito/src/base64.h
init.o: ../../../tito/src/aes.h ../../../winix/templates/templates.h
init.o: ../../../winix/templates/patterncacher.h
init.o: ../../../winix/templates/indexpatterns.h
init.o: ../../../winix/templates/patterns.h
init.o: ../../../winix/templates/changepatterns.h
init.o: ../../../winix/templates/htmltextstream.h
init.o: ../../../winix/core/sessionmanager.h sessiondata.h
init.o: ../../../winix/core/plugindata.h ../../../winix/functions/rm.h
init.o: ../../../winix/plugins/thread/showthreads.h
init.o: ../../../winix/plugins/thread/threadinfo.h
init.o: ../../../winix/plugins/thread/thread.h
init.o: ../../../winix/plugins/thread/pluginmsg.h
sessiondata.o: sessiondata.h ../../../winix/core/plugindata.h ticket.h
sessiondata.o: ../../../winix/functions/rm.h ../../../pikotools/space/space.h
sessiondata.o: ../../../pikotools/textstream/types.h
showtickets.o: showtickets.h tdb.h ticket.h ../../../winix/db/dbbase.h
showtickets.o: ../../../winix/core/error.h ticketinfo.h
showtickets.o: ../../../winix/core/item.h ../../../winix/core/system.h
showtickets.o: ../../../winix/functions/functions.h
showtickets.o: ../../../winix/functions/functionbase.h ../../../winix/db/db.h
showtickets.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
showtickets.o: ../../../winix/db/dbtextstream.h
showtickets.o: ../../../winix/core/textstream.h
showtickets.o: ../../../pikotools/textstream/textstream.h
showtickets.o: ../../../pikotools/space/space.h
showtickets.o: ../../../pikotools/textstream/types.h
showtickets.o: ../../../pikotools/date/date.h
showtickets.o: ../../../pikotools/convert/convert.h
showtickets.o: ../../../pikotools/convert/inttostr.h
showtickets.o: ../../../pikotools/membuffer/membuffer.h
showtickets.o: ../../../pikotools/textstream/types.h
showtickets.o: ../../../pikotools/space/spaceparser.h
showtickets.o: ../../../pikotools/space/space.h
showtickets.o: ../../../winix/db/dbitemquery.h
showtickets.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
showtickets.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
showtickets.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
showtickets.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
showtickets.o: ../../../winix/core/item.h ../../../winix/core/requesttypes.h
showtickets.o: ../../../pikotools/utf8/utf8.h
showtickets.o: ../../../winix/core/winix_const.h
showtickets.o: ../../../winix/core/logmanipulators.h
showtickets.o: ../../../winix/core/slog.h ../../../winix/core/cur.h
showtickets.o: ../../../winix/core/request.h ../../../winix/core/error.h
showtickets.o: ../../../winix/core/config.h ../../../winix/core/htmlfilter.h
showtickets.o: ../../../winix/templates/htmltextstream.h
showtickets.o: ../../../pikotools/space/spacetojson.h
showtickets.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
showtickets.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
showtickets.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
showtickets.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
showtickets.o: ../../../winix/core/request.h ../../../winix/core/config.h
showtickets.o: ../../../winix/core/synchro.h ../../../winix/notify/notify.h
showtickets.o: ../../../winix/notify/notifypool.h
showtickets.o: ../../../winix/templates/patterns.h
showtickets.o: ../../../winix/templates/locale.h
showtickets.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
showtickets.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
showtickets.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
showtickets.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
showtickets.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
showtickets.o: ../../../winix/notify/notifythread.h
showtickets.o: ../../../winix/core/basethread.h
showtickets.o: ../../../winix/notify/templatesnotify.h
showtickets.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
showtickets.o: ../../../winix/core/lastcontainer.h
showtickets.o: ../../../winix/functions/functionparser.h
showtickets.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
showtickets.o: ../../../winix/functions/adduser.h
showtickets.o: ../../../winix/functions/cat.h
showtickets.o: ../../../winix/functions/chmod.h
showtickets.o: ../../../winix/functions/privchanger.h
showtickets.o: ../../../winix/functions/chown.h
showtickets.o: ../../../winix/functions/ckeditor.h
showtickets.o: ../../../winix/functions/cp.h
showtickets.o: ../../../winix/functions/default.h
showtickets.o: ../../../winix/functions/download.h
showtickets.o: ../../../winix/functions/emacs.h
showtickets.o: ../../../winix/functions/env.h
showtickets.o: ../../../winix/functions/imgcrop.h
showtickets.o: ../../../winix/functions/last.h
showtickets.o: ../../../winix/functions/login.h
showtickets.o: ../../../winix/functions/logout.h
showtickets.o: ../../../winix/functions/ln.h ../../../winix/functions/ls.h
showtickets.o: ../../../winix/functions/man.h ../../../winix/functions/meta.h
showtickets.o: ../../../winix/functions/mkdir.h ../../../winix/functions/mv.h
showtickets.o: ../../../winix/functions/nicedit.h
showtickets.o: ../../../winix/functions/node.h
showtickets.o: ../../../winix/functions/passwd.h
showtickets.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
showtickets.o: ../../../winix/functions/reload.h
showtickets.o: ../../../winix/functions/rm.h
showtickets.o: ../../../winix/functions/rmuser.h ../../../winix/core/run.h
showtickets.o: ../../../winix/functions/sort.h
showtickets.o: ../../../winix/functions/specialdefault.h
showtickets.o: ../../../winix/functions/stat.h
showtickets.o: ../../../winix/functions/subject.h
showtickets.o: ../../../winix/functions/template.h
showtickets.o: ../../../winix/core/timezone.h
showtickets.o: ../../../winix/functions/tinymce.h
showtickets.o: ../../../winix/functions/uname.h
showtickets.o: ../../../winix/functions/upload.h
showtickets.o: ../../../winix/functions/uptime.h
showtickets.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
showtickets.o: ../../../winix/core/htmlfilter.h
showtickets.o: ../../../winix/functions/functionbase.h pluginmsg.h
showtickets.o: ../../../winix/plugins/thread/pluginmsg.h
showtickets.o: ../../../winix/core/plugin.h ../../../winix/core/system.h
showtickets.o: ../../../winix/core/job.h ../../../winix/core/basethread.h
showtickets.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
showtickets.o: ../../../winix/core/dircontainer.h
showtickets.o: ../../../winix/core/mounts.h ../../../winix/core/mountparser.h
showtickets.o: ../../../winix/core/crypt.h ../../../winix/core/users.h
showtickets.o: ../../../winix/core/groups.h ../../../winix/core/group.h
showtickets.o: ../../../winix/core/loadavg.h ../../../winix/core/image.h
showtickets.o: ../../../winix/core/threadmanager.h
showtickets.o: ../../../winix/core/timezones.h
showtickets.o: ../../../winix/core/sessionmanager.h
showtickets.o: ../../../winix/core/sessioncontainer.h
showtickets.o: ../../../winix/core/ipbancontainer.h
showtickets.o: ../../../winix/core/sessionidmanager.h
showtickets.o: ../../../tito/src/base64.h ../../../tito/src/aes.h
showtickets.o: ../../../winix/templates/templates.h
showtickets.o: ../../../winix/templates/patterncacher.h
showtickets.o: ../../../winix/templates/indexpatterns.h
showtickets.o: ../../../winix/templates/patterns.h
showtickets.o: ../../../winix/templates/changepatterns.h
showtickets.o: ../../../winix/templates/htmltextstream.h
showtickets.o: ../../../winix/core/sessionmanager.h
tdb.o: tdb.h ticket.h ../../../winix/db/dbbase.h ../../../winix/core/error.h
tdb.o: ../../../winix/core/log.h
templates.o: ../../../ezc/src/ezc.h ../../../ezc/src/generator.h
templates.o: ../../../ezc/src/blocks.h ../../../winix/core/item.h
templates.o: ../../../pikotools/space/space.h
templates.o: ../../../pikotools/textstream/types.h
templates.o: ../../../pikotools/date/date.h ../../../ezc/src/cache.h
templates.o: ../../../ezc/src/functions.h ../../../pikotools/utf8/utf8.h
templates.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
templates.o: ../../../ezc/src/pattern.h ../../../ezc/src/outstreams.h
templates.o: ../../../ezc/src/patternparser.h ticketinfo.h ticket.h
templates.o: ../../../winix/core/item.h ../../../winix/core/system.h
templates.o: ../../../winix/functions/functions.h
templates.o: ../../../winix/functions/functionbase.h ../../../winix/db/db.h
templates.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
templates.o: ../../../winix/db/dbtextstream.h
templates.o: ../../../winix/core/textstream.h
templates.o: ../../../pikotools/textstream/textstream.h
templates.o: ../../../pikotools/convert/convert.h
templates.o: ../../../pikotools/convert/inttostr.h
templates.o: ../../../pikotools/membuffer/membuffer.h
templates.o: ../../../pikotools/textstream/types.h
templates.o: ../../../winix/core/error.h
templates.o: ../../../pikotools/space/spaceparser.h
templates.o: ../../../pikotools/space/space.h ../../../winix/db/dbitemquery.h
templates.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
templates.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
templates.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
templates.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
templates.o: ../../../winix/core/requesttypes.h
templates.o: ../../../winix/core/winix_const.h
templates.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
templates.o: ../../../winix/core/cur.h ../../../winix/core/request.h
templates.o: ../../../winix/core/error.h ../../../winix/core/config.h
templates.o: ../../../winix/core/htmlfilter.h
templates.o: ../../../winix/templates/htmltextstream.h
templates.o: ../../../pikotools/space/spacetojson.h
templates.o: ../../../winix/core/session.h ../../../winix/core/user.h
templates.o: ../../../winix/core/plugindata.h ../../../winix/core/rebus.h
templates.o: ../../../winix/core/ipban.h ../../../winix/core/mount.h
templates.o: ../../../winix/templates/locale.h ../../../winix/core/request.h
templates.o: ../../../winix/core/config.h ../../../winix/core/synchro.h
templates.o: ../../../winix/notify/notify.h
templates.o: ../../../winix/notify/notifypool.h
templates.o: ../../../winix/templates/patterns.h
templates.o: ../../../winix/templates/locale.h
templates.o: ../../../winix/templates/localefilter.h
templates.o: ../../../winix/notify/notifythread.h
templates.o: ../../../winix/core/basethread.h
templates.o: ../../../winix/notify/templatesnotify.h
templates.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
templates.o: ../../../winix/core/lastcontainer.h
templates.o: ../../../winix/functions/functionparser.h
templates.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
templates.o: ../../../winix/functions/adduser.h
templates.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
templates.o: ../../../winix/functions/privchanger.h
templates.o: ../../../winix/functions/chown.h
templates.o: ../../../winix/functions/ckeditor.h
templates.o: ../../../winix/functions/cp.h ../../../winix/functions/default.h
templates.o: ../../../winix/functions/download.h
templates.o: ../../../winix/functions/emacs.h ../../../winix/functions/env.h
templates.o: ../../../winix/functions/imgcrop.h
templates.o: ../../../winix/functions/last.h ../../../winix/functions/login.h
templates.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
templates.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
templates.o: ../../../winix/functions/meta.h ../../../winix/functions/mkdir.h
templates.o: ../../../winix/functions/mv.h ../../../winix/functions/nicedit.h
templates.o: ../../../winix/functions/node.h
templates.o: ../../../winix/functions/passwd.h
templates.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
templates.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
templates.o: ../../../winix/functions/rmuser.h ../../../winix/core/run.h
templates.o: ../../../winix/functions/sort.h
templates.o: ../../../winix/functions/specialdefault.h
templates.o: ../../../winix/functions/stat.h
templates.o: ../../../winix/functions/subject.h
templates.o: ../../../winix/functions/template.h
templates.o: ../../../winix/core/timezone.h
templates.o: ../../../winix/functions/tinymce.h
templates.o: ../../../winix/functions/uname.h
templates.o: ../../../winix/functions/upload.h
templates.o: ../../../winix/functions/uptime.h ../../../winix/functions/who.h
templates.o: ../../../winix/functions/vim.h ../../../winix/core/htmlfilter.h
templates.o: tdb.h ../../../winix/db/dbbase.h editticket.h
templates.o: ../../../winix/functions/functionbase.h createticket.h
templates.o: ../../../winix/core/misc.h ../../../winix/core/plugin.h
templates.o: pluginmsg.h ../../../winix/core/system.h
templates.o: ../../../winix/core/job.h ../../../winix/core/basethread.h
templates.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
templates.o: ../../../winix/core/dircontainer.h ../../../winix/core/mounts.h
templates.o: ../../../winix/core/mountparser.h ../../../winix/core/crypt.h
templates.o: ../../../winix/core/users.h ../../../winix/core/groups.h
templates.o: ../../../winix/core/group.h ../../../winix/core/loadavg.h
templates.o: ../../../winix/core/image.h ../../../winix/core/threadmanager.h
templates.o: ../../../winix/core/timezones.h
templates.o: ../../../winix/core/sessionmanager.h
templates.o: ../../../winix/core/sessioncontainer.h
templates.o: ../../../winix/core/ipbancontainer.h
templates.o: ../../../winix/core/sessionidmanager.h
templates.o: ../../../tito/src/base64.h ../../../tito/src/aes.h
templates.o: ../../../winix/templates/templates.h
templates.o: ../../../winix/templates/patterncacher.h
templates.o: ../../../winix/templates/indexpatterns.h
templates.o: ../../../winix/templates/patterns.h
templates.o: ../../../winix/templates/changepatterns.h
templates.o: ../../../winix/templates/htmltextstream.h
templates.o: ../../../winix/core/sessionmanager.h sessiondata.h
templates.o: ../../../winix/core/plugindata.h ../../../winix/functions/rm.h
templates.o: ../../../winix/plugins/thread/pluginmsg.h
templates.o: ../../../winix/templates/miscspace.h
templates.o: ../../../winix/templates/templates.h
ticketinfo.o: ticketinfo.h ticket.h ../../../winix/core/item.h
ticketinfo.o: ../../../winix/core/system.h
ticketinfo.o: ../../../winix/functions/functions.h
ticketinfo.o: ../../../winix/functions/functionbase.h ../../../winix/db/db.h
ticketinfo.o: ../../../winix/db/dbbase.h ../../../winix/db/dbconn.h
ticketinfo.o: ../../../winix/db/dbtextstream.h
ticketinfo.o: ../../../winix/core/textstream.h
ticketinfo.o: ../../../pikotools/textstream/textstream.h
ticketinfo.o: ../../../pikotools/space/space.h
ticketinfo.o: ../../../pikotools/textstream/types.h
ticketinfo.o: ../../../pikotools/date/date.h
ticketinfo.o: ../../../pikotools/convert/convert.h
ticketinfo.o: ../../../pikotools/convert/inttostr.h
ticketinfo.o: ../../../pikotools/membuffer/membuffer.h
ticketinfo.o: ../../../pikotools/textstream/types.h
ticketinfo.o: ../../../winix/core/error.h
ticketinfo.o: ../../../pikotools/space/spaceparser.h
ticketinfo.o: ../../../pikotools/space/space.h
ticketinfo.o: ../../../winix/db/dbitemquery.h
ticketinfo.o: ../../../winix/db/dbitemcolumns.h ../../../winix/core/user.h
ticketinfo.o: ../../../winix/core/group.h ../../../winix/core/dircontainer.h
ticketinfo.o: ../../../winix/core/ugcontainer.h ../../../winix/core/log.h
ticketinfo.o: ../../../winix/core/textstream.h ../../../winix/core/misc.h
ticketinfo.o: ../../../winix/core/item.h ../../../winix/core/requesttypes.h
ticketinfo.o: ../../../pikotools/utf8/utf8.h
ticketinfo.o: ../../../winix/core/winix_const.h
ticketinfo.o: ../../../winix/core/logmanipulators.h
ticketinfo.o: ../../../winix/core/slog.h ../../../winix/core/cur.h
ticketinfo.o: ../../../winix/core/request.h ../../../winix/core/error.h
ticketinfo.o: ../../../winix/core/config.h ../../../winix/core/htmlfilter.h
ticketinfo.o: ../../../winix/templates/htmltextstream.h
ticketinfo.o: ../../../pikotools/space/spacetojson.h
ticketinfo.o: ../../../ezc/src/outstreams.h ../../../winix/core/session.h
ticketinfo.o: ../../../winix/core/user.h ../../../winix/core/plugindata.h
ticketinfo.o: ../../../winix/core/rebus.h ../../../winix/core/ipban.h
ticketinfo.o: ../../../winix/core/mount.h ../../../winix/templates/locale.h
ticketinfo.o: ../../../winix/core/request.h ../../../winix/core/config.h
ticketinfo.o: ../../../winix/core/synchro.h ../../../winix/notify/notify.h
ticketinfo.o: ../../../winix/notify/notifypool.h
ticketinfo.o: ../../../winix/templates/patterns.h
ticketinfo.o: ../../../winix/templates/locale.h
ticketinfo.o: ../../../winix/templates/localefilter.h ../../../ezc/src/ezc.h
ticketinfo.o: ../../../ezc/src/generator.h ../../../ezc/src/blocks.h
ticketinfo.o: ../../../ezc/src/cache.h ../../../ezc/src/functions.h
ticketinfo.o: ../../../ezc/src/funinfo.h ../../../ezc/src/objects.h
ticketinfo.o: ../../../ezc/src/pattern.h ../../../ezc/src/patternparser.h
ticketinfo.o: ../../../winix/notify/notifythread.h
ticketinfo.o: ../../../winix/core/basethread.h
ticketinfo.o: ../../../winix/notify/templatesnotify.h
ticketinfo.o: ../../../winix/core/users.h ../../../winix/core/ugcontainer.h
ticketinfo.o: ../../../winix/core/lastcontainer.h
ticketinfo.o: ../../../winix/functions/functionparser.h
ticketinfo.o: ../../../winix/core/cur.h ../../../winix/functions/account.h
ticketinfo.o: ../../../winix/functions/adduser.h
ticketinfo.o: ../../../winix/functions/cat.h ../../../winix/functions/chmod.h
ticketinfo.o: ../../../winix/functions/privchanger.h
ticketinfo.o: ../../../winix/functions/chown.h
ticketinfo.o: ../../../winix/functions/ckeditor.h
ticketinfo.o: ../../../winix/functions/cp.h
ticketinfo.o: ../../../winix/functions/default.h
ticketinfo.o: ../../../winix/functions/download.h
ticketinfo.o: ../../../winix/functions/emacs.h ../../../winix/functions/env.h
ticketinfo.o: ../../../winix/functions/imgcrop.h
ticketinfo.o: ../../../winix/functions/last.h
ticketinfo.o: ../../../winix/functions/login.h
ticketinfo.o: ../../../winix/functions/logout.h ../../../winix/functions/ln.h
ticketinfo.o: ../../../winix/functions/ls.h ../../../winix/functions/man.h
ticketinfo.o: ../../../winix/functions/meta.h
ticketinfo.o: ../../../winix/functions/mkdir.h ../../../winix/functions/mv.h
ticketinfo.o: ../../../winix/functions/nicedit.h
ticketinfo.o: ../../../winix/functions/node.h
ticketinfo.o: ../../../winix/functions/passwd.h
ticketinfo.o: ../../../winix/functions/priv.h ../../../winix/functions/pw.h
ticketinfo.o: ../../../winix/functions/reload.h ../../../winix/functions/rm.h
ticketinfo.o: ../../../winix/functions/rmuser.h ../../../winix/core/run.h
ticketinfo.o: ../../../winix/functions/sort.h
ticketinfo.o: ../../../winix/functions/specialdefault.h
ticketinfo.o: ../../../winix/functions/stat.h
ticketinfo.o: ../../../winix/functions/subject.h
ticketinfo.o: ../../../winix/functions/template.h
ticketinfo.o: ../../../winix/core/timezone.h
ticketinfo.o: ../../../winix/functions/tinymce.h
ticketinfo.o: ../../../winix/functions/uname.h
ticketinfo.o: ../../../winix/functions/upload.h
ticketinfo.o: ../../../winix/functions/uptime.h
ticketinfo.o: ../../../winix/functions/who.h ../../../winix/functions/vim.h
ticketinfo.o: ../../../winix/core/htmlfilter.h tdb.h
ticketinfo.o: ../../../winix/db/dbbase.h ../../../winix/core/log.h
ticketinfo.o: ../../../winix/core/misc.h ../../../winix/core/plugin.h
ticketinfo.o: pluginmsg.h ../../../winix/core/system.h
ticketinfo.o: ../../../winix/core/job.h ../../../winix/core/basethread.h
ticketinfo.o: ../../../winix/core/synchro.h ../../../winix/core/dirs.h
ticketinfo.o: ../../../winix/core/dircontainer.h ../../../winix/core/mounts.h
ticketinfo.o: ../../../winix/core/mountparser.h ../../../winix/core/crypt.h
ticketinfo.o: ../../../winix/core/users.h ../../../winix/core/groups.h
ticketinfo.o: ../../../winix/core/group.h ../../../winix/core/loadavg.h
ticketinfo.o: ../../../winix/core/image.h ../../../winix/core/threadmanager.h
ticketinfo.o: ../../../winix/core/timezones.h
ticketinfo.o: ../../../winix/core/sessionmanager.h
ticketinfo.o: ../../../winix/core/sessioncontainer.h
ticketinfo.o: ../../../winix/core/ipbancontainer.h
ticketinfo.o: ../../../winix/core/sessionidmanager.h
ticketinfo.o: ../../../tito/src/base64.h ../../../tito/src/aes.h
ticketinfo.o: ../../../winix/templates/templates.h
ticketinfo.o: ../../../winix/templates/patterncacher.h
ticketinfo.o: ../../../winix/templates/indexpatterns.h
ticketinfo.o: ../../../winix/templates/patterns.h
ticketinfo.o: ../../../winix/templates/changepatterns.h
ticketinfo.o: ../../../winix/templates/htmltextstream.h
ticketinfo.o: ../../../winix/core/sessionmanager.h sessiondata.h
ticketinfo.o: ../../../winix/core/plugindata.h ../../../winix/functions/rm.h

View File

@@ -0,0 +1 @@
o = createticket.o editticket.o funticket.o init.o sessiondata.o showtickets.o tdb.o templates.o ticketinfo.o

View File

@@ -0,0 +1,227 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, 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.
*
*/
#include "core/plugin.h"
#include "createticket.h"
#include "functions/functions.h"
#include "sessiondata.h"
#include "pluginmsg.h"
namespace Winix
{
namespace Ticket
{
CreateTicket::CreateTicket()
{
fun.url = L"createticket";
}
void CreateTicket::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void CreateTicket::SetTicketInfo(TicketInfo * pinfo)
{
ticket_info = pinfo;
}
bool CreateTicket::HasAccess()
{
if( cur->request->is_item || !system->HasWriteAccess(*cur->request->dir_tab.back()) )
return false;
if( cur->mount->type != ticket_info->mount_type_ticket )
return false;
return true;
}
void CreateTicket::AddTicket(Ticket & ticket, Item & item)
{
ticket.file_id = item.id;
cur->request->status = tdb->AddTicket(ticket);
if( cur->request->status == WINIX_ERR_OK )
{
// sending notification
notify_msg.code = WINIX_NOTIFY_CODE_ADD;
notify_msg.template_index = ticket_info->template_index;
notify_msg.dir_link = config->url_proto;
notify_msg.dir_link += config->base_url;// !! IMPROVE ME what about subdomains?
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
notify_msg.item_link = notify_msg.dir_link;
notify_msg.item_link += item.url;
system->notify.ItemChanged(notify_msg);
// sending a message
plugin.Call(WINIX_PL_TICKET_ADDED_NEW, &ticket, &item);
}
}
void CreateTicket::Submit(Ticket & ticket, Item & item)
{
if( functions->CheckAbuse() )
return;
functions->SetUser(item);
item.privileges = system->NewFilePrivileges();
item.parent_id = cur->request->dir_tab.back()->id;
plugin.Call(WINIX_PL_TICKET_PREPARE_TO_ADD_TICKET, &item, &ticket);
// adding without notificating
cur->request->status = system->AddFile(item, false);
if( cur->request->status == WINIX_ERR_OK )
AddTicket(ticket, item);
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "CreateTicket: added a new ticket" << logend;
RemoveTmpTicket();
ticket_info->MakeRedirectIfPossible(item);
}
else
{
log << log1 << "CreateTicket: problem with adding a new ticket, error code: "
<< cur->request->status << logend;
}
}
void CreateTicket::RemoveTmpTicket()
{
SessionData * session_data = reinterpret_cast<SessionData*>(
cur->session->plugin_data.Get(ticket_info->plugin_id) );
long dir_id = cur->request->dir_tab.back()->id;
session_data->create_ticket_map.erase(dir_id);
session_data->create_space_map.erase(dir_id);
}
Ticket & CreateTicket::PrepareTicket()
{
SessionData * session_data = reinterpret_cast<SessionData*>(
cur->session->plugin_data.Get(ticket_info->plugin_id) );
bool is_new;
long dir_id = cur->request->dir_tab.back()->id;
Ticket & ticket = session_data->GetTicket(dir_id, session_data->create_ticket_map, &is_new);
ticket_info->create_new_ticket = is_new;
return ticket;
}
PT::Space & CreateTicket::PrepareSpace()
{
SessionData * session_data = reinterpret_cast<SessionData*>(
cur->session->plugin_data.Get(ticket_info->plugin_id) );
long dir_id = cur->request->dir_tab.back()->id;
PT::Space & new_space = session_data->GetNewSpace(dir_id, session_data->create_space_map);
return new_space;
}
void CreateTicket::MakePost()
{
ticket_info->Clear();
ticket_info->FindCurrentConf();
Ticket & ticket = PrepareTicket();
PT::Space & meta = PrepareSpace();
Item & item = cur->request->item;
ticket_info->ticket = &ticket;
ticket_info->item = &item;
bool file_was_deleted;
ticket_info->ReadTicketParams(ticket, false, meta, file_was_deleted);
functions->ReadItem(item, Item::file);
ticket_info->CopyTicketSpace(meta, item);
if( !cur->request->IsPostVar(L"fileuploadsubmit") && !file_was_deleted )
{
Submit(ticket, item);
ticket_info->ticket = ticket_info->GetEmptyTicket(); // ticket was deleted by Submit() method -- RemoveTmpTicket() was used
}
}
void CreateTicket::MakeGet()
{
ticket_info->Clear();
ticket_info->FindCurrentConf();
Ticket & ticket = PrepareTicket();
PT::Space & meta = PrepareSpace();
ticket_info->ticket = &ticket;
ticket_info->item = &cur->request->item;
// copy meta info to display correctly new files
ticket_info->CopyTicketSpace(meta, cur->request->item);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,81 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_ticket_createticket
#define headerfile_winix_plugins_ticket_createticket
#include "tdb.h"
#include "functions/functionbase.h"
#include "ticketinfo.h"
#include "notify/notify.h"
namespace Winix
{
namespace Ticket
{
class CreateTicket : public FunctionBase
{
public:
CreateTicket();
void SetTDb(TDb * ptdb);
void SetTicketInfo(TicketInfo * pinfo);
bool HasAccess();
void MakePost();
void MakeGet();
private:
void AddTicket(Ticket & ticket, Item & item);
void Submit(Ticket & ticket, Item & item);
void RemoveTmpTicket();
Ticket & PrepareTicket();
PT::Space & PrepareSpace();
TDb * tdb;
TicketInfo * ticket_info;
NotifyMsg notify_msg;
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,278 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, 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.
*
*/
#include "editticket.h"
#include "functions/functions.h"
#include "sessiondata.h"
#include "core/plugin.h"
#include "pluginmsg.h"
namespace Winix
{
namespace Ticket
{
EditTicket::EditTicket()
{
fun.url = L"editticket";
}
void EditTicket::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void EditTicket::SetTicketInfo(TicketInfo * pinfo)
{
ticket_info = pinfo;
}
bool EditTicket::HasAccess()
{
// not logged users cannot edit tickets
// !! we are waiting for the sticky bit
if( !cur->session->puser )
return false;
if( !cur->request->is_item || !system->HasWriteAccess(cur->request->item) )
return false;
if( cur->mount->type != ticket_info->mount_type_ticket )
return false;
// !! CHECKME what about closing threads?
return true;
}
void EditTicket::ChangeTicket(Ticket & ticket, Item & item)
{
cur->request->status = tdb->RemoveAddTicket(ticket);
if( cur->request->status == WINIX_ERR_OK )
{
// sending notification
notify_msg.code = WINIX_NOTIFY_CODE_EDIT;
notify_msg.template_index = ticket_info->template_index;
notify_msg.dir_link = config->url_proto;
notify_msg.dir_link += config->base_url;// !! IMPROVE ME what about subdomains?
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
notify_msg.item_link = notify_msg.dir_link;
notify_msg.item_link += item.url;
system->notify.ItemChanged(notify_msg);
// sending a message
plugin.Call(WINIX_PL_TICKET_CHANGED, &ticket, &item);
}
}
void EditTicket::Submit(Ticket & ticket, Item & item)
{
if( functions->CheckAbuse() )
return;
// adding without notificating
cur->request->status = system->EditFile(item, old_url != item.url);
if( cur->request->status == WINIX_ERR_OK )
ChangeTicket(ticket, item);
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "EditTicket: ticket modified" << logend;
RemoveTmpTicket();
ticket_info->MakeRedirectIfPossible(item);
}
else
{
log << log1 << "EditTicket: problem with editing a ticket, error code: "
<< cur->request->status << logend;
// !! add session log
}
}
void EditTicket::RemoveTmpTicket()
{
SessionData * session_data = reinterpret_cast<SessionData*>(
cur->session->plugin_data.Get(ticket_info->plugin_id) );
long file_id = cur->request->item.id;
session_data->edit_ticket_map.erase(file_id);
session_data->edit_space_map.erase(file_id);
}
Ticket & EditTicket::PrepareTicket()
{
SessionData * session_data = reinterpret_cast<SessionData*>(
cur->session->plugin_data.Get(ticket_info->plugin_id) );
bool is_new;
long file_id = cur->request->item.id;
Ticket & ticket = session_data->GetTicket(file_id, session_data->edit_ticket_map, &is_new);
if( is_new )
tdb->GetTicket(file_id, ticket);
else
ticket.file_id = file_id;
return ticket;
}
PT::Space & EditTicket::PrepareSpace()
{
SessionData * session_data = reinterpret_cast<SessionData*>(
cur->session->plugin_data.Get(ticket_info->plugin_id) );
bool is_new;
long file_id = cur->request->item.id;
PT::Space & new_space = session_data->GetNewSpace(file_id, session_data->edit_space_map, &is_new);
if( is_new )
{
PT::Space * ticket_space = cur->request->item.meta.FindSpace(L"ticket");
if( ticket_space )
{
new_space = *ticket_space;
PT::Space & old_space = session_data->GetOldSpace(file_id, session_data->edit_space_map);
old_space = new_space;
}
}
return new_space;
}
bool EditTicket::CloseTicket()
{
PT::Space & ticket_space = cur->request->item.ameta.FindAddSpace(L"ticket");
ticket_space.Add(L"closed", true);
PT::Space & thread_space = cur->request->item.ameta.FindAddSpace(L"thread");
thread_space.Add(L"closed", true);
if( db->EditAdminMetaById(cur->request->item.ameta, cur->request->item.id) == WINIX_ERR_OK )
{
log << log3 << "EditTicket: closing ticket" << logend;
return true;
}
return false;
}
void EditTicket::MakePost()
{
ticket_info->Clear();
ticket_info->FindCurrentConf();
Ticket & ticket = PrepareTicket();
PT::Space & meta = PrepareSpace();
Item & item = cur->request->item;
old_url = item.url;
ticket_info->ticket = &ticket;
ticket_info->item = &item;
if( cur->request->IsParam(L"close") )
{
if( CloseTicket() )
plugin.Call(WINIX_PL_TICKET_CLOSED, ticket_info->item, ticket_info->ticket);
ticket_info->MakeRedirectIfPossible(*cur->request->last_item);
}
else
{
bool file_was_deleted;
ticket_info->ReadTicketParams(ticket, false, meta, file_was_deleted);
functions->ReadItem(item, Item::file);
ticket_info->CopyTicketSpace(meta, item);
if( !cur->request->IsPostVar(L"fileuploadsubmit") && !file_was_deleted )
{
Submit(ticket, item);
ticket_info->ticket = ticket_info->GetEmptyTicket(); // ticket was deleted by Submit() method -- RemoveTmpTicket() was used
}
}
}
void EditTicket::MakeGet()
{
ticket_info->Clear();
ticket_info->FindCurrentConf();
Ticket & ticket = PrepareTicket();
PT::Space & meta = PrepareSpace();
ticket_info->ticket = &ticket;
ticket_info->item = &cur->request->item;
// copy meta info to display correctly new files
ticket_info->CopyTicketSpace(meta, cur->request->item);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,85 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_ticket_editticket
#define headerfile_winix_plugins_ticket_editticket
#include "tdb.h"
#include "ticket.h"
#include "ticketinfo.h"
#include "functions/functionbase.h"
#include "notify/notify.h"
namespace Winix
{
namespace Ticket
{
class EditTicket : public FunctionBase
{
public:
EditTicket();
void SetTDb(TDb * ptdb);
void SetTicketInfo(TicketInfo * pinfo);
bool HasAccess();
void MakePost();
void MakeGet();
private:
TDb * tdb;
TicketInfo * ticket_info;
std::wstring old_url;
NotifyMsg notify_msg;
void RemoveTmpTicket();
Ticket & PrepareTicket();
PT::Space & PrepareSpace();
void ChangeTicket(Ticket & ticket, Item & item);
void Submit(Ticket & ticket, Item & item);
bool CloseTicket();
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,90 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, 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.
*
*/
#include "funticket.h"
#include "core/plugin.h"
#include "plugins/thread/pluginmsg.h"
namespace Winix
{
namespace Ticket
{
FunTicket::FunTicket()
{
fun.url = L"ticket";
}
void FunTicket::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void FunTicket::SetTicketInfo(TicketInfo * pinfo)
{
ticket_info = pinfo;
}
bool FunTicket::HasAccess()
{
return cur->request->is_item && system->HasReadAccess(cur->request->item);
}
void FunTicket::MakeGet()
{
ticket_info->Clear();
ticket_info->FindCurrentConf();
ticket_info->ticket = &ticket;
ticket_info->item = &cur->request->item;
tdb->GetTicket(cur->request->item.id, ticket);
plugin.Call(WINIX_PL_THREAD_PREPARE_THREAD, cur->request->item.id);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,74 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_ticket_funticket
#define headerfile_winix_plugins_ticket_funticket
#include "tdb.h"
#include "ticketinfo.h"
#include "functions/functionbase.h"
namespace Winix
{
namespace Ticket
{
class FunTicket : public FunctionBase
{
public:
FunTicket();
void SetTDb(TDb * ptdb);
void SetTicketInfo(TicketInfo * pinfo);
bool HasAccess();
void MakeGet();
private:
TDb * tdb;
TicketInfo * ticket_info;
Ticket ticket;
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,235 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include "tdb.h"
#include "funticket.h"
#include "editticket.h"
#include "createticket.h"
#include "showtickets.h"
#include "core/log.h"
#include "core/plugin.h"
#include "sessiondata.h"
#include "plugins/thread/showthreads.h"
#include "plugins/thread/pluginmsg.h"
#include "pluginmsg.h"
namespace Winix
{
extern "C" void Init(PluginInfo &);
namespace Ticket
{
const wchar_t plugin_name[] = L"ticket";
TDb tdb;
TicketInfo ticket_info;
FunTicket fun_ticket;
CreateTicket fun_create_ticket;
EditTicket fun_edit_ticket;
ShowTickets fun_show_tickets;
void AddFunctions(PluginInfo & info)
{
info.functions->Add(fun_ticket);
info.functions->Add(fun_create_ticket);
info.functions->Add(fun_edit_ticket);
info.functions->Add(fun_show_tickets);
}
void SelectDefaultFunction(PluginInfo & info)
{
if( info.system->mounts.pmount->type == ticket_info.mount_type_ticket )
{
// !! moze dac fun_ticket tylko dla itemow ktore nie sa plikami statycznymi...
if( info.cur->request->is_item )
info.cur->request->function = &fun_ticket;
else
info.cur->request->function = &fun_show_tickets;
}
}
void AddMounts(PluginInfo & info)
{
Mounts & m = info.system->mounts;
ticket_info.mount_type_ticket = m.AddMountType(L"ticket");
ticket_info.mount_par_ticket_conf = m.AddMountPar(L"ticket_conf");
}
void FstabChanged(PluginInfo & info)
{
ticket_info.ReadTicketConf(true);
}
void ProcessRequest(PluginInfo & info)
{
if( info.cur->request->function == &info.functions->fun_reload )
{
if( info.cur->request->IsParam(L"tickets") )
ticket_info.ReadTicketConf();
}
}
void RemoveTicket(PluginInfo & info)
{
// !! dodac nowy komunikat PREPERE_TO_REMOVE
// i tam korzystajac z meta informacji w item
// usunac odpowiednie pliki
const Item * item = reinterpret_cast<Item*>(info.p1);
if( item )
ticket_info.RemoveTicket(item->id);
}
void InitTicket(PluginInfo & info)
{
ticket_info.progress_prefix = info.config->Text(L"ticket_form_progress_prefix", L"progress");
}
void AddNotifyTemplate(PluginInfo & info)
{
ticket_info.template_index = info.system->notify.AddTemplate(L"notify_email_ticket.txt");
}
void CreateSession(PluginInfo & info)
{
SessionData * p = new SessionData();
p->fun_rm = &info.functions->fun_rm;
info.session->plugin_data.Assign(p);
log << log4 << "Ticket: created ticket plugin data: " << (void*)p << logend;
}
void RemoveSession(PluginInfo & info)
{
if( info.plugin_data_base )
{
info.plugin_data_base->Clear();
delete info.plugin_data_base;
log << log4 << "Ticket: removed ticket plugin data: " << (void*)info.plugin_data_base << logend;
}
}
void EndRequest(PluginInfo & info)
{
ticket_info.Clear();
}
void ShowTicketsFromDir(PluginInfo & info)
{
fun_show_tickets.ShowTicketsFromDir(info.l1);
}
// defined in templates.cpp
void AddEzcFunctions(PluginInfo & info);
} // namespace Ticket
void Init(PluginInfo & info)
{
using namespace Ticket;
plugin.Assign(WINIX_PLUGIN_INIT, InitTicket);
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
plugin.Assign(WINIX_ADD_MOUNTS, AddMounts);
plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged);
plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
plugin.Assign(WINIX_FILE_REMOVED, RemoveTicket);
plugin.Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
plugin.Assign(WINIX_SESSION_CREATED, CreateSession);
plugin.Assign(WINIX_PLUGIN_SESSION_DATA_REMOVE, RemoveSession);
plugin.Assign(WINIX_END_REQUEST, EndRequest);
plugin.Assign(WINIX_PL_TICKET_LOAD_TICKETS, ShowTicketsFromDir);
tdb.SetConn(info.db->GetConn());
tdb.LogQueries(info.config->log_db_query);
ticket_info.SetDb(info.db);
ticket_info.SetTDb(&tdb);
ticket_info.SetConfig(info.config);
ticket_info.SetSystem(info.system);
ticket_info.SetCur(info.cur);
ticket_info.SetFunctions(info.functions);
ticket_info.plugin_id = info.plugin_id;
fun_ticket.SetTDb(&tdb);
fun_ticket.SetTicketInfo(&ticket_info);
fun_edit_ticket.SetTDb(&tdb);
fun_edit_ticket.SetTicketInfo(&ticket_info);
fun_create_ticket.SetTDb(&tdb);
fun_create_ticket.SetTicketInfo(&ticket_info);
fun_show_tickets.SetTDb(&tdb);
fun_show_tickets.SetTicketInfo(&ticket_info);
info.p1 = (void*)(plugin_name);
}
} // namespace Winix

View File

@@ -0,0 +1,105 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2011-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_ticket_pluginmsg
#define headerfile_winix_plugins_ticket_pluginmsg
namespace Winix
{
// values from 4100 - 4199 reserved for 'ticket' plugin
// showtickets winix function is about to sort pointers to tickets
// in p1 you have pointer to std::vector<Item*> struct
// you can sort it in your own (in such a case you have to return true)
#define WINIX_PL_TICKET_SORT_POINTERS 4100
//
#define WINIX_PL_TICKET_CAN_MAKE_REDIRECT 4101
// calling ShowTicketsFromDir(long dir_id) method from ShowTickets object
// when tickets are read and sorted then WINIX_PL_TICKET_TICKETS_LOADED is called
// in l1 you shoud give the directory_id
// from the tickets have to be read
// and you can use only ezc functions to display the tickets
#define WINIX_PL_TICKET_LOAD_TICKETS 4102
// a ticket is going to add
// in p1 you have a pointer to the Item struct
// in p2 you have a pointer to the Ticket struct
#define WINIX_PL_TICKET_PREPARE_TO_ADD_TICKET 4103
// a next ticket will be displayed
// in p1 you have a pointer to the Item struct
// this is call from tickets_tab ezc function
#define WINIX_PL_TICKET_TICKETS_TAB_IS_NEXT 4104
// a ticket has been closed (closed button pressed)
// in p1 you have a pointer to the Item struct
// in p2 you have a pointer to the Ticket struct
#define WINIX_PL_TICKET_CLOSED 4105
// 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
} // namespace Winix
#endif

View File

@@ -0,0 +1,219 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include <algorithm>
#include "sessiondata.h"
namespace Winix
{
namespace Ticket
{
SessionData::SessionData()
{
fun_rm = 0;
}
SessionData::~SessionData()
{
Clear();
}
void SessionData::Clear()
{
RemoveFiles(create_space_map, false);
RemoveFiles(edit_space_map, true);
}
void SessionData::RemoveFiles(SessionData::SpaceMap & space_map, bool only_stale_files)
{
SpaceMap::iterator i;
if( fun_rm )
{
for(i=space_map.begin() ; i!=space_map.end() ; ++i)
{
if( only_stale_files )
RemoveAllStaleFiles(i->second.new_space, i->second.old_space);
else
RemoveAllFiles(i->second.new_space);
}
space_map.clear();
}
}
void SessionData::RemoveAllFiles(PT::Space & new_space)
{
std::vector<long> new_file_tab;
BuildFileList(new_file_tab, new_space);
for(size_t i=0 ; i<new_file_tab.size() ; ++i)
fun_rm->RemoveItemById(new_file_tab[i], false);
}
void SessionData::RemoveAllStaleFiles(PT::Space & new_space, PT::Space & old_space)
{
std::vector<long> new_file_tab;
std::vector<long> old_file_tab;
size_t n = 0;
size_t o = 0;
BuildFileList(new_file_tab, new_space);
BuildFileList(old_file_tab, old_space);
std::sort(new_file_tab.begin(), new_file_tab.end());
std::sort(old_file_tab.begin(), old_file_tab.end());
// removes only those items present on new_file_tab
// but not existing on old_space_tab
while( n < new_file_tab.size() && o < old_file_tab.size() )
{
if( new_file_tab[n] < old_file_tab[o] )
{
fun_rm->RemoveFileOrSymlink(new_file_tab[n], false);
n += 1;
}
else
if( new_file_tab[n] == old_file_tab[o] )
{
n += 1;
o += 1;
}
else
{
o += 1;
}
}
while( n < new_file_tab.size() )
{
fun_rm->RemoveFileOrSymlink(new_file_tab[n], false);
n += 1;
}
}
void SessionData::BuildFileList(std::vector<long> & file_tab, PT::Space & space)
{
file_tab.clear();
for(size_t i=0 ; i<space.spaces.size() ; ++i)
{
PT::Space & sp = *space.spaces[i];
if( sp.name == L"param" )
CheckFile(file_tab, sp);
}
}
void SessionData::CheckFile(std::vector<long> & file_tab, PT::Space & space)
{
for(size_t i=0 ; i<space.spaces.size() ; ++i)
{
PT::Space & subsp = *space.spaces[i];
if( subsp.name == L"file" )
{
std::wstring * file_id_str = subsp.GetValue(L"itemid");
if( file_id_str )
{
long file_id = Tol(*file_id_str);
file_tab.push_back(file_id);
}
}
}
}
Ticket & SessionData::GetTicket(long id, SessionData::TicketMap & ticket_map, bool * is_new)
{
std::pair<TicketMap::iterator, bool> res = ticket_map.insert( std::make_pair(id, Ticket()) );
if( is_new )
*is_new = res.second;
return res.first->second;
}
PT::Space & SessionData::GetOldSpace(long id, SpaceMap & space_map, bool * is_new)
{
std::pair<SpaceMap::iterator, bool> res = space_map.insert( std::make_pair(id, SpacePair()) );
if( is_new )
*is_new = res.second;
return res.first->second.old_space;
}
PT::Space & SessionData::GetNewSpace(long id, SpaceMap & space_map, bool * is_new)
{
std::pair<SpaceMap::iterator, bool> res = space_map.insert( std::make_pair(id, SpacePair()) );
if( is_new )
*is_new = res.second;
return res.first->second.new_space;
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,120 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_ticket_sessiondata
#define headerfile_winix_plugins_ticket_sessiondata
#include <vector>
#include <string>
#include <map>
#include "core/plugindata.h"
#include "ticket.h"
#include "functions/rm.h"
#include "space/space.h"
namespace Winix
{
namespace Ticket
{
struct SessionData : public PluginDataBase
{
SessionData();
~SessionData();
struct SpacePair
{
PT::Space new_space;
PT::Space old_space;
// old_space is used when editing an existing ticket
// current ticket space is copied to old_space
// and when the session expires only new added files
// are deleted
};
virtual void Clear();
typedef std::map<long, Ticket> TicketMap;
typedef std::map<long, SpacePair> SpaceMap;
// temporary tickets for 'createticket' function
// <parent_dir_id, Ticket>
TicketMap create_ticket_map;
// temporary tickets for 'editticket' function
// <file_id, Ticket>
TicketMap edit_ticket_map;
// temporary spaces for 'createticket' function
// these files should be deleted if a user will not click on the submit button
SpaceMap create_space_map;
// temporary spaces for 'editticket' function
// these files should be deleted if a user will not click on the submit button
SpaceMap edit_space_map;
// inserting and returning a new ticket or just returning the ticket if it exists
Ticket & GetTicket(long id, TicketMap & ticket_map, bool * is_new = 0);
// inserting and returning a new/old space or just returning the space if it exists
PT::Space & GetOldSpace(long id, SpaceMap & space_map, bool * is_new = 0);
PT::Space & GetNewSpace(long id, SpaceMap & space_map, bool * is_new = 0);
// for deleting files
Fun::Rm * fun_rm;
private:
void RemoveFiles(SpaceMap & space_map, bool only_stale_files);
void RemoveAllFiles(PT::Space & new_space);
void RemoveAllStaleFiles(PT::Space & new_space, PT::Space & old_space);
void BuildFileList(std::vector<long> & file_tab, PT::Space & space);
void CheckFile(std::vector<long> & file_tab, PT::Space & space);
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,194 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include <ctime>
#include <algorithm>
#include "showtickets.h"
#include "pluginmsg.h"
#include "plugins/thread/pluginmsg.h"
#include "core/plugin.h"
namespace Winix
{
namespace Ticket
{
ShowTickets::ShowTickets()
{
fun.url = L"showtickets";
}
void ShowTickets::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void ShowTickets::SetTicketInfo(TicketInfo * pinfo)
{
ticket_info = pinfo;
}
bool ShowTickets::HasAccess()
{
return !cur->request->is_item;
}
bool ShowTickets::Sort::operator()(const Item * item1, const Item * item2)
{
if( sort_type == 0 )
{
// sorting by url
return item1->url < item2->url;
}
else
{
// sorting by sort_index and if equal then by date
if( item1->sort_index != item2->sort_index )
return item1->sort_index < item2->sort_index;
return item1->date_creation > item2->date_creation;
}
}
void ShowTickets::ReadFiles(long dir_id)
{
// reading files
DbItemQuery iq;
iq.SetAll(false, false);
iq.sel_url = true;
iq.sel_subject = true;
iq.sel_date = true;
iq.sel_user_id = true;
iq.sel_group_id = true;
iq.sel_guest_name = true;
iq.sel_privileges = true;
iq.sel_date = true;
iq.sel_meta = true;
iq.sel_sort_index = true;
iq.WhereParentId(dir_id);
iq.WhereType(Item::file);
iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
db->GetItems(ticket_info->item_tab, iq);
system->CheckAccessToItems(ticket_info->item_tab);
}
void ShowTickets::CreatePointers()
{
// creating a pointers table
ticket_info->item_sort_tab.resize(ticket_info->item_tab.size());
for(size_t i=0 ; i<ticket_info->item_tab.size() ; ++i)
ticket_info->item_sort_tab[i] = &ticket_info->item_tab[i];
}
void ShowTickets::SortPointers()
{
PluginRes res = plugin.Call(WINIX_PL_TICKET_SORT_POINTERS, &ticket_info->item_sort_tab);
if( res.res_true > 0 )
return;
int sort_type = 1;
if( cur->request->ParamValue(L"sort") == L"url" )
sort_type = 0;
std::vector<Item*> & table = ticket_info->item_sort_tab;
std::sort(table.begin(), table.end(), Sort(this, sort_type));
}
void ShowTickets::ReadTickets()
{
// reading tickets for the files
file_id_tab.resize(ticket_info->item_sort_tab.size());
for(size_t i=0 ; i<ticket_info->item_sort_tab.size() ; ++i)
file_id_tab[i] = ticket_info->item_sort_tab[i]->id;
tdb->GetTickets(file_id_tab, ticket_info->ticket_tab);
}
void ShowTickets::ShowTicketsFromDir(long dir_id)
{
ticket_info->Clear();
ticket_info->FindCurrentConf(dir_id);
ReadFiles(dir_id);
CreatePointers();
SortPointers();
ReadTickets();
plugin.Call(WINIX_PL_TICKET_TICKETS_LOADED, &ticket_info->ticket_tab, &ticket_info->item_sort_tab);
// !! IMPROVE ME may a better name instead of WINIX_PL_THREAD_SET_SORTTAB?
plugin.Call(WINIX_PL_THREAD_SET_SORTTAB, &ticket_info->item_sort_tab);
plugin.Call(WINIX_PL_THREAD_READ_THREADS);
}
void ShowTickets::MakeGet()
{
ShowTicketsFromDir(cur->request->dir_tab.back()->id);
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,90 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_ticket_showtickets
#define headerfile_winix_plugins_ticket_showtickets
#include "tdb.h"
#include "ticketinfo.h"
#include "core/item.h"
#include "functions/functionbase.h"
namespace Winix
{
namespace Ticket
{
class ShowTickets : public FunctionBase
{
public:
ShowTickets();
void SetTDb(TDb * ptdb);
void SetTicketInfo(TicketInfo * pinfo);
bool HasAccess();
void MakeGet();
void ShowTicketsFromDir(long dir_id);
private:
TDb * tdb;
TicketInfo * ticket_info;
std::vector<long> file_id_tab;
void ReadFiles(long dir_id);
void CreatePointers();
void SortPointers();
void ReadTickets();
struct Sort
{
ShowTickets * show_tickets;
int sort_type;
Sort(ShowTickets * show, int type) : show_tickets(show), sort_type(type) {}
bool operator()(const Item * item1, const Item * item2);
};
};
} // namespace
} // namespace Winix
#endif

View File

@@ -0,0 +1,289 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#include "tdb.h"
#include "core/log.h"
namespace Winix
{
namespace Ticket
{
bool TDb::IsTicket(long file_id)
{
PGresult * r = 0;
bool is = false;
try
{
query.Clear();
query << R("select count(*) from plugins.ticket "
"where ticket.file_id=") << file_id << R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
if( Rows(r)==1 && Cols(r)==1 )
is = AssertValueInt(r, 0, 0) != 0;
}
catch(const Error &)
{
}
ClearResult(r);
return is;
}
void TDb::SetTicketColumns(PGresult * r)
{
cfileid = AssertColumn(r, "file_id");
cparam = AssertColumn(r, "param");
cintv = AssertColumn(r, "intv");
cdecv = AssertColumn(r, "decv");
}
void TDb::ReadTicketPar(PGresult * r, Ticket::TicketParam & par, int row)
{
par.Clear();
par.param = AssertValueInt(r, row, cparam);
par.intv = AssertValueLong(r, row, cintv);
AssertValueWide(r, row, cdecv, par.decv); // !! temporarily
}
Error TDb::GetTicket(long file_id, Ticket & ticket)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
ticket.Clear();
try
{
// they should be sorted by param (they are used in a binary search later)
query.Clear();
query << R("select file_id, param, intv, decv from plugins.ticket "
"where ticket.file_id=") << file_id << R(" order by param asc;");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
SetTicketColumns(r);
int rows = Rows(r);
ticket.file_id = file_id;
if( rows == 0 )
throw Error(WINIX_ERR_NO_TICKET); // !! do we need this kind or error?
if( ticket.par_tab.capacity() < ticket.par_tab.size() + rows )
ticket.par_tab.reserve(ticket.par_tab.size() + rows);
for(int i=0 ; i<rows ; ++i)
{
ReadTicketPar(r, tic_par, i);
ticket.par_tab.push_back(tic_par);
}
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
Error TDb::GetTickets(const std::vector<long> & file_id_tab, std::vector<Ticket> & ticket_tab, bool clear_tab)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
if( clear_tab )
ticket_tab.clear();
if( file_id_tab.empty() )
return status;
try
{
// ticket_tab must be sorted by file_id (they are used in a binary search later)
// and items in a ticket should be sorted by param (they are used in a binary search later too)
query.Clear();
query << R("select file_id, param, intv, decv from plugins.ticket "
"where ticket.file_id in ") << file_id_tab << R(" order by file_id, param;");
r = AssertQuery(query);
AssertResult(r, PGRES_TUPLES_OK);
SetTicketColumns(r);
int rows = Rows(r);
long last_file_id = -1;
empty_ticket.Clear();
for(int i=0 ; i<rows ; ++i)
{
long file_id = AssertValueLong(r, i, cfileid);
if( i==0 || last_file_id != file_id )
{
ticket_tab.push_back(empty_ticket);
ticket_tab.back().file_id = file_id;
last_file_id = file_id;
}
ReadTicketPar(r, tic_par, i);
ticket_tab.back().par_tab.push_back(tic_par);
}
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
Error TDb::AddTicket(const Ticket & ticket)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
try
{
for(size_t i=0 ; i<ticket.par_tab.size() ; ++i)
{
query.Clear();
query << R("insert into plugins.ticket (file_id, param, intv) values (")
<< ticket.file_id
<< ticket.par_tab[i].param
<< ticket.par_tab[i].intv
//<< ticket.par_tab[i].decv
<< R(");");
r = AssertQuery(query);
AssertResult(r, PGRES_COMMAND_OK);
}
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
Error TDb::RemoveAddTicket(const Ticket & ticket)
{
Error status = BeginTrans();
if( status != WINIX_ERR_OK )
return status;
status = RemoveTicket(ticket.file_id);
if( status == WINIX_ERR_OK )
status = AddTicket(ticket);
if( status == WINIX_ERR_OK )
status = CommitTrans();
else
RollbackTrans();
return status;
}
Error TDb::RemoveTicket(long file_id)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
try
{
query.Clear();
query << R("delete from plugins.ticket where file_id=") << file_id << R(";");
r = AssertQuery(query);
AssertResult(r, PGRES_COMMAND_OK);
long rows = AffectedRows(r);
if( rows > 0 )
log << log2 << "TicketDb: deleted " << rows << " rows from plugins.ticket" << logend;
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
} // namespace
} // namespace Winix

View File

@@ -0,0 +1,85 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, 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.
*
*/
#ifndef headerfile_winix_plugins_ticket_tdb
#define headerfile_winix_plugins_ticket_tdb
#include <vector>
#include "ticket.h"
#include "db/dbbase.h"
#include "core/error.h"
namespace Winix
{
namespace Ticket
{
class TDb : public DbBase
{
public:
bool IsTicket(long file_id);
Error GetTicket(long file_id, Ticket & ticket);
Error GetTickets(const std::vector<long> & file_id_tab, std::vector<Ticket> & ticket_tab, bool clear_tab = true);
Error AddTicket(const Ticket & ticket);
Error RemoveAddTicket(const Ticket & ticket); // first removing and then adding a ticket
Error RemoveTicket(long file_id);
private:
DbTextStream query;
Ticket empty_ticket;
Ticket::TicketParam tic_par;
int cfileid;
int cparam;
int cintv;
int cdecv;
void SetTicketColumns(PGresult * r);
void ReadTicketPar(PGresult * r, Ticket::TicketParam & par, int row);
};
} // namespace
} // namespace Winix
#endif

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