2008-12-10 05:42:49 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2008-12-10 05:42:49 +01:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2014-02-12 17:30:49 +01:00
|
|
|
* Copyright (c) 2008-2014, Tomasz Sowa
|
2008-12-10 05:42:49 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
#ifndef headerfile_winix_core_session
|
|
|
|
#define headerfile_winix_core_session
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2011-06-24 22:53:21 +02:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2008-12-10 05:42:49 +01:00
|
|
|
#include <ctime>
|
2009-04-21 22:50:55 +02:00
|
|
|
#include "item.h"
|
|
|
|
#include "error.h"
|
2008-12-21 22:17:09 +01:00
|
|
|
#include "user.h"
|
2010-05-04 23:58:22 +02:00
|
|
|
#include "plugindata.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "rebus.h"
|
2011-06-19 22:59:58 +02:00
|
|
|
#include "textstream.h"
|
2012-05-24 23:09:37 +02:00
|
|
|
#include "date/date.h"
|
2012-10-27 09:44:26 +02:00
|
|
|
#include "ipban.h"
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
namespace Winix
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2012-03-17 06:11:23 +01:00
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
struct Session
|
|
|
|
{
|
2012-03-17 06:11:23 +01:00
|
|
|
Session();
|
|
|
|
Session(const Session & ses);
|
|
|
|
Session & operator=(const Session & ses);
|
|
|
|
|
2012-05-24 23:09:37 +02:00
|
|
|
void SetTimesTo(time_t time);
|
2012-03-17 06:11:23 +01:00
|
|
|
void Clear(bool clear_plugin_data = true);
|
2013-12-04 02:21:57 +01:00
|
|
|
void ClearAfterRequest();
|
2012-03-17 06:11:23 +01:00
|
|
|
|
|
|
|
|
2010-12-07 18:41:28 +01:00
|
|
|
// 0 - means that there is a temporary session
|
2008-12-30 02:05:03 +01:00
|
|
|
long id;
|
2008-12-21 22:17:09 +01:00
|
|
|
|
2009-11-21 00:09:52 +01:00
|
|
|
// true if the session was created now
|
|
|
|
bool new_session;
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
// when this session was created
|
2009-01-31 07:53:36 +01:00
|
|
|
// (the same values)
|
2012-05-24 23:09:37 +02:00
|
|
|
time_t start_time;
|
|
|
|
PT::Date start_date;
|
2009-01-31 07:53:36 +01:00
|
|
|
|
|
|
|
// when this session was last used
|
|
|
|
// (the same values)
|
2012-05-24 23:09:37 +02:00
|
|
|
time_t last_time;
|
|
|
|
PT::Date last_date;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-12-09 01:42:40 +01:00
|
|
|
// when there was a last get request
|
2012-10-27 09:44:26 +02:00
|
|
|
// (used to calculate spam or invalid login attempts etc.)
|
2009-12-09 01:42:40 +01:00
|
|
|
time_t last_time_get;
|
2009-01-31 07:53:36 +01:00
|
|
|
|
2012-05-24 23:09:37 +02:00
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
// 0 - means that nobody is logged
|
2008-12-21 22:17:09 +01:00
|
|
|
User * puser;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-11-21 00:09:52 +01:00
|
|
|
// if false the session will end when the user browser is shutdown
|
|
|
|
bool remember_me;
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-11-21 00:09:52 +01:00
|
|
|
// rebus - set by rebus_question(Info & i) from templates
|
2009-11-17 00:36:38 +01:00
|
|
|
Rebus::Item * rebus_item;
|
2009-12-09 01:42:40 +01:00
|
|
|
bool rebus_checked;
|
2009-11-17 00:36:38 +01:00
|
|
|
|
2009-12-09 01:42:40 +01:00
|
|
|
|
|
|
|
int spam_score;
|
|
|
|
|
2012-03-09 03:36:25 +01:00
|
|
|
// if true then this session will be removed by SessionManager
|
|
|
|
// without checking the time expiration
|
|
|
|
bool remove_me;
|
2010-05-04 23:58:22 +02:00
|
|
|
|
|
|
|
PluginData plugin_data;
|
|
|
|
|
2010-12-07 18:41:28 +01:00
|
|
|
|
2011-06-19 22:59:58 +02:00
|
|
|
// buffer for the session log
|
|
|
|
TextStream<std::wstring> log_buffer;
|
2010-12-07 18:41:28 +01:00
|
|
|
|
2012-10-17 08:00:00 +02:00
|
|
|
// !! IMPROVE ME it is still needed?
|
|
|
|
// css cannot be taken directly from the mountpoint?
|
2011-06-24 22:53:21 +02:00
|
|
|
// table with css files
|
|
|
|
// used by some javascript wysiwyg editors (ckeditor, tinymce)
|
|
|
|
std::vector<std::wstring> last_css;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2012-10-27 09:44:26 +02:00
|
|
|
// pointer to IPBan struct if exists for this IP
|
|
|
|
// many sessions can pointer to the same IPBan struct
|
|
|
|
// (it can be null)
|
|
|
|
IPBan * ip_ban;
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
} // namespace Winix
|
|
|
|
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|