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
|
|
|
|
*
|
2010-02-28 22:33:06 +01:00
|
|
|
* Copyright (c) 2008-2010, 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_item
|
|
|
|
#define headerfile_winix_core_item
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
2010-12-10 22:07:01 +01:00
|
|
|
#define WINIX_ITEM_FILETYPE_NONE 0
|
|
|
|
#define WINIX_ITEM_FILETYPE_IMAGE 1
|
|
|
|
#define WINIX_ITEM_FILETYPE_DOCUMENT 2
|
|
|
|
#define WINIX_ITEM_FILETYPE_UNKNOWN 3
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
|
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
struct Item
|
|
|
|
{
|
|
|
|
long id;
|
2010-02-22 23:52:09 +01:00
|
|
|
long parent_id;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2008-12-14 06:28:28 +01:00
|
|
|
|
|
|
|
long user_id;
|
|
|
|
long group_id;
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring guest_name; // used as a user name when user_id is equal -1
|
2008-12-14 06:28:28 +01:00
|
|
|
|
2010-06-22 23:09:37 +02:00
|
|
|
long modification_user_id; // who has modified the item last (not taken into account when checking permissions)
|
|
|
|
|
2010-02-22 23:52:09 +01:00
|
|
|
int privileges;
|
2009-06-07 04:40:27 +02:00
|
|
|
|
2009-03-23 00:54:15 +01:00
|
|
|
tm date_creation;
|
|
|
|
tm date_modification;
|
2008-12-14 06:28:28 +01:00
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring subject;
|
|
|
|
std::wstring content;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring url;
|
2011-01-05 22:24:11 +01:00
|
|
|
int modify_index;
|
2008-12-14 06:28:28 +01:00
|
|
|
|
2010-01-11 15:47:52 +01:00
|
|
|
enum ContentType
|
|
|
|
{
|
|
|
|
ct_text = 0,
|
|
|
|
ct_formatted_text,
|
|
|
|
ct_html,
|
|
|
|
ct_bbcode,
|
|
|
|
ct_raw
|
|
|
|
};
|
2008-12-14 06:28:28 +01:00
|
|
|
|
2010-01-11 15:47:52 +01:00
|
|
|
ContentType content_type;
|
2008-12-14 06:28:28 +01:00
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2009-06-05 22:29:06 +02:00
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
dir = 0,
|
|
|
|
file = 1,
|
2011-01-05 22:24:11 +01:00
|
|
|
symlink = 2,
|
2009-06-05 22:29:06 +02:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
none = 1000
|
2008-12-10 05:42:49 +01:00
|
|
|
};
|
|
|
|
|
2009-06-05 22:29:06 +02:00
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
Type type;
|
|
|
|
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
// used when type is symlink or to a directory too (function 'default')
|
|
|
|
std::wstring link_to;
|
|
|
|
int link_redirect;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
|
2010-12-10 22:07:01 +01:00
|
|
|
// static file (if exists)
|
|
|
|
std::wstring file_path; // relative file path
|
|
|
|
int file_fs; // file system type where the file was saved
|
|
|
|
int file_type; // file type (none, image, doc, etc)
|
2010-12-11 23:55:48 +01:00
|
|
|
bool has_thumb;
|
2010-02-22 23:52:09 +01:00
|
|
|
|
2009-12-30 21:46:12 +01:00
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring html_template;
|
2010-08-13 22:04:57 +02:00
|
|
|
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2010-10-24 01:12:47 +02:00
|
|
|
// methods
|
|
|
|
Item();
|
|
|
|
void SetDateToNow();
|
|
|
|
void SetDateModifyToNow();
|
|
|
|
void Clear();
|
2008-12-10 05:42:49 +01:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// used by the database
|
|
|
|
long content_id; // content id in 'content' table
|
|
|
|
int ref; // content references
|
|
|
|
|
|
|
|
friend class Db;
|
|
|
|
friend class DbItemColumns;
|
2008-12-10 05:42:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|