renamed: WinixModel -> WinixModelDeprecated (this class will be removed)

added: WinixModel (models/winixmodel.h|cpp) - a class inheriting from morm::WinixModel, we have methods such as: get_config(), get_logger(), get_request()
       and this class will be a base class for our models
added: WinixModelConnector (models/winixmodelconnector.h|cpp) - a class inheriting from morm::WinixModelConnector
       this connector we are using instead of morm::ModelConnector - there are pointers to winix objects there (config, request, log)
added to Request: Ezc::Models models
removed from TemplatesFunctions: Ezc::Models ezc_models;
changed: ImgCrop winix functions is using its own item_tab vector now (not finished yet)
added: Item::is(), Item::link(), ItemContent::print_content()
This commit is contained in:
Tomasz Sowa 2021-06-16 18:07:44 +02:00
parent 9688b1a26a
commit 6dddc5e948
63 changed files with 654 additions and 225 deletions

View File

@ -328,6 +328,9 @@ bool App::Init()
model_connector.set_flat_connector(json_connector);
model_connector.set_db_connector(postgresql_connector);
model_connector.set_logger(log);
model_connector.set_winix_config(&config);
model_connector.set_winix_request(&req);
model_connector.set_winix_logger(&log);
if( !TryToMakeDatabaseMigration() )
return false;

View File

@ -54,18 +54,16 @@
#include "cookieparser.h"
#include "postmultiparser.h"
#include "acceptencodingparser.h"
#include "winixrequest.h"
#include "log/log.h"
#include "filelog.h"
#include "models/winixmodelconnector.h"
namespace Winix
{
class App
{
public:
@ -166,13 +164,13 @@ private:
std::string http_header_8bit;
std::wstring empty_response;
morm::ModelConnector model_connector; // main thread model connector, each thread has its own connector
WinixModelConnector model_connector; // main thread model connector, each thread has its own connector
morm::JSONConnector json_connector;
morm::PostgreSQLConnector postgresql_connector;
// objects for main thread
WinixBase winix_base;
WinixModel winix_model;
WinixModelDeprecated winix_model;
WinixSystem winix_system;
WinixRequest winix_request;
// ///////////////////////
@ -184,10 +182,10 @@ private:
// log_buffer for the main thread
pt::WTextStream log_buffer;
// logger only for App object
// logger only for the main thread
Log log;
// file logger, one object for every Log objects
// file logger, one object for all Log objects
FileLog file_log;
bool InitFCGI(char * sock, char * sock_user, char * sock_group);

View File

@ -37,7 +37,7 @@
#include <pthread.h>
#include "synchro.h"
#include "winixmodel.h"
#include "winixmodeldeprecated.h"
@ -47,7 +47,7 @@ namespace Winix
class BaseThread : public WinixModel
class BaseThread : public WinixModelDeprecated
{
public:

View File

@ -61,9 +61,9 @@ void Dirs::SetNotify(Notify * pnotify)
}
void Dirs::set_dependency(WinixModel * winix_model)
void Dirs::set_dependency(WinixModelDeprecated * winix_model)
{
WinixModel::set_dependency(winix_model);
WinixModelDeprecated::set_dependency(winix_model);
dir_tab.set_dependency(winix_model);
}

View File

@ -42,8 +42,8 @@
#include "dircontainer.h"
#include "db/db.h"
#include "request.h"
#include "winixmodel.h"
#include "models/item.h"
#include "winixmodeldeprecated.h"
@ -57,7 +57,7 @@ class Notify;
// (we will support '..' in the future)
class Dirs : public WinixModel
class Dirs : public WinixModelDeprecated
{
public:
@ -68,7 +68,7 @@ public:
void SetDb(Db * pdb);
void SetNotify(Notify * pnotify);
void set_dependency(WinixModel * winix_model);
void set_dependency(WinixModelDeprecated * winix_model);
// these methods return false if there is no such a dir
bool IsDir(long dir_id);

View File

@ -46,9 +46,9 @@ Groups::Groups()
}
void Groups::set_dependency(WinixModel * winix_model)
void Groups::set_dependency(WinixModelDeprecated * winix_model)
{
WinixModel::set_dependency(winix_model);
WinixModelDeprecated::set_dependency(winix_model);
table.set_dependency(winix_model);
}

View File

@ -40,7 +40,7 @@
#include "models/group.h"
#include "ugcontainer.h"
#include "db/db.h"
#include "winixmodel.h"
#include "winixmodeldeprecated.h"
@ -49,7 +49,7 @@ namespace Winix
class Groups : public WinixModel
class Groups : public WinixModelDeprecated
{
typedef UGContainer<Group> Table;
@ -57,7 +57,7 @@ Table table;
public:
void set_dependency(WinixModel * winix_model);
void set_dependency(WinixModelDeprecated * winix_model);
typedef Table::Iterator Iterator;
typedef Table::SizeType SizeType;

View File

@ -36,7 +36,8 @@
#define headerfile_winix_core_httpsimpleparser
#include <string>
#include "winixmodel.h"
#include "winixmodeldeprecated.h"
namespace Winix
@ -44,7 +45,7 @@ namespace Winix
class HttpSimpleParser : public WinixModel
class HttpSimpleParser : public WinixModelDeprecated
{
protected:

View File

@ -37,7 +37,7 @@
#include <vector>
#include "ipban.h"
#include "winixmodel.h"
#include "winixmodeldeprecated.h"
@ -46,7 +46,7 @@ namespace Winix
class IPBanContainer : public WinixModel
class IPBanContainer : public WinixModelDeprecated
{
public:

View File

@ -42,8 +42,8 @@
#include <limits.h>
#include "mount.h"
#include "dirs.h"
#include "winixmodel.h"
#include "models/item.h"
#include "winixmodeldeprecated.h"
@ -52,7 +52,7 @@ namespace Winix
class MountParser : public WinixModel
class MountParser : public WinixModelDeprecated
{
public:

View File

@ -46,7 +46,7 @@
#include "db/db.h"
#include "request.h"
#include "mountparser.h"
#include "winixmodel.h"
#include "winixmodeldeprecated.h"
namespace Winix
@ -55,7 +55,7 @@ namespace Winix
class Mounts : public WinixModel
class Mounts : public WinixModelDeprecated
{
public:

View File

@ -66,7 +66,7 @@ void PluginInfo::set_dependency_for(WinixBase & winix_base)
set_dependency_for(&winix_base);
}
void PluginInfo::set_dependency_for(WinixModel * winix_model)
void PluginInfo::set_dependency_for(WinixModelDeprecated * winix_model)
{
plugin->SetDependencyFor(winix_model);
@ -74,7 +74,7 @@ void PluginInfo::set_dependency_for(WinixModel * winix_model)
// CHECKME what about model_connector here?
}
void PluginInfo::set_dependency_for(WinixModel & winix_model)
void PluginInfo::set_dependency_for(WinixModelDeprecated & winix_model)
{
set_dependency_for(&winix_model);
}
@ -232,7 +232,7 @@ void Plugin::SetDependencyFor(WinixBase * winix_base)
}
void Plugin::SetDependencyFor(WinixModel * winix_model)
void Plugin::SetDependencyFor(WinixModelDeprecated * winix_model)
{
winix_model->set_dependency(winix_request);
}

View File

@ -54,7 +54,7 @@ class Functions;
class Templates;
class SessionManager;
class WinixModel;
class WinixModelDeprecated;
class WinixRequest;
@ -81,7 +81,7 @@ struct Session;
// move me to a different file
// may it should be based on WinixModel?
// may it should be based on WinixModelDeprecated?
struct PluginInfo
{
// these variables are used for some purposes
@ -134,8 +134,8 @@ struct PluginInfo
void set_dependency_for(WinixBase * winix_base);
void set_dependency_for(WinixBase & winix_base);
void set_dependency_for(WinixModel * winix_model);
void set_dependency_for(WinixModel & winix_model);
void set_dependency_for(WinixModelDeprecated * winix_model);
void set_dependency_for(WinixModelDeprecated & winix_model);
void Clear()
{
@ -291,7 +291,7 @@ private:
bool SetDependency(PluginInfo & info);
void SetDependencyFor(WinixBase * winix_base);
void SetDependencyFor(WinixModel * winix_model);
void SetDependencyFor(WinixModelDeprecated * winix_model);
void Lock();
void Unlock();

View File

@ -143,6 +143,7 @@ void Request::Clear()
return_info_only = false;
info.clear();
return_json = false;
models.Clear();
out_bin_stream.clear();
send_bin_stream = false;

View File

@ -48,6 +48,7 @@
#include "space/space.h"
#include "textstream/textstream.h"
#include "outstreams.h"
#include "models.h"
namespace Winix
@ -309,7 +310,8 @@ struct Request
// additional info added when sending the JSON answer
pt::Space info;
// models to return or to render through ezc library
Ezc::Models models;
// if set to true then the standard template system will not be used

View File

@ -42,7 +42,7 @@
#include "session.h"
#include "cur.h"
#include "config.h"
#include "winixmodel.h"
#include "winixmodeldeprecated.h"
@ -52,7 +52,7 @@ namespace Winix
class SessionContainer : public WinixModel
class SessionContainer : public WinixModelDeprecated
{
public:

View File

@ -89,9 +89,9 @@ void SessionManager::SetLastContainer(LastContainer * plast_container)
}
void SessionManager::set_dependency(WinixModel * winix_model)
void SessionManager::set_dependency(WinixModelDeprecated * winix_model)
{
WinixModel::set_dependency(winix_model);
WinixModelDeprecated::set_dependency(winix_model);
session_tab.set_dependency(winix_model);
session_id_manager.set_dependency(winix_model);
}

View File

@ -65,7 +65,7 @@ public:
void SetSystem(System * psystem);
void SetLastContainer(LastContainer * plast_container);
void set_dependency(WinixModel * winix_model);
void set_dependency(WinixModelDeprecated * winix_model);
// can return a null pointer
Session * FindSession(long id);

View File

@ -81,9 +81,9 @@ void System::SetSessionManager(SessionManager * sm)
}
void System::set_dependency(WinixModel * winix_model)
void System::set_dependency(WinixModelDeprecated * winix_model)
{
WinixModel::set_dependency(winix_model);
WinixModelDeprecated::set_dependency(winix_model);
dirs.set_dependency(this);
mounts.set_dependency(this);

View File

@ -64,7 +64,7 @@ class SessionManager;
// file system
class System : WinixModel
class System : WinixModelDeprecated
{
public:
@ -109,7 +109,7 @@ public:
TimeZones time_zones;
using WinixModel::get_model_connector;
using WinixModelDeprecated::get_model_connector;
void SetCur(Cur * pcur);
//void SetConfig(Config * pconfig);
@ -118,7 +118,7 @@ public:
void SetFunctions(Functions * pfunctions);
void SetSessionManager(SessionManager * sm);
void set_dependency(WinixModel * winix_model);
void set_dependency(WinixModelDeprecated * winix_model);
void Init();

View File

@ -74,12 +74,20 @@ public:
typedef typename StringType::value_type CharType;
typedef typename StringType::value_type char_type;
typedef typename StringType::iterator iterator;
typedef typename StringType::const_iterator const_iterator;
void Clear();
void clear(); // utf8 methods call clear(), in the future Clear() will be renamed to clear()
bool Empty() const;
size_t Size() const;
void Reserve(size_t len);
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
const StringType & Str() const;
const CharType * CStr() const;
@ -149,6 +157,12 @@ void TextStream<StringType>::Clear()
buffer.clear();
}
template<class StringType>
void TextStream<StringType>::clear()
{
Clear();
}
template<class StringType>
bool TextStream<StringType>::Empty() const
{
@ -168,6 +182,33 @@ void TextStream<StringType>::Reserve(size_t len)
}
template<class StringType>
TextStream<StringType>::iterator TextStream<StringType>::begin()
{
return buffer.begin();
}
template<class StringType>
TextStream<StringType>::iterator TextStream<StringType>::end()
{
return buffer.end();
}
template<class StringType>
TextStream<StringType>::const_iterator TextStream<StringType>::begin() const
{
return buffer.begin();
}
template<class StringType>
TextStream<StringType>::const_iterator TextStream<StringType>::end() const
{
return buffer.end();
}
template<class StringType>
const StringType & TextStream<StringType>::Str() const
{

View File

@ -95,6 +95,10 @@ void ThreadManager::Add(BaseThread * pbase, const wchar_t * thread_name)
data.postgresql_connector.wait_for_connection();
data.model_connector.set_db_connector(data.postgresql_connector);
data.model_connector.set_flat_connector(data.json_connector);
data.model_connector.set_winix_config(config);
data.model_connector.set_winix_logger(item.object->get_logger());
data.model_connector.set_logger(item.object->get_logger());
//data.model_connector.set_winix_request();
item.object->set_model_connector(&data.model_connector);

View File

@ -40,15 +40,14 @@
#include "basethread.h"
#include "synchro.h"
#include "textstream/textstream.h"
#include "models/winixmodelconnector.h"
namespace Winix
{
class ThreadManager : public WinixModel
class ThreadManager : public WinixModelDeprecated
{
public:
@ -76,7 +75,7 @@ private:
struct ThreadItemData
{
morm::ModelConnector model_connector;
WinixModelConnector model_connector;
morm::JSONConnector json_connector;
morm::PostgreSQLConnector postgresql_connector;

View File

@ -50,9 +50,9 @@ Users::Users()
}
void Users::set_dependency(WinixModel * winix_model)
void Users::set_dependency(WinixModelDeprecated * winix_model)
{
WinixModel::set_dependency(winix_model);
WinixModelDeprecated::set_dependency(winix_model);
table.set_dependency(winix_model);
last.set_dependency(winix_model);
}

View File

@ -41,7 +41,7 @@
#include "lastcontainer.h"
#include "cur.h"
#include "db/db.h"
#include "winixmodel.h"
#include "winixmodeldeprecated.h"
@ -53,13 +53,13 @@ namespace Winix
class SessionManager;
class Users : public WinixModel
class Users : public WinixModelDeprecated
{
typedef UGContainer<User> Table;
public:
void set_dependency(WinixModel * winix_model);
void set_dependency(WinixModelDeprecated * winix_model);
typedef Table::Iterator Iterator;

View File

@ -32,7 +32,7 @@
*
*/
#include "winixmodel.h"
#include "winixmodeldeprecated.h"
namespace Winix
@ -40,44 +40,44 @@ namespace Winix
WinixModel::WinixModel()
WinixModelDeprecated::WinixModelDeprecated()
{
plugin = nullptr;
model_connector = nullptr;
}
WinixModel::~WinixModel()
WinixModelDeprecated::~WinixModelDeprecated()
{
}
void WinixModel::set_plugin(Plugin * plugin)
void WinixModelDeprecated::set_plugin(Plugin * plugin)
{
this->plugin = plugin;
}
void WinixModel::set_model_connector(morm::ModelConnector * model_connector)
void WinixModelDeprecated::set_model_connector(morm::ModelConnector * model_connector)
{
this->model_connector = model_connector;
}
morm::ModelConnector * WinixModel::get_model_connector()
morm::ModelConnector * WinixModelDeprecated::get_model_connector()
{
return model_connector;
}
void WinixModel::set_dependency(WinixBase * winix_base)
void WinixModelDeprecated::set_dependency(WinixBase * winix_base)
{
WinixBase::set_dependency(winix_base);
}
void WinixModel::set_dependency(WinixModel * winix_model)
void WinixModelDeprecated::set_dependency(WinixModelDeprecated * winix_model)
{
WinixBase::set_dependency(winix_model);
model_connector = winix_model->model_connector;
@ -85,7 +85,7 @@ void WinixModel::set_dependency(WinixModel * winix_model)
}
Plugin * WinixModel::get_plugin()
Plugin * WinixModelDeprecated::get_plugin()
{
return plugin;
}

View File

@ -44,12 +44,12 @@ namespace Winix
{
// may rename it to WinixConnector or WinixStorage?
class WinixModel : public WinixBase
class WinixModelDeprecated : public WinixBase
{
public:
WinixModel();
virtual ~WinixModel();
WinixModelDeprecated();
virtual ~WinixModelDeprecated();
void set_model_connector(morm::ModelConnector * model_connector);
morm::ModelConnector * get_model_connector();
@ -57,7 +57,7 @@ public:
void set_plugin(Plugin * plugin);
void set_dependency(WinixBase * winix_base);
void set_dependency(WinixModel * winix_model);
void set_dependency(WinixModelDeprecated * winix_model);
// temporarily for templates, will be removed

View File

@ -79,9 +79,9 @@ void WinixRequest::set_dependency(WinixBase * winix_base)
}
void WinixRequest::set_dependency(WinixModel * winix_model)
void WinixRequest::set_dependency(WinixModelDeprecated * winix_model)
{
WinixModel::set_dependency(winix_model);
WinixModelDeprecated::set_dependency(winix_model);
}

View File

@ -59,7 +59,7 @@ public:
void set_dependency(WinixBase * winix_base);
void set_dependency(WinixModel * winix_model);
void set_dependency(WinixModelDeprecated * winix_model);
void set_dependency(WinixSystem * winix_system);
void set_dependency(WinixRequest * winix_request);

View File

@ -62,15 +62,15 @@ void WinixSystem::set_dependency(WinixBase * winix_base)
}
void WinixSystem::set_dependency(WinixModel * winix_model)
void WinixSystem::set_dependency(WinixModelDeprecated * winix_model)
{
WinixModel::set_dependency(winix_model);
WinixModelDeprecated::set_dependency(winix_model);
}
void WinixSystem::set_dependency(WinixSystem * winix_system)
{
WinixModel::set_dependency(winix_system);
WinixModelDeprecated::set_dependency(winix_system);
system = winix_system->system;
}

View File

@ -35,8 +35,8 @@
#ifndef headerfile_winix_core_winixsystem
#define headerfile_winix_core_winixsystem
#include "core/winixmodel.h"
#include "core/system.h"
#include "winixmodeldeprecated.h"
@ -44,7 +44,7 @@ namespace Winix
{
class WinixSystem : public WinixModel
class WinixSystem : public WinixModelDeprecated
{
public:
@ -54,7 +54,7 @@ public:
void set_system(System * system);
void set_dependency(WinixBase * winix_base);
void set_dependency(WinixModel * winix_model);
void set_dependency(WinixModelDeprecated * winix_model);
void set_dependency(WinixSystem * winix_system);

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2018, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -67,23 +67,7 @@ void Cat::MakeGet()
}
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
// temporary for tests
////////////////////////////////////////////////////////////
foo1.subject = L"subject <h2>from</h2> foo1";
foo2.subject = L"subject <strong>from</strong> foo2";
foo1.item_content.content_raw = L"raw content from foo1";
foo2.item_content.content_raw = L"raw content from foo2";
foo1.set_connector(model_connector);
foo2.set_connector(model_connector);
return_model(L"foo1", foo1);
return_model(L"foo2", foo2);
////////////////////////////////////////////////////////////
cur->request->models.Add(L"item", cur->request->item);
}

View File

@ -54,10 +54,6 @@ public:
void MakeGet();
private:
Item foo1;
Item foo2;
};

View File

@ -149,18 +149,6 @@ void FunctionBase::MakeDelete()
void FunctionBase::return_model(const wchar_t * name, morm::Model & model)
{
TemplatesFunctions::ezc_models.Add(name, model);
}
void FunctionBase::return_model(const wchar_t * name, morm::Model * model)
{
TemplatesFunctions::ezc_models.Add(name, model);
}
} // namespace Winix

View File

@ -102,9 +102,6 @@ public:
//void SetSessionManager(SessionManager * pmanager);
virtual void return_model(const wchar_t * name, morm::Model & model);
virtual void return_model(const wchar_t * name, morm::Model * model);
protected:
//Config * config;

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2018, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,10 +36,11 @@
#define headerfile_winix_functions_functionparser
#include <string>
#include "core/winixmodeldeprecated.h"
#include "db/db.h"
#include "core/cur.h"
#include "core/system.h"
#include "core/winixmodel.h"
namespace Winix
@ -49,7 +50,7 @@ namespace Winix
class Functions;
class FunctionParser : public WinixModel
class FunctionParser : public WinixModelDeprecated
{
public:

View File

@ -72,7 +72,7 @@ void ImgCrop::GetDirContent()
morm::Finder<Item> finder(model_connector);
cur->request->item_tab = finder.
item_tab = finder.
select().
where().
eq(L"type", static_cast<int>(Item::file)).
@ -81,7 +81,7 @@ void ImgCrop::GetDirContent()
get_vector();
//db->GetItems(cur->request->item_tab, iq);
system->CheckWriteAccessToItems(cur->request->item_tab);
system->CheckWriteAccessToItems(item_tab);
}
@ -137,7 +137,10 @@ void ImgCrop::MakePost()
void ImgCrop::MakeGet()
{
if( !cur->request->is_item )
{
GetDirContent();
cur->request->models.Add(L"item_tab", item_tab);
}
}

View File

@ -55,9 +55,11 @@ public:
void MakeGet();
void MakePost();
// IMPROVEME add method Clear() or ClearAfterRequest()? and clear item_tab
private:
//DbItemQuery iq;
std::vector<Item> item_tab;
void GetDirContent();

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2018, Tomasz Sowa
* Copyright (c) 2010-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -35,17 +35,17 @@
#ifndef headerfile_winix_functions_privchanger
#define headerfile_winix_functions_privchanger
#include "core/winixmodeldeprecated.h"
#include "core/request.h"
#include "core/system.h"
#include "db/db.h"
#include "core/winixmodel.h"
namespace Winix
{
class PrivChanger : public WinixModel
class PrivChanger : public WinixModelDeprecated
{
public:

View File

@ -1,4 +1,4 @@
[if item_content_type_is "other"][item_print_content][else]
[if item_content_type_is "other"][item.content.print_content][else]
[if false]
[if mount_page_arg_is "subject"][if mount_page_arg_is "info"]<h1 class="withinfo">[else]<h1>[end][item_subject]</h1>[end]
@ -18,7 +18,7 @@
</pre>
</div>
[item_print_content]
[item.content.print_content]
[else]
@ -30,10 +30,10 @@
</pre>
</div>
[item_print_content]
[item.content.print_content]
[else]
[item_print_content]
[item.content.print_content]
[end]
[end]

View File

@ -79,22 +79,22 @@
<tr>
<td data-uk-lightbox="animation: slide">
<a href="[item_tab_link]">
<img src="[item_tab_link][if item_tab_has_thumb]/-/thumb[end]" alt="[item_tab_subject]">
<a href="[item_tab.link]">
<img src="[item_tab.link][if item_tab.has_thumb]/-/thumb[end]" alt="[item_tab.subject]">
</a>
</td>
<td>
[item_tab_url]
[item_tab.url]
</td>
<td>
<ul class="uk-nav uk-width-medium">
<li class="uk-margin-small"><a class="uk-button uk-button-default uk-button-small uk-text-small" href="[item_tab_link]/imgcrop/postredirect:[filter fil_urlencode][doc_base_url][dir]imgcrop[end]">{imgcrop_table_option_crop_image}</a></li>
<li class="uk-margin-small"><a class="uk-button uk-button-default uk-button-small uk-text-small" href="[item_tab_link]/imgcrop/thumb/postredirect:[filter fil_urlencode][doc_base_url][dir]imgcrop[end]">{imgcrop_table_option_crop_thumb}</a></li>
<li class="uk-margin-small"><a class="uk-button uk-button-default uk-button-small uk-text-small" href="[item_tab_link]/imgcrop/newthumb/postredirect:[filter fil_urlencode][doc_base_url][dir]imgcrop[end]">{imgcrop_table_option_create_new_thumb}</a></li>
<li class="uk-margin-small"><a class="uk-button uk-button-default uk-button-small uk-text-small" href="[item_tab.link]/imgcrop/postredirect:[filter fil_urlencode][doc_base_url][dir]imgcrop[end]">{imgcrop_table_option_crop_image}</a></li>
<li class="uk-margin-small"><a class="uk-button uk-button-default uk-button-small uk-text-small" href="[item_tab.link]/imgcrop/thumb/postredirect:[filter fil_urlencode][doc_base_url][dir]imgcrop[end]">{imgcrop_table_option_crop_thumb}</a></li>
<li class="uk-margin-small"><a class="uk-button uk-button-default uk-button-small uk-text-small" href="[item_tab.link]/imgcrop/newthumb/postredirect:[filter fil_urlencode][doc_base_url][dir]imgcrop[end]">{imgcrop_table_option_create_new_thumb}</a></li>
</ul>
</td>

View File

@ -35,6 +35,8 @@
#include "models/item.h"
#include "core/misc.h"
#include "finder.h"
#include "core/request.h"
#include "templates/templates.h"
namespace Winix
@ -65,7 +67,9 @@ void Item::fields()
field(L"sort_index", sort_index);
field(L"content_id", L"content", item_content, morm::FT::foreign_key);
//field(L"my_test_function", my_test_function);
field(L"is", &Item::is);
field(L"link", &Item::link);
// may we should add a method setTypeFromInt(int t)?
type = static_cast<Type>(type_helper);
@ -232,6 +236,73 @@ void Item::propagate_connector()
}
// IMPROVEME move me to a better place
void Item::print_dir(Ezc::FunInfo<HtmlTextStream> & env)
{
Request * req = get_request();
if( req )
{
for(size_t a=0 ; a < req->dir_tab.size() ; ++a)
env.out << req->dir_tab[a]->url << '/';
}
}
// IMPROVEME move me to a better place
void Item::print_dir_without_slash(Ezc::FunInfo<HtmlTextStream> & env)
{
Request * req = get_request();
if( req )
{
for(size_t a=0 ; a < req->dir_tab.size() ; ++a)
{
env.out << req->dir_tab[a]->url;
if( a < req->dir_tab.size()-1 )
env.out << '/';
}
}
}
void Item::is(Ezc::FunInfo<HtmlTextStream> & env)
{
Request * req = get_request();
if( req )
{
env.res = req->is_item;
}
}
void Item::link(Ezc::FunInfo<HtmlTextStream> & env)
{
Config * config = get_config();
Request * req = get_request();
if( config && req )
{
TemplatesFunctions::doc_proto(env);
if( !req->subdomain.empty() )
env.out << req->subdomain << '.';
env.out << config->base_url;
// FIXME this prints cur->request->dir_tab but we should print the directory in which actually there is the item
print_dir(env);
env.out << url;
}
}
@ -366,5 +437,6 @@ bool Item::do_migration_to_4()
}
} // namespace Winix

View File

@ -36,8 +36,8 @@
#define headerfile_winix_models_item
#include <string>
#include "model.h"
#include "models/itemcontent.h"
#include "winixmodel.h"
#include "itemcontent.h"
// temporary
@ -89,7 +89,7 @@ public:
};
class Item : public morm::Model
class Item : public WinixModel
{
public:
@ -184,11 +184,11 @@ public:
void propagate_connector();
// for tests
static void my_test_function(Ezc::FunInfo<HtmlTextStream> & env)
{
env.out << L"hello from function";
}
void print_dir(Ezc::FunInfo<HtmlTextStream> & env);
void print_dir_without_slash(Ezc::FunInfo<HtmlTextStream> & env);
void is(Ezc::FunInfo<HtmlTextStream> & env);
void link(Ezc::FunInfo<HtmlTextStream> & env);
protected:
@ -200,6 +200,7 @@ protected:
bool do_migration_to_3();
bool do_migration_to_4();
MORM_MEMBER_FIELD(Item)
};

View File

@ -35,7 +35,8 @@
#include "models/itemcontent.h"
#include "core/crypt.h"
#include "core/misc.h"
#include "templates/misc.h"
#include "core/bbcodeparser.h"
namespace Winix
@ -81,6 +82,8 @@ void ItemContent::fields()
field(L"meta", meta);
field(L"meta_admin", meta_admin);
field(L"print_content", &ItemContent::print_content);
content_raw_type = static_cast<ContentType>(content_raw_type_helper);
content_parsed_type = static_cast<ContentType>(content_parsed_type_helper);
}
@ -166,6 +169,51 @@ bool ItemContent::CanContentBeHtmlFiltered()
void ItemContent::print_content(HtmlTextStream & out, const std::wstring & content, ItemContent::ContentType content_type, bool is_html_filter_on)
{
using TemplatesFunctions::R;
if( is_html_filter_on && !ItemContent::CanContentBeHtmlFiltered(content_type) )
out << R("<nofilter>");
if( content_type == ItemContent::ct_text )
{
out << content;
}
else
if( content_type == ItemContent::ct_formatted_text )
{
TemplatesFunctions::HtmlEscapeFormTxt(out, content);
}
else
if( content_type == ItemContent::ct_bbcode )
{
static std::wstring out_temp;
out_temp.clear();
out_temp.reserve(content.size()*2);
BBCODEParser bbcode_parser; // IMPROVE ME move me to a better place
bbcode_parser.Filter(content.c_str(), out_temp);
out << R(out_temp);
}
else
{
// ct_html, ct_other
out << R(content);
}
if( is_html_filter_on && !ItemContent::CanContentBeHtmlFiltered(content_type) )
out << R("</nofilter>");
}
void ItemContent::print_content(Ezc::FunInfo<HtmlTextStream> & env)
{
print_content(env.out, content_raw, content_raw_type, true); // IMPROVE ME get the 'true' from the config (config->html_filter)
}
bool ItemContent::do_migration(int & current_table_version)
{
bool ok = true;

View File

@ -39,6 +39,7 @@
#include "space/space.h"
#include "date/date.h"
#include "model.h"
#include "templates/htmltextstream.h"
namespace Winix
@ -230,6 +231,9 @@ public:
bool CanContentBeHtmlFiltered();
static void print_content(HtmlTextStream & out, const std::wstring & content, ItemContent::ContentType content_type, bool is_html_filter_on);
void print_content(Ezc::FunInfo<HtmlTextStream> & env);
bool do_migration(int & current_table_version);
@ -240,6 +244,8 @@ protected:
bool do_migration_to_2();
bool do_migration_to_3();
MORM_MEMBER_FIELD(ItemContent)
};

View File

@ -0,0 +1,96 @@
/*
* 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) 2021, 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.
*
*/
#include "winixmodel.h"
namespace Winix
{
Config * WinixModel::get_config()
{
WinixModelConnector * connector = get_winix_model_connector();
if( connector )
{
return connector->get_winix_config();
}
return nullptr;
}
Request * WinixModel::get_request()
{
WinixModelConnector * connector = get_winix_model_connector();
if( connector )
{
return connector->get_winix_request();
}
return nullptr;
}
Log * WinixModel::get_logger()
{
WinixModelConnector * connector = get_winix_model_connector();
if( connector )
{
return connector->get_winix_logger();
}
return nullptr;
}
WinixModelConnector * WinixModel::get_winix_model_connector()
{
if( model_connector )
{
return dynamic_cast<WinixModelConnector*>(model_connector);
}
return nullptr;
}
}

View File

@ -0,0 +1,68 @@
/*
* 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) 2021, 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_models_winixmodel
#define headerfile_winix_models_winixmodel
#include "model.h"
#include "core/log.h"
#include "winixmodelconnector.h"
namespace Winix
{
class Config;
class Request;
class Log;
class WinixModel : public morm::Model
{
public:
Config * get_config();
Request * get_request();
Log * get_logger();
protected:
WinixModelConnector * get_winix_model_connector();
};
}
#endif

View File

@ -0,0 +1,88 @@
/*
* 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) 2021, 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.
*
*/
#include "winixmodelconnector.h"
namespace Winix
{
WinixModelConnector::WinixModelConnector()
{
config = nullptr;
request = nullptr;
log = nullptr;
}
Config * WinixModelConnector::get_winix_config()
{
return config;
}
Request * WinixModelConnector::get_winix_request()
{
return request;
}
Log * WinixModelConnector::get_winix_logger()
{
return log;
}
void WinixModelConnector::set_winix_config(Config * config)
{
this->config = config;
}
void WinixModelConnector::set_winix_request(Request * request)
{
this->request = request;
}
void WinixModelConnector::set_winix_logger(Log * log)
{
this->log = log;
}
}

View File

@ -0,0 +1,72 @@
/*
* 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) 2021, 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_models_winixmodelconnector
#define headerfile_winix_models_winixmodelconnector
#include "modelconnector.h"
namespace Winix
{
class Config;
class Request;
class Log;
class WinixModelConnector : public morm::ModelConnector
{
public:
WinixModelConnector();
Config * get_winix_config();
Request * get_winix_request();
Log * get_winix_logger();
void set_winix_config(Config * config);
void set_winix_request(Request * request);
void set_winix_logger(Log * log);
protected:
Config * config; // one global config
Request * request; // each thread worker has its own request (not implemented yet)
Log * log; // each thread has its own logger
};
}
#endif

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -37,10 +37,11 @@
#include <vector>
#include <string>
#include "core/winixmodeldeprecated.h"
#include "notifypool.h"
#include "templates/patterns.h"
#include "notifythread.h"
#include "core/winixmodel.h"
@ -56,7 +57,7 @@ class ThreadManager;
class FileLog;
class Notify : public WinixModel
class Notify : public WinixModelDeprecated
{
public:

View File

@ -41,7 +41,7 @@
#include "edb.h"
#include "message.h"
#include "exportthread.h"
#include "core/winixmodel.h"
#include "core/winixmodeldeprecated.h"
@ -52,7 +52,7 @@ namespace Export
{
class ExportInfo : public WinixModel
class ExportInfo : public WinixModelDeprecated
{
public:

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2018, Tomasz Sowa
* Copyright (c) 2010-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <map>
#include <fstream>
#include "core/config.h"
#include "core/winixmodel.h"
#include "core/winixmodeldeprecated.h"
namespace Winix
@ -50,7 +50,7 @@ namespace Stats
struct Stats : public WinixModel
struct Stats : public WinixModelDeprecated
{
Stats();

View File

@ -183,7 +183,7 @@ void thread_sort_tab_print_content(Info & i)
std::wstring & content = thread_info.item_sort_tab[item_sort_index]->item_content.content_raw;
ItemContent::ContentType type = thread_info.item_sort_tab[item_sort_index]->item_content.content_raw_type;
item_print_content(i.out, content, type);
ItemContent::print_content(i.out, content, type, config->html_filter);
}
@ -354,11 +354,11 @@ void thread_sort_tab_run(Info & i)
Ezc::Pattern * p = pattern_cacher.GetPattern(*thread_info.item_sort_tab[item_sort_index]);
item_run_content.Clear();
InitGenerator(ezc_generator);
InitGenerator(ezc_generator, cur->request->models);
ezc_generator.SetPattern(*p);
ezc_generator.Generate(item_run_content);
item_print_content(i.out, item_run_content.Str(), thread_info.item_sort_tab[item_sort_index]->item_content.content_raw_type);
ItemContent::print_content(i.out, item_run_content.Str(), thread_info.item_sort_tab[item_sort_index]->item_content.content_raw_type, config->html_filter);
}
else
{

View File

@ -40,7 +40,7 @@
#include "db/db.h"
#include "thread.h"
#include "tdb.h"
#include "core/winixmodel.h"
#include "core/winixmodeldeprecated.h"
#include "models/item.h"
@ -52,7 +52,7 @@ namespace Winix
namespace Thread
{
class ThreadInfo : public WinixModel
class ThreadInfo : public WinixModelDeprecated
{
public:

View File

@ -42,7 +42,7 @@
#include "db/db.h"
#include "tdb.h"
#include "space/spaceparser.h"
#include "core/winixmodel.h"
#include "core/winixmodeldeprecated.h"
#include "models/item.h"
@ -67,7 +67,7 @@ struct TicketConfWrap
};
class TicketInfo : public WinixModel
class TicketInfo : public WinixModelDeprecated
{
public:

View File

@ -52,6 +52,12 @@ void HtmlTextStream::Clear()
}
void HtmlTextStream::clear()
{
Clear();
}
/*
without escaping

View File

@ -85,6 +85,7 @@ public:
* clearing the buffer and setting 'escape' flag to true
*/
void Clear();
void clear(); // utf8 methods call clear(), in the future Clear() will be renamed to clear()
/*

View File

@ -74,10 +74,10 @@ void insert_page_run(Info & i)
info.run_content.Clear();
InitGenerator(info.ezc_gen);
InitGenerator(info.ezc_gen, cur->request->models);
info.ezc_gen.SetPattern(*pat);
info.ezc_gen.Generate(info.run_content);
item_print_content(i.out, info.run_content.Str(), info.item.item_content.content_raw_type);
ItemContent::print_content(i.out, info.run_content.Str(), info.item.item_content.content_raw_type, config->html_filter);
insert_page_cur -= 1;
}
@ -119,7 +119,7 @@ void insert_page(Info & i)
insert_page_run(i);
else
if( system->HasReadAccess(info.item) )
item_print_content(i.out, info.item.item_content.content_raw, info.item.item_content.content_raw_type);
ItemContent::print_content(i.out, info.item.item_content.content_raw, info.item.item_content.content_raw_type, config->html_filter);
}
}

View File

@ -46,7 +46,6 @@ namespace Winix
namespace TemplatesFunctions
{
static BBCODEParser bbcode_parser;
static HtmlTextStream item_run_content;
static EzcGen ezc_generator;
@ -126,52 +125,11 @@ void item_content_type_is(Info & i)
}
void item_print_content(HtmlTextStream & out, const std::wstring & content, ItemContent::ContentType content_type)
{
if( config->html_filter && !ItemContent::CanContentBeHtmlFiltered(content_type) )
out << R("<nofilter>");
if( content_type == ItemContent::ct_text )
{
out << content;
}
else
if( content_type == ItemContent::ct_formatted_text )
{
HtmlEscapeFormTxt(out, content);
}
else
if( content_type == ItemContent::ct_bbcode )
{
static std::wstring out_temp;
out_temp.clear();
out_temp.reserve(content.size()*2);
bbcode_parser.Filter(content.c_str(), out_temp);
out << R(out_temp);
}
else
{
// ct_html, ct_other
out << R(content);
}
if( config->html_filter && !ItemContent::CanContentBeHtmlFiltered(content_type) )
out << R("</nofilter>");
}
void item_content_is_empty(Info & i)
{
i.res = cur->request->last_item->item_content.content_raw.empty();
}
void item_print_content(Info & i)
{
item_print_content(i.out, cur->request->last_item->item_content.content_raw, cur->request->last_item->item_content.content_raw_type);
}
void item_privileges(Info & i)
{
@ -332,7 +290,7 @@ void item_run(Info & i)
Ezc::Pattern * p = pattern_cacher.GetPattern(*cur->request->last_item);
item_run_content.Clear();
InitGenerator(ezc_generator);
InitGenerator(ezc_generator, cur->request->models);
ezc_generator.SetPattern(*p);
if( config->allow_ezc_frames_in_executable_items )
@ -340,7 +298,7 @@ void item_run(Info & i)
else
ezc_generator.Generate(item_run_content);
item_print_content(i.out, item_run_content.Str(), cur->request->last_item->item_content.content_raw_type);
ItemContent::print_content(i.out, item_run_content.Str(), cur->request->last_item->item_content.content_raw_type, config->html_filter);
}
else
{
@ -490,7 +448,7 @@ void item_can_content_be_html_filtered(Info & i)
}
/*
static size_t item_index;
@ -739,7 +697,7 @@ void item_tab_run(Info & i)
{
Ezc::Pattern * p = pattern_cacher.GetPattern(cur->request->item_tab[item_index]);
item_run_content.Clear();
InitGenerator(ezc_generator);
InitGenerator(ezc_generator, cur->request->models);
ezc_generator.SetPattern(*p);
if( config->allow_ezc_frames_in_executable_items )
@ -884,7 +842,7 @@ void item_tab_meta_tab_has_next(Info & i)
if( item_index < cur->request->item_tab.size() )
space_list_tab_has_next(i, cur->request->item_tab[item_index].item_content.meta, L"item_tab_meta_tab");
}
*/

View File

@ -48,7 +48,6 @@ namespace TemplatesFunctions
extern EzcFun ezc_functions;
extern Ezc::Blocks ezc_blocks;
extern Ezc::Vars ezc_vars;
extern Ezc::Models ezc_models;
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in)
@ -93,7 +92,7 @@ int was_enter = 0; // how many enteres there were before
void InitGenerator(EzcGen & gen)
void InitGenerator(EzcGen & gen, Ezc::Models & ezc_models)
{
gen.TrimWhite(gen_trim_white);
gen.SkipNewLine(gen_skip_new_line);

View File

@ -63,7 +63,7 @@ HtmlTextStream::RawText<RawType> R(const RawType & par)
}
void InitGenerator(EzcGen & gen);
void InitGenerator(EzcGen & gen, Ezc::Models & ezc_models);
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in);

View File

@ -63,7 +63,6 @@ EzcFun ezc_functions;
Ezc::Blocks ezc_blocks;
Ezc::Objects<HtmlTextStream> ezc_objects;
Ezc::Vars ezc_vars;
Ezc::Models ezc_models;
LocaleFilter locale_filter;
HTMLFilter html_filter;
@ -186,7 +185,7 @@ Ezc::Pattern * p = 0;
if( p )
{
InitGenerator(content_gen);
InitGenerator(content_gen, cur->request->models);
content_gen.SetPattern(*p);
content_gen.Generate(i.out, cur->request->out_streams);
}
@ -438,7 +437,6 @@ void Templates::CreateFunctions()
ezc_functions.Insert("item_content", item_content);
ezc_functions.Insert("item_content_noescape", item_content_noescape);
ezc_functions.Insert("item_content_type_is", item_content_type_is);
ezc_functions.Insert("item_print_content", item_print_content);
ezc_functions.Insert("item_privileges", item_privileges);
ezc_functions.Insert("item_dir", item_dir);
ezc_functions.Insert("item_url", item_url);
@ -486,6 +484,7 @@ void Templates::CreateFunctions()
ezc_functions.Insert("item_admin_meta_tab_has_next", item_admin_meta_tab_has_next);
ezc_functions.Insert("item_can_content_be_html_filtered", item_can_content_be_html_filtered);
/*
ezc_functions.Insert("item_tab", item_tab);
ezc_functions.Insert("item_tab_index", item_tab_index);
ezc_functions.Insert("item_tab_id", item_tab_id);
@ -530,7 +529,7 @@ void Templates::CreateFunctions()
ezc_functions.Insert("item_tab_meta_tab", item_tab_meta_tab);
ezc_functions.Insert("item_tab_meta_tab_value", item_tab_meta_tab_value);
ezc_functions.Insert("item_tab_meta_tab_has_next", item_tab_meta_tab_has_next);
*/
/*
last
@ -1024,8 +1023,6 @@ using namespace TemplatesFunctions;
log << log4 << "Templates: patterns cache size: " << pattern_cacher.Size() << logend;
pattern_cacher.DeleteOldPatterns();
ezc_models.Clear();
}
@ -1128,7 +1125,7 @@ using namespace TemplatesFunctions;
if( index )
{
InitGenerator(generator);
InitGenerator(generator, cur->request->models);
generator.SetPattern(*index);
generator.Generate(cur->request->out_main_stream, cur->request->out_streams);
}
@ -1147,7 +1144,7 @@ void Templates::Generate(Ezc::Pattern & pattern)
using namespace TemplatesFunctions;
ezc_vars.clear();
InitGenerator(generator);
InitGenerator(generator, cur->request->models);
generator.SetPattern(pattern);
generator.Generate(cur->request->out_main_stream, cur->request->out_streams);
}

View File

@ -96,9 +96,6 @@ namespace TemplatesFunctions
extern bool gen_skip_new_line;
extern bool gen_use_special_chars;
extern Ezc::Models ezc_models;
/*
adduser
@ -331,8 +328,6 @@ namespace TemplatesFunctions
void item_content_type_is(Item & item, Info & i);
void item_content_type_is(Info & i);
void item_content_is_empty(Info & i);
void item_print_content(HtmlTextStream & out, const std::wstring & content, ItemContent::ContentType content_type);
void item_print_content(Info & i);
void item_privileges(Info & i);
void item_dir(Info & i);
void item_url(Info & i);
@ -379,6 +374,7 @@ namespace TemplatesFunctions
void item_admin_meta_tab_has_next(Info & i);
void item_can_content_be_html_filtered(Info & i);
/*
void item_tab(Info & i);
void item_tab_index(Info & i);
void item_tab_id(Info & i);
@ -423,7 +419,7 @@ namespace TemplatesFunctions
void item_tab_meta_tab(Info & i);
void item_tab_meta_tab_value(Info & i);
void item_tab_meta_tab_has_next(Info & i);
*/
/*
last