Item class has been moved to a new directory 'models', a new class has been added: ItemContent
and same fields from Item were moved to ItemContent Item - id - parent_id - type (file, dir, symlink) - url - subject - template (html template) - sort_index - content_id ItemContent - id - ref -> references (renamed) - user_id - modification_user_id - group_id - privileges - date_creation - date_modification - guest_name - link_to - link_redirect - file_path - file_fs - file_type - file_size - has_thumb -> file_has_thumb (renamed) - hash -> file_hash (renamed) - hash_type -> file_hash_type (renamed) - content -> content_raw (renamed) - content_type -> content_raw_type (renamed) - content_parsed - content_parsed_type - meta - ameta -> meta_admin (renamed) - modify_index (removed) WIP: #4master
parent
3d7ece15f8
commit
32e93a04c5
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
o = acceptbaseparser.o app.o basethread.o bbcodeparser.o compress.o config.o crypt.o dircontainer.o dirs.o filelog.o groups.o htmlfilter.o httpsimpleparser.o image.o ipbancontainer.o item.o job.o lastcontainer.o loadavg.o lock.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionidmanager.o sessionmanager.o sessionparser.o slog.o synchro.o system.o threadmanager.o timezone.o timezones.o user.o users.o winixbase.o winixmodel.o winixrequest.o winixsystem.o
|
||||
o = acceptbaseparser.o app.o basethread.o bbcodeparser.o compress.o config.o crypt.o dircontainer.o dirs.o filelog.o groups.o htmlfilter.o httpsimpleparser.o image.o ipbancontainer.o job.o lastcontainer.o loadavg.o lock.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionidmanager.o sessionmanager.o sessionparser.o slog.o synchro.o system.o threadmanager.o timezone.o timezones.o user.o users.o winixbase.o winixmodel.o winixrequest.o winixsystem.o
|
@ -1,156 +0,0 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is distributed under the 2-Clause BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2016, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winix_core_item
|
||||
#define headerfile_winix_core_item
|
||||
|
||||
#include <string>
|
||||
#include "space/space.h"
|
||||
#include "date/date.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
|
||||
#define WINIX_ITEM_FILETYPE_NONE 0
|
||||
#define WINIX_ITEM_FILETYPE_IMAGE 1
|
||||
#define WINIX_ITEM_FILETYPE_DOCUMENT 2
|
||||
#define WINIX_ITEM_FILETYPE_VIDEO 3
|
||||
#define WINIX_ITEM_FILETYPE_UNKNOWN 10
|
||||
|
||||
|
||||
|
||||
|
||||
struct Item
|
||||
{
|
||||
long id;
|
||||
long parent_id;
|
||||
|
||||
|
||||
long user_id;
|
||||
long group_id;
|
||||
std::wstring guest_name; // used as a user name when user_id is equal -1
|
||||
|
||||
long modification_user_id; // who has modified the item last (not taken into account when checking permissions)
|
||||
|
||||
int privileges;
|
||||
|
||||
PT::Date date_creation;
|
||||
PT::Date date_modification;
|
||||
|
||||
std::wstring subject;
|
||||
std::wstring content;
|
||||
|
||||
std::wstring url;
|
||||
int modify_index;
|
||||
|
||||
enum ContentType
|
||||
{
|
||||
ct_text = 0,
|
||||
ct_formatted_text,
|
||||
ct_html,
|
||||
ct_bbcode,
|
||||
ct_other, // no auto-formatting is applied
|
||||
};
|
||||
|
||||
ContentType content_type;
|
||||
|
||||
|
||||
|
||||
enum Type
|
||||
{
|
||||
dir = 0,
|
||||
file = 1,
|
||||
symlink = 2,
|
||||
|
||||
none = 1000
|
||||
};
|
||||
|
||||
|
||||
Type type;
|
||||
|
||||
|
||||
// used when type is symlink or to a directory too (function 'default')
|
||||
std::wstring link_to;
|
||||
int link_redirect; // !! IMPROVE ME should it be 'bool'?
|
||||
|
||||
|
||||
// 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)
|
||||
bool has_thumb; // whether or not we have a thumbnail
|
||||
std::wstring hash; // file hash (md4, md5, ...)
|
||||
int hash_type; // hash type WINIX_CRYPT_HASH_* (see crypt.h)
|
||||
size_t file_size; // size of the file
|
||||
|
||||
std::wstring html_template;
|
||||
|
||||
|
||||
// sort index used when displaying a group of items
|
||||
int sort_index;
|
||||
|
||||
|
||||
// meta information
|
||||
PT::Space meta;
|
||||
PT::Space ameta;
|
||||
|
||||
|
||||
// methods
|
||||
Item();
|
||||
void SetDateToNow();
|
||||
void SetDateModifyToNow();
|
||||
void Clear();
|
||||
|
||||
|
||||
static bool CanContentBeHtmlFiltered(Item::ContentType ct);
|
||||
bool CanContentBeHtmlFiltered();
|
||||
|
||||
|
||||
private:
|
||||
// used by the database
|
||||
long content_id; // content id in 'content' table
|
||||
int ref; // content references
|
||||
|
||||
friend class Db;
|
||||
friend struct DbItemColumns;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
||||
|
||||
#endif
|