2010-10-24 01:12:47 +02:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2012-02-17 06:19:24 +01:00
|
|
|
* Copyright (c) 2010-2012, Tomasz Sowa
|
2010-10-24 01:12:47 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "item.h"
|
|
|
|
#include "misc.h"
|
2011-06-24 22:53:21 +02:00
|
|
|
#include "crypt.h"
|
2010-10-24 01:12:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Item::Item()
|
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-17 06:19:24 +01:00
|
|
|
// !! IMPROVE ME
|
2012-05-27 20:11:34 +02:00
|
|
|
// now we have Request::start_time and Request::start_date
|
2012-02-17 06:19:24 +01:00
|
|
|
// we can somehow get the current time from the request
|
|
|
|
// may setting the date should be completetly removed from here?
|
2010-10-24 01:12:47 +02:00
|
|
|
void Item::SetDateToNow()
|
|
|
|
{
|
2012-05-27 01:04:49 +02:00
|
|
|
date_creation = std::time(0);
|
2010-10-24 01:12:47 +02:00
|
|
|
date_modification = date_creation;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Item::SetDateModifyToNow()
|
|
|
|
{
|
2012-05-27 01:04:49 +02:00
|
|
|
date_modification = std::time(0);
|
2010-10-24 01:12:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Item::Clear()
|
|
|
|
{
|
|
|
|
id = -1;
|
|
|
|
|
|
|
|
user_id = -1;
|
|
|
|
group_id = -1;
|
|
|
|
privileges = 0;
|
|
|
|
modification_user_id = -1;
|
|
|
|
|
|
|
|
guest_name.clear();
|
|
|
|
|
|
|
|
subject.clear();
|
|
|
|
content.clear();
|
2011-01-05 22:24:11 +01:00
|
|
|
modify_index = 0;
|
2010-10-24 01:12:47 +02:00
|
|
|
url.clear();
|
|
|
|
|
|
|
|
content_type = ct_formatted_text;
|
|
|
|
|
|
|
|
type = none;
|
|
|
|
parent_id = -1;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
|
|
|
link_to.clear();
|
|
|
|
link_redirect = false;
|
2010-10-24 01:12:47 +02:00
|
|
|
|
|
|
|
content_id = -1;
|
2011-01-05 22:24:11 +01:00
|
|
|
ref = 1;
|
2010-10-24 01:12:47 +02:00
|
|
|
|
2010-12-10 22:07:01 +01:00
|
|
|
file_path.clear();
|
|
|
|
file_fs = -1;
|
|
|
|
file_type = WINIX_ITEM_FILETYPE_NONE;
|
2011-06-24 22:53:21 +02:00
|
|
|
hash.clear();
|
|
|
|
hash_type = WINIX_CRYPT_HASH_NONE;
|
|
|
|
file_size = 0;
|
2010-12-11 23:55:48 +01:00
|
|
|
has_thumb = false;
|
|
|
|
|
2010-10-24 01:12:47 +02:00
|
|
|
html_template.clear();
|
2011-06-24 22:53:21 +02:00
|
|
|
sort_index = 0;
|
2011-11-25 05:51:55 +01:00
|
|
|
meta.Clear();
|
2012-11-04 22:01:02 +01:00
|
|
|
ameta.Clear();
|
2010-10-24 01:12:47 +02:00
|
|
|
|
|
|
|
SetDateToNow();
|
|
|
|
}
|
2010-12-10 22:07:01 +01:00
|
|
|
|
|
|
|
|