fixed: in FunctionParser we do not treat '+' as a space
added: some work in MailRegister plugin (adding mails to db, showing mails) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1021 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
057607f9e5
commit
f15da4d049
File diff suppressed because one or more lines are too long
|
@ -335,6 +335,12 @@ int c;
|
|||
path += 3;
|
||||
}
|
||||
else
|
||||
if( *path == '+' )
|
||||
{
|
||||
c = ' ';
|
||||
path += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = *path;
|
||||
path += 1;
|
||||
|
|
|
@ -69,7 +69,101 @@ 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
|
||||
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
|
||||
|
@ -155,7 +249,9 @@ 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
|
||||
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
|
||||
|
@ -178,3 +274,108 @@ 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
|
||||
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
|
||||
|
|
|
@ -1 +1 @@
|
|||
o = funregistermail.o init.o mdb.o
|
||||
o = funregistermail.o funregistermail_showusers.o init.o mdb.o templates.o
|
||||
|
|
|
@ -46,10 +46,24 @@ namespace MailRegister
|
|||
|
||||
FunRegisterMail::FunRegisterMail()
|
||||
{
|
||||
fun.url = L"register_mail";
|
||||
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;
|
||||
|
@ -65,6 +79,14 @@ void FunRegisterMail::MakePost()
|
|||
|
||||
void FunRegisterMail::MakeGet()
|
||||
{
|
||||
mail = cur->request->ParamValue(L"mail");
|
||||
TrimWhite(mail);
|
||||
|
||||
if( ValidateEmail(mail) )
|
||||
{
|
||||
log << log3 << "RM: registering e-mail address: " << mail << logend;
|
||||
pmdb->AddMail(mail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,9 @@
|
|||
|
||||
|
||||
#include "functions/functionbase.h"
|
||||
#include "db/db.h"
|
||||
#include "registermail_info.h"
|
||||
#include "mdb.h"
|
||||
|
||||
|
||||
|
||||
namespace Winix
|
||||
|
@ -54,6 +56,10 @@ public:
|
|||
|
||||
FunRegisterMail();
|
||||
|
||||
|
||||
void SetMDb(MDb * pmdb_);
|
||||
void SetInfo(RegisterMailInfo * info);
|
||||
|
||||
bool HasAccess();
|
||||
|
||||
void MakePost();
|
||||
|
@ -62,6 +68,9 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
std::wstring mail;
|
||||
MDb * pmdb;
|
||||
RegisterMailInfo * pinfo;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -36,6 +36,9 @@
|
|||
#include "core/log.h"
|
||||
#include "core/plugin.h"
|
||||
#include "mdb.h"
|
||||
#include "funregistermail.h"
|
||||
#include "registermail_info.h"
|
||||
#include "funregistermail_showusers.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
|
@ -54,12 +57,15 @@ 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_export);
|
||||
info.functions->Add(fun_rm);
|
||||
info.functions->Add(fun_rm_showusers);
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,7 +92,13 @@ using namespace MailRegister;
|
|||
mdb.SetConn(info.db->GetConn());
|
||||
mdb.LogQueries(info.config->log_db_query);
|
||||
|
||||
// plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
|
||||
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);
|
||||
|
|
|
@ -35,16 +35,75 @@
|
|||
#include "mdb.h"
|
||||
#include "core/log.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
namespace Export
|
||||
namespace MailRegister
|
||||
{
|
||||
|
||||
|
||||
|
||||
bool MDb::AddMail(const std::wstring & mail)
|
||||
{
|
||||
PGresult * r = 0;
|
||||
Error status = WINIX_ERR_OK;
|
||||
|
||||
try
|
||||
{
|
||||
query.Clear();
|
||||
query << R("insert into plugins.registermail (mail) values (")
|
||||
<< 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#ifndef headerfile_winix_plugins_mailregister_mdb
|
||||
#define headerfile_winix_plugins_mailregister_mdb
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "db/dbbase.h"
|
||||
#include "core/dirs.h"
|
||||
|
@ -52,11 +53,15 @@ class MDb : public DbBase
|
|||
{
|
||||
public:
|
||||
|
||||
bool AddMail(const std::wstring & mail);
|
||||
bool GetUsers(std::vector<std::wstring> & container, bool clear_container = true);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
DbTextStream query;
|
||||
std::wstring mail;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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) 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>
|
||||
|
||||
|
||||
|
||||
class RegisterMailInfo
|
||||
{
|
||||
public:
|
||||
|
||||
std::vector<std::wstring> mail_list;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue