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
|
|
|
|
*
|
2012-03-09 03:36:25 +01:00
|
|
|
* Copyright (c) 2008-2012, Tomasz Sowa
|
2008-12-10 05:42:49 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "session.h"
|
2010-10-24 01:12:47 +02:00
|
|
|
#include "misc.h"
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-04-21 22:50:55 +02:00
|
|
|
|
2010-05-04 23:58:22 +02:00
|
|
|
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
Session::Session()
|
|
|
|
{
|
|
|
|
Clear();
|
2012-03-17 06:11:23 +01:00
|
|
|
plugin_data.SetSession(this);
|
2011-02-18 10:33:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 06:11:23 +01:00
|
|
|
|
|
|
|
Session::Session(const Session & ses)
|
|
|
|
{
|
|
|
|
operator=(ses);
|
|
|
|
}
|
|
|
|
|
|
|
|
Session & Session::operator=(const Session & ses)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
we can only copy ses.id because it is needen in SessionContainer
|
|
|
|
it have indexes to id
|
|
|
|
*/
|
|
|
|
|
|
|
|
Clear();
|
|
|
|
id = ses.id;
|
|
|
|
plugin_data.SetSession(this);
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-24 23:09:37 +02:00
|
|
|
void Session::SetTimesTo(time_t time)
|
2011-02-18 10:33:15 +01:00
|
|
|
{
|
2012-05-24 23:09:37 +02:00
|
|
|
start_time = time;
|
|
|
|
start_date = time;
|
2009-12-09 01:42:40 +01:00
|
|
|
|
2012-05-24 23:09:37 +02:00
|
|
|
last_time = start_time;
|
|
|
|
last_date = start_date;
|
|
|
|
|
2009-12-09 01:42:40 +01:00
|
|
|
// the first request can be a POST (it doesn't matter)
|
2012-05-24 23:09:37 +02:00
|
|
|
last_time_get = start_time;
|
2008-12-10 05:42:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-24 23:09:37 +02:00
|
|
|
|
|
|
|
// clear_plugin_data is used when clearing the temporary session
|
2012-03-17 06:11:23 +01:00
|
|
|
void Session::Clear(bool clear_plugin_data)
|
2008-12-10 05:42:49 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
id = 0;
|
|
|
|
puser = 0;
|
|
|
|
rebus_item = 0;
|
2009-12-09 01:42:40 +01:00
|
|
|
rebus_checked = false;
|
2011-01-23 15:15:30 +01:00
|
|
|
remember_me = false;
|
|
|
|
new_session = true;
|
|
|
|
spam_score = 0;
|
2012-03-09 03:36:25 +01:00
|
|
|
remove_me = false;
|
2012-03-17 06:11:23 +01:00
|
|
|
|
2012-05-24 23:09:37 +02:00
|
|
|
start_time = 0;
|
|
|
|
last_time = 0;
|
|
|
|
last_time_get = 0;
|
|
|
|
start_date.Clear();
|
|
|
|
last_date.Clear();
|
|
|
|
|
|
|
|
log_buffer.Clear();
|
|
|
|
last_css.clear();
|
|
|
|
|
2012-03-17 06:11:23 +01:00
|
|
|
if( clear_plugin_data )
|
|
|
|
plugin_data.Resize(0);
|
2008-12-10 05:42:49 +01:00
|
|
|
}
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
|