143 lines
1.6 KiB
C++
Executable File
143 lines
1.6 KiB
C++
Executable File
/*
|
|
* This file is a part of CMSLU -- Content Management System like Unix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2009, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfilecmslucoreitem
|
|
#define headerfilecmslucoreitem
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
struct Item
|
|
{
|
|
long id;
|
|
|
|
|
|
long user_id;
|
|
long group_id;
|
|
int privileges;
|
|
|
|
// used as a user name when user_id is equal -1
|
|
std::string guest_name;
|
|
|
|
tm date_creation;
|
|
tm date_modification;
|
|
|
|
std::string subject;
|
|
std::string content;
|
|
std::string url;
|
|
|
|
enum ContentType
|
|
{
|
|
ct_text = 0,
|
|
ct_formatted_text,
|
|
ct_html,
|
|
ct_bbcode,
|
|
ct_raw
|
|
};
|
|
|
|
ContentType content_type;
|
|
|
|
|
|
|
|
enum Type
|
|
{
|
|
dir = 0,
|
|
file = 1,
|
|
|
|
none = 1000
|
|
};
|
|
|
|
|
|
Type type;
|
|
|
|
//item_type;
|
|
|
|
long parent_id;
|
|
long default_item;
|
|
|
|
|
|
// used by the database
|
|
// !! moze da sie w ogole z tego zrezygnowac?
|
|
long content_id;
|
|
|
|
|
|
// external static file (saved in file system)
|
|
// the direct url is the same but the prefix is: base_url_static_auth
|
|
enum StaticAuth
|
|
{
|
|
static_none = 0,
|
|
static_image = 1,
|
|
static_other = 2
|
|
};
|
|
|
|
|
|
StaticAuth static_auth;
|
|
|
|
|
|
Item()
|
|
{
|
|
Clear();
|
|
}
|
|
|
|
|
|
void SetDateToNow()
|
|
{
|
|
time_t t = std::time(0);
|
|
date_creation = *std::localtime( &t );
|
|
date_modification = date_creation;
|
|
}
|
|
|
|
|
|
void SetDateModifyToNow()
|
|
{
|
|
time_t t = std::time(0);
|
|
date_modification = *std::localtime( &t );
|
|
}
|
|
|
|
|
|
void Clear()
|
|
{
|
|
id = -1;
|
|
|
|
user_id = -1;
|
|
group_id = -1;
|
|
privileges = 0;
|
|
|
|
guest_name.clear();
|
|
|
|
subject.clear();
|
|
content.clear();
|
|
url.clear();
|
|
|
|
content_type = ct_formatted_text;
|
|
|
|
type = none;
|
|
parent_id = -1;
|
|
default_item = -1;
|
|
|
|
content_id = -1;
|
|
|
|
static_auth = static_none;
|
|
|
|
SetDateToNow();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|