Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0045c6c72c | |||
| 4809016b78 | |||
| 6e2ba65524 | |||
| 8033ac66c4 | |||
| 9ef3736989 |
@@ -366,6 +366,7 @@ void App::ProcessRequest()
|
||||
// simple operations which should not throw an exception
|
||||
templates.RequestEnd();
|
||||
cur.request->Clear();
|
||||
cur.session->ClearOnEndRequest();
|
||||
cur.session = session_manager.GetTmpSession();
|
||||
log << logendrequest;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
IPBanContainer::IPBanContainer()
|
||||
{
|
||||
is_ipban_tab_sorted = false;
|
||||
is_ipban_tab_sorted = true; // an empty list is sorted
|
||||
soft_max_size = 100;
|
||||
max_size = 110;
|
||||
}
|
||||
@@ -49,6 +49,7 @@ IPBan & IPBanContainer::AddIP(int ip)
|
||||
RemoveOldRecords();
|
||||
|
||||
ipban_tab.push_back(ip_ban);
|
||||
is_ipban_tab_sorted = false;
|
||||
return ipban_tab.back();
|
||||
}
|
||||
else
|
||||
@@ -58,12 +59,35 @@ IPBan & IPBanContainer::AddIP(int ip)
|
||||
}
|
||||
|
||||
|
||||
void IPBanContainer::RemoveIP(int ip)
|
||||
{
|
||||
IPBan * ipban = FindIP(ip);
|
||||
|
||||
if( ipban )
|
||||
{
|
||||
size_t index = ipban - &ipban_tab[0];
|
||||
ipban_tab.erase(ipban_tab.begin() + index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool IPBanContainer::IsSorted()
|
||||
{
|
||||
return is_ipban_tab_sorted;
|
||||
}
|
||||
|
||||
|
||||
void IPBanContainer::Clear()
|
||||
{
|
||||
ipban_tab.clear();
|
||||
is_ipban_tab_sorted = true;
|
||||
}
|
||||
|
||||
|
||||
// we need to remove some old records for the size of the container
|
||||
// to be less or equal to soft_max_size
|
||||
void IPBanContainer::RemoveOldRecords()
|
||||
{
|
||||
PrintTab();
|
||||
|
||||
size_t to_remove = 0;
|
||||
|
||||
if( ipban_tab.size() >= soft_max_size )
|
||||
@@ -71,35 +95,22 @@ void IPBanContainer::RemoveOldRecords()
|
||||
|
||||
if( to_remove > 0 )
|
||||
{
|
||||
log << log4 << "we are going to remove: " << to_remove << " records" << logend;
|
||||
|
||||
sort_helper_tab.resize(ipban_tab.size());
|
||||
|
||||
for(size_t i=0 ; i<ipban_tab.size() ; ++i)
|
||||
sort_helper_tab[i] = i;
|
||||
|
||||
std::sort(sort_helper_tab.begin(), sort_helper_tab.end(), SortByLastUsedHelper(this));
|
||||
PrintTab2();
|
||||
sort_helper_tab.resize(to_remove);
|
||||
std::sort(sort_helper_tab.begin(), sort_helper_tab.end());
|
||||
PrintTab2();
|
||||
|
||||
|
||||
while( to_remove-- > 0 )
|
||||
{
|
||||
log << log4 << "removing record index: " << sort_helper_tab[to_remove] << ", last_used: ";
|
||||
PT::Date date(ipban_tab[sort_helper_tab[to_remove]].last_used);
|
||||
log << date << logend;
|
||||
|
||||
ipban_tab.erase(ipban_tab.begin() + sort_helper_tab[to_remove]);
|
||||
}
|
||||
|
||||
log << log4 << "after removing we have: " << logend;
|
||||
PrintTab();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// for debug purposes
|
||||
void IPBanContainer::PrintTab()
|
||||
{
|
||||
log << log4 << "ipban_tab (size: " << ipban_tab.size() << ")" << logend;
|
||||
@@ -116,6 +127,8 @@ void IPBanContainer::PrintTab()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// for debug purposes
|
||||
void IPBanContainer::PrintTab2()
|
||||
{
|
||||
log << log4 << "sort_helper_tab (size: " << sort_helper_tab.size() << ")" << logend;
|
||||
|
||||
@@ -27,7 +27,9 @@ public:
|
||||
size_t Size();
|
||||
IPBan & GetIPBan(size_t index);
|
||||
void SetMaxSize(size_t soft_size, size_t size);
|
||||
|
||||
void RemoveIP(int ip);
|
||||
void Clear();
|
||||
bool IsSorted();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ void Item::Clear()
|
||||
html_template.clear();
|
||||
sort_index = 0;
|
||||
meta.Clear();
|
||||
ameta.Clear();
|
||||
|
||||
SetDateToNow();
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ struct Item
|
||||
|
||||
// meta information
|
||||
PT::Space meta;
|
||||
PT::Space ameta;
|
||||
|
||||
|
||||
// methods
|
||||
|
||||
@@ -234,6 +234,7 @@ PT::WTextStream IPToStr(unsigned int ip);
|
||||
PT::WTextStream IPToStr(int ip);
|
||||
|
||||
|
||||
|
||||
bool IsWhite(wchar_t s);
|
||||
bool IsWhite(const wchar_t * str, bool treat_new_line_as_white = false);
|
||||
bool IsWhite(const std::wstring & str, bool treat_new_line_as_white = false);
|
||||
|
||||
@@ -85,3 +85,10 @@ void Session::Clear(bool clear_plugin_data)
|
||||
}
|
||||
|
||||
|
||||
// clearing some variables when a request is ended (just for safety)
|
||||
void Session::ClearOnEndRequest()
|
||||
{
|
||||
// ip_ban list can be sorted by SessionManager (in the special thread)
|
||||
ip_ban = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ struct Session
|
||||
|
||||
void SetTimesTo(time_t time);
|
||||
void Clear(bool clear_plugin_data = true);
|
||||
void ClearOnEndRequest();
|
||||
|
||||
|
||||
// 0 - means that there is a temporary session
|
||||
|
||||
@@ -460,8 +460,16 @@ IPBan & SessionManager::GetIPBan(size_t index)
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::RemoveIPBan(int ip)
|
||||
{
|
||||
ban_tab.RemoveIP(ip);
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::ClearIPBanList()
|
||||
{
|
||||
ban_tab.Clear();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -488,6 +496,7 @@ SessionContainer::Iterator i;
|
||||
{
|
||||
Lock();
|
||||
|
||||
CheckWheterIPListIsSorted();
|
||||
CheckSession(i);
|
||||
exit = synchro->was_stop_signal;
|
||||
|
||||
@@ -496,6 +505,17 @@ SessionContainer::Iterator i;
|
||||
}
|
||||
|
||||
|
||||
// objects locked
|
||||
void SessionManager::CheckWheterIPListIsSorted()
|
||||
{
|
||||
if( !ban_tab.IsSorted() )
|
||||
{
|
||||
log << log4 << "SM: sorting the ban list" << logend;
|
||||
ban_tab.Sort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// it's called from the other thread (with Lock and Unlock)
|
||||
void SessionManager::CheckSession(SessionContainer::Iterator & i)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,8 @@ public:
|
||||
IPBan & AddIPToBanList(int ip);
|
||||
size_t BanListSize();
|
||||
IPBan & GetIPBan(size_t index);
|
||||
|
||||
void RemoveIPBan(int ip);
|
||||
void ClearIPBanList();
|
||||
|
||||
private:
|
||||
|
||||
@@ -96,6 +97,7 @@ private:
|
||||
void CheckSession(SessionContainer::Iterator & i);
|
||||
bool IsSessionOutdated(const Session & s) const;
|
||||
void DeleteSession(Session * del_session);
|
||||
void CheckWheterIPListIsSorted();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -324,20 +324,40 @@ void System::RedirectWithFunctionAndParamsTo(const std::wstring & url)
|
||||
}
|
||||
|
||||
|
||||
void System::RedirectToLastDir()
|
||||
void System::RedirectToLastDir(const wchar_t * postfix)
|
||||
{
|
||||
if( !cur->request->dir_tab.empty() )
|
||||
RedirectTo( *cur->request->dir_tab.back() );
|
||||
RedirectTo( *cur->request->dir_tab.back(), postfix );
|
||||
}
|
||||
|
||||
|
||||
void System::RedirectToLastItem()
|
||||
void System::RedirectToLastItem(const wchar_t * postfix)
|
||||
{
|
||||
if( cur->request->last_item )
|
||||
RedirectTo( *cur->request->last_item );
|
||||
RedirectTo( *cur->request->last_item, postfix );
|
||||
}
|
||||
|
||||
|
||||
void System::RedirectToLastFunction(const wchar_t * postfix)
|
||||
{
|
||||
RedirectToLastDir();
|
||||
|
||||
if( cur->request->is_item )
|
||||
{
|
||||
cur->request->redirect_to += cur->request->item.url;
|
||||
cur->request->redirect_to += '/';
|
||||
}
|
||||
|
||||
if( cur->request->function )
|
||||
cur->request->redirect_to += cur->request->function->fun.url;
|
||||
|
||||
if( postfix )
|
||||
{
|
||||
cur->request->redirect_to += '/';
|
||||
cur->request->redirect_to += postfix;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool System::CanChangeUser(const Item & item, long new_user_id)
|
||||
{
|
||||
|
||||
@@ -96,8 +96,10 @@ public:
|
||||
void RedirectTo(const std::wstring & url);
|
||||
void RedirectWithFunctionAndParamsTo(const wchar_t * url);
|
||||
void RedirectWithFunctionAndParamsTo(const std::wstring & url);
|
||||
void RedirectToLastDir();
|
||||
void RedirectToLastItem(); // redirect to an item if exists or to the last directory
|
||||
void RedirectToLastDir(const wchar_t * postfix = 0);
|
||||
void RedirectToLastItem(const wchar_t * postfix = 0); // redirect to an item if exists or to the last directory
|
||||
void RedirectToLastFunction(const wchar_t * postfix = 0);
|
||||
|
||||
|
||||
bool CanChangeUser(const Item & item, long new_user_id);
|
||||
bool CanChangeGroup(const Item & item, long new_group_id);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#define WINIX_VER_MAJOR 0
|
||||
#define WINIX_VER_MINOR 5
|
||||
#define WINIX_VER_REVISION 1
|
||||
#define WINIX_VER_REVISION 2
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
25
db/db.cpp
25
db/db.cpp
@@ -311,7 +311,7 @@ Error Db::AddItemIntoItem(Item & item)
|
||||
query.Clear();
|
||||
query << R("insert into core.item (user_id, modification_user_id, group_id, privileges, "
|
||||
"date_creation, date_modification, type, parent_id, content_id, "
|
||||
"link_to, link_redirect, subject, guest_name, template, sort_index, meta, url) values (")
|
||||
"link_to, link_redirect, subject, guest_name, template, sort_index, meta, ameta, url) values (")
|
||||
<< item.user_id
|
||||
<< item.modification_user_id
|
||||
<< item.group_id
|
||||
@@ -327,7 +327,8 @@ Error Db::AddItemIntoItem(Item & item)
|
||||
<< item.guest_name
|
||||
<< item.html_template
|
||||
<< item.sort_index
|
||||
<< item.meta;
|
||||
<< item.meta
|
||||
<< item.ameta;
|
||||
|
||||
url_without_id = AddItemCreateUrlSubject(item);
|
||||
|
||||
@@ -469,7 +470,7 @@ Error Db::EditItemInItem(Item & item, bool with_url)
|
||||
query.Clear();
|
||||
query << R("update core.item set (user_id, modification_user_id, group_id, privileges, "
|
||||
"date_creation, date_modification, type, link_to, link_redirect, parent_id, subject, "
|
||||
"guest_name, template, sort_index, meta");
|
||||
"guest_name, template, sort_index, meta, ameta");
|
||||
|
||||
if( with_url )
|
||||
query << R(", url");
|
||||
@@ -489,7 +490,8 @@ Error Db::EditItemInItem(Item & item, bool with_url)
|
||||
<< item.guest_name
|
||||
<< item.html_template
|
||||
<< item.sort_index
|
||||
<< item.meta;
|
||||
<< item.meta
|
||||
<< item.ameta;
|
||||
|
||||
if( with_url )
|
||||
{
|
||||
@@ -771,7 +773,7 @@ void Db::GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query, bool
|
||||
if( iq.sel_file ) query << R(", file_path, file_fs, file_type, has_thumb, hash, hash_type, file_size");
|
||||
if( iq.sel_html_template ) query << R(", template");
|
||||
if( iq.sel_sort_index ) query << R(", sort_index");
|
||||
if( iq.sel_meta ) query << R(", meta");
|
||||
if( iq.sel_meta ) query << R(", meta, ameta");
|
||||
}
|
||||
|
||||
query << R(" from core.item");
|
||||
@@ -1343,6 +1345,19 @@ return DoCommand(query);
|
||||
}
|
||||
|
||||
|
||||
Error Db::EditAdminMetaById(const PT::Space & ameta, long id)
|
||||
{
|
||||
query.Clear();
|
||||
query << R("update core.item set (ameta) = (")
|
||||
<< ameta
|
||||
<< R(") where id=")
|
||||
<< id
|
||||
<< R(";");
|
||||
|
||||
return DoCommand(query);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Error Db::EditSubjectById(Item & item, long id)
|
||||
|
||||
1
db/db.h
1
db/db.h
@@ -72,6 +72,7 @@ public:
|
||||
Error EditFileById(const Item & item, long id); // file_path, file_fs, file_type
|
||||
Error EditHasThumbById(bool has_thumb, long id);
|
||||
Error EditMetaById(const PT::Space & meta, long id);
|
||||
Error EditAdminMetaById(const PT::Space & meta, long id);
|
||||
|
||||
Error DelDirById(long id);
|
||||
Error DelFileById(long file_id);
|
||||
|
||||
@@ -46,6 +46,7 @@ void DbItemColumns::SetColumns(PGresult * r)
|
||||
modify_index = PQfnumber(r, "modify_index");
|
||||
sort_index = PQfnumber(r, "sort_index");
|
||||
meta = PQfnumber(r, "meta");
|
||||
ameta = PQfnumber(r, "ameta");
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +83,8 @@ void DbItemColumns::SetItem(PGresult * r, long row, Item & item)
|
||||
if( html_template != -1 ) DbBase::AssertValueWide(r, row, html_template, item.html_template);
|
||||
if( sort_index != -1 ) item.sort_index = DbBase::AssertValueInt(r, row, sort_index);
|
||||
|
||||
if( meta != -1 ) db_base.AssertValueSpace(r, row, meta, item.meta);
|
||||
if( meta != -1 ) db_base.AssertValueSpace(r, row, meta, item.meta);
|
||||
if( ameta != -1 ) db_base.AssertValueSpace(r, row, ameta, item.ameta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ struct DbItemColumns
|
||||
int modify_index;
|
||||
int sort_index;
|
||||
int meta;
|
||||
int ameta;
|
||||
|
||||
DbItemColumns(DbBase & db_base_) : db_base(db_base_)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ struct DbItemQuery
|
||||
bool sel_file; // file_path, file_fs, file_type, has_thumb, hash, hash_type, file_size
|
||||
bool sel_html_template; // template
|
||||
bool sel_sort_index; // sort_index
|
||||
bool sel_meta; // meta PT::Space
|
||||
bool sel_meta; // meta and ameta (PT::Space)
|
||||
|
||||
bool where_id; //
|
||||
bool where_parent_id; //
|
||||
|
||||
@@ -544,7 +544,7 @@ ipban.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
|
||||
ipban.o: ../core/lastcontainer.h ../core/mounts.h ../core/mountparser.h
|
||||
ipban.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
|
||||
ipban.o: ../core/loadavg.h ../core/image.h ../core/threadmanager.h
|
||||
ipban.o: ../core/timezones.h ../core/synchro.h
|
||||
ipban.o: ../core/timezones.h ../core/synchro.h ../core/sessionmanager.h
|
||||
last.o: last.h functionbase.h ../core/item.h ../../pikotools/space/space.h
|
||||
last.o: ../../pikotools/textstream/types.h ../../pikotools/date/date.h
|
||||
last.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
|
||||
|
||||
@@ -54,7 +54,7 @@ return (conf_parser.ParseString(env_str) == PT::SpaceParser::ok);
|
||||
}
|
||||
|
||||
|
||||
bool Env::EditAdminEnv(long user_id, const std::wstring & env_str)
|
||||
bool Env::EditAdminEnv(long user_id, const std::wstring & env_str, bool use_ses_log)
|
||||
{
|
||||
if( Parse(env_str) )
|
||||
{
|
||||
@@ -69,21 +69,23 @@ bool Env::EditAdminEnv(long user_id, const std::wstring & env_str)
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Evn: a problem with changing environment variables for user: "
|
||||
log << log1 << "Evn: a database problem with changing environment variables for user: "
|
||||
<< cur->session->puser->name << ", id: " << cur->session->puser->id << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "Env: Syntax error in line: " << conf_parser.line << logend;
|
||||
slog << logerror << "Syntax error in line: " << conf_parser.line << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("syntax_error_in_line") << ' ' << conf_parser.line << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Env::EditEnv(long user_id, const std::wstring & env_str)
|
||||
bool Env::EditEnv(long user_id, const std::wstring & env_str, bool use_ses_log)
|
||||
{
|
||||
if( Parse(env_str) )
|
||||
{
|
||||
@@ -98,20 +100,23 @@ bool Env::EditEnv(long user_id, const std::wstring & env_str)
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Evn: a problem with changing admin environment variables for user: "
|
||||
log << log1 << "Evn: a database problem with changing admin environment variables for user: "
|
||||
<< cur->session->puser->name << ", id: " << cur->session->puser->id << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "Env: Syntax error in line: " << conf_parser.line << logend;
|
||||
slog << logerror << "Syntax error in line: " << conf_parser.line << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("syntax_error_in_line") << ' ' << conf_parser.line << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Env::SaveEnv()
|
||||
{
|
||||
if( GetUser() )
|
||||
@@ -123,11 +128,11 @@ void Env::SaveEnv()
|
||||
if( cur->request->IsParam(L"a") )
|
||||
{
|
||||
if( cur->session->puser->super_user )
|
||||
status = EditAdminEnv(user_id, env_str);
|
||||
status = EditAdminEnv(user_id, env_str, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = EditEnv(user_id, env_str);
|
||||
status = EditEnv(user_id, env_str, true);
|
||||
}
|
||||
|
||||
if( status )
|
||||
|
||||
@@ -24,8 +24,8 @@ public:
|
||||
|
||||
Env();
|
||||
|
||||
bool EditAdminEnv(long user_id, const std::wstring & env_str);
|
||||
bool EditEnv(long user_id, const std::wstring & env_str);
|
||||
bool EditAdminEnv(long user_id, const std::wstring & env_str, bool use_ses_log = false);
|
||||
bool EditEnv(long user_id, const std::wstring & env_str, bool use_ses_log = false);
|
||||
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
|
||||
@@ -7,8 +7,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "ipban.h"
|
||||
#include "functions.h"
|
||||
#include "core/sessionmanager.h"
|
||||
|
||||
|
||||
|
||||
@@ -28,15 +33,40 @@ bool IPBanFun::HasAccess()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void IPBanFun::MakePost()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void IPBanFun::MakeGet()
|
||||
{
|
||||
if( cur->request->IsParam(L"removeip") )
|
||||
{
|
||||
if( cur->request->ParamValue(L"removeip") == L"all" )
|
||||
{
|
||||
session_manager->ClearIPBanList();
|
||||
cur->session->ip_ban = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int cur_ip = 0;
|
||||
|
||||
if( cur->session->ip_ban )
|
||||
cur_ip = cur->session->ip_ban->ip;
|
||||
|
||||
AssignString(cur->request->ParamValue(L"removeip"), tmp_ip_str);
|
||||
int ip = (int)inet_addr(tmp_ip_str.c_str());
|
||||
session_manager->RemoveIPBan(ip);
|
||||
|
||||
if( cur->session->ip_ban && cur_ip == ip )
|
||||
cur->session->ip_ban = 0;
|
||||
}
|
||||
|
||||
system->RedirectToLastFunction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ public:
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
std::string tmp_ip_str;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -210,7 +210,10 @@ return true;
|
||||
}
|
||||
|
||||
|
||||
bool Login::LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me, bool use_ses_log)
|
||||
// if you are logging not from a webbrowser but from an application
|
||||
// then probably you need check_abuse to be false
|
||||
bool Login::LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me,
|
||||
bool use_ses_log, bool check_abuse)
|
||||
{
|
||||
long user_id;
|
||||
|
||||
@@ -232,7 +235,7 @@ long user_id;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !CheckAbuse() )
|
||||
if( check_abuse && !CheckAbuse() )
|
||||
{
|
||||
AddBanInfo();
|
||||
return false;
|
||||
@@ -264,7 +267,7 @@ void Login::MakePost()
|
||||
const std::wstring & pass = cur->request->PostVar(L"password");
|
||||
const std::wstring & remem = cur->request->PostVar(L"rememberme");
|
||||
|
||||
if( LoginUser(login, pass, !remem.empty(), true) )
|
||||
if( LoginUser(login, pass, !remem.empty(), true, true) )
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ public:
|
||||
bool CannotLoginFrom(const IPBan & ipban);
|
||||
|
||||
bool CheckUserPass(const std::wstring & login, const std::wstring & password, long & user_id);
|
||||
bool LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me, bool use_ses_log = false);
|
||||
bool LoginUser(const std::wstring & login, const std::wstring & password, bool remember_me,
|
||||
bool use_ses_log = false, bool check_abuse = false);
|
||||
|
||||
|
||||
private:
|
||||
@@ -49,6 +50,7 @@ private:
|
||||
std::string pass_decrypted;
|
||||
std::wstring pass_hashed;
|
||||
std::wstring salt;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -17,30 +17,53 @@ namespace Fun
|
||||
Meta::Meta()
|
||||
{
|
||||
fun.url = L"meta";
|
||||
// !! CHECKME what about follow symlinks?
|
||||
}
|
||||
|
||||
|
||||
bool Meta::HasAccess()
|
||||
{
|
||||
return system->HasReadAccess(*cur->request->last_item);
|
||||
if( cur->request->IsParam(L"a") )
|
||||
return cur->session->puser && cur->session->puser->super_user;
|
||||
else
|
||||
return system->HasWriteAccess(*cur->request->last_item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Meta::AddMetaInfo(Item & item, const std::wstring & meta_str)
|
||||
bool Meta::Parse(const std::wstring & meta_str)
|
||||
{
|
||||
space.Clear();
|
||||
conf_parser.SetSpace(space);
|
||||
conf_parser.UTF8(config->utf8);
|
||||
conf_parser.SplitSingle(true);
|
||||
|
||||
if( conf_parser.ParseString(meta_str) == PT::SpaceParser::ok )
|
||||
return (conf_parser.ParseString(meta_str) == PT::SpaceParser::ok);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool Meta::EditAdminMeta(long item_id, const std::wstring & meta_str, bool use_ses_log)
|
||||
{
|
||||
if( Parse(meta_str) )
|
||||
{
|
||||
if( db->EditMetaById(space, item.id) == WINIX_ERR_OK )
|
||||
if( db->EditAdminMetaById(space, item_id) == WINIX_ERR_OK )
|
||||
{
|
||||
item.meta = space;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Meta: a database problem with changing admin meta information for item id: "
|
||||
<< item_id << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "Meta: Syntax error in line: " << conf_parser.line << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("syntax_error_in_line") << ' ' << conf_parser.line << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -48,21 +71,64 @@ return false;
|
||||
|
||||
|
||||
|
||||
void Meta::MakePost()
|
||||
bool Meta::EditMeta(long item_id, const std::wstring & meta_str, bool use_ses_log)
|
||||
{
|
||||
if( Parse(meta_str) )
|
||||
{
|
||||
if( db->EditMetaById(space, item_id) == WINIX_ERR_OK )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Meta: a database problem with changing meta information for item id: "
|
||||
<< item_id << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "Meta: Syntax error in line: " << conf_parser.line << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("syntax_error_in_line") << ' ' << conf_parser.line << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Meta::ChangeAdminMeta()
|
||||
{
|
||||
if( cur->session->puser && cur->session->puser->super_user )
|
||||
{
|
||||
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
|
||||
|
||||
if( EditAdminMeta(cur->request->last_item->id, meta_str, true) )
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Meta::ChangeMeta()
|
||||
{
|
||||
if( system->HasWriteAccess(*cur->request->last_item) )
|
||||
{
|
||||
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
|
||||
|
||||
if( AddMetaInfo(*cur->request->last_item, meta_str) )
|
||||
if( EditMeta(cur->request->last_item->id, meta_str, true) )
|
||||
system->RedirectToLastItem();
|
||||
else
|
||||
slog << logerror << "Syntax error in line: " << conf_parser.line << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Meta::MakePost()
|
||||
{
|
||||
if( cur->request->IsParam(L"a") )
|
||||
ChangeAdminMeta();
|
||||
else
|
||||
{
|
||||
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
ChangeMeta();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,12 +26,19 @@ public:
|
||||
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
bool AddMetaInfo(Item & item, const std::wstring & meta_str);
|
||||
|
||||
bool EditAdminMeta(long item_id, const std::wstring & meta_str, bool use_ses_log = false);
|
||||
bool EditMeta(long item_id, const std::wstring & meta_str, bool use_ses_log = false);
|
||||
|
||||
private:
|
||||
|
||||
PT::SpaceParser conf_parser;
|
||||
PT::Space space;
|
||||
|
||||
bool Parse(const std::wstring & meta_str);
|
||||
void ChangeAdminMeta();
|
||||
void ChangeMeta();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<div class="winix">
|
||||
|
||||
<h1>IP Banned</h1>
|
||||
<h1>{ipban_header}</h1>
|
||||
|
||||
[if ipban_tab]
|
||||
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>IP address</th>
|
||||
<th>login failures</th>
|
||||
<th>Login allowed</th>
|
||||
<th>Ban level</th>
|
||||
<th>Active flag</th>
|
||||
<th>Last used</th>
|
||||
<th>Expires</th>
|
||||
<th>Remove</th>
|
||||
<th>{ipban_col_id}</th>
|
||||
<th>{ipban_col_ip_address}</th>
|
||||
<th>{ipban_col_login_failures}</th>
|
||||
<th>{ipban_col_login_allowed}</th>
|
||||
<th>{ipban_col_ban_level}</th>
|
||||
<th>{ipban_col_active_flag}</th>
|
||||
<th>{ipban_col_last_used}</th>
|
||||
<th>{ipban_col_expires}</th>
|
||||
<th>{ipban_col_remove}</th>
|
||||
</tr>
|
||||
|
||||
[for ipban_tab]
|
||||
@@ -24,18 +24,23 @@
|
||||
<td>[ipban_tab_id]</td>
|
||||
<td>[ipban_tab_ip]</td>
|
||||
<td>[ipban_tab_incorrect_login]</td>
|
||||
<td>[if ipban_tab_is_logging_allowed]yes[else]no[end]</td>
|
||||
<td>[if ipban_tab_is_logging_allowed]{ipban_loggin_allowed}[else]{ipban_loggin_not_allowed}[end]</td>
|
||||
<td>[ipban_tab_ban_level]</td>
|
||||
<td>[if ipban_tab_has_active_flag]yes[end]</td>
|
||||
<td>[if ipban_tab_has_active_flag]{ipban_has_active_flag}[end]</td>
|
||||
<td>[ipban_tab_last_used]</td>
|
||||
<td>[ipban_tab_expires]</td>
|
||||
<td><a href="[doc_base_url][dir][if item_is][item_url]/[end]ipban/removeip:[ipban_tab_ip]">remove</a></td>
|
||||
<td><a href="[doc_base_url][dir][if item_is][item_url]/[end]ipban/removeip:[ipban_tab_ip]">{ipban_remove_ip}</a></td>
|
||||
</tr>
|
||||
|
||||
[end]
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<a href="[doc_base_url][dir][if item_is][item_url]/[end]ipban/removeip:all">{ipban_remove_all_ip}</a>
|
||||
</p>
|
||||
|
||||
[else]
|
||||
<p>There are not any IP addresses banned at the moment.</p>
|
||||
<p>{ipban_ban_list_empty}</p>
|
||||
[end]
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,40 @@
|
||||
<div class="winix">
|
||||
|
||||
<h1>{meta_header}</h1>
|
||||
[if winix_function_param_is "a"]
|
||||
<h1>{meta_admin_header}</h1>
|
||||
|
||||
[if item_is]
|
||||
<form method="post" action="[doc_base_url][dir][item_url]/meta/a">
|
||||
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[item_admin_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</form>
|
||||
[else]
|
||||
<form method="post" action="[doc_base_url][dir]meta/a">
|
||||
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[dir_last_admin_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</form>
|
||||
[end]
|
||||
|
||||
|
||||
[else]
|
||||
|
||||
<h1>{meta_header}</h1>
|
||||
|
||||
[if item_is]
|
||||
<form method="post" action="[doc_base_url][dir][item_url]/meta">
|
||||
|
||||
[if item_is]
|
||||
[if item_can_write]
|
||||
<form id="additem" method="post" action="[doc_base_url][dir][item_url]/meta">
|
||||
<fieldset>
|
||||
<legend>{form_meta_legend}</legend>
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[item_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
|
||||
@@ -14,28 +42,20 @@
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
[else]
|
||||
<pre>[item_meta_str]</pre>
|
||||
[end]
|
||||
[else]
|
||||
[if dir_can_write]
|
||||
<form id="additem" method="post" action="[doc_base_url][dir]meta">
|
||||
<fieldset>
|
||||
<legend>{form_meta_legend}</legend>
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[dir_last_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
<form method="post" action="[doc_base_url][dir]meta">
|
||||
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[dir_last_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
[else]
|
||||
<pre>[dir_last_meta_str]</pre>
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</form>
|
||||
[end]
|
||||
|
||||
[end]
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[for slog_tab]
|
||||
|
||||
<tr>
|
||||
<td class="[if slog_tab_is_error]winix_slogerror[end][if slog_tab_is_warning]winix_slogwarning[end][if slog_tab_is_info]winix_sloginfo[end]">
|
||||
<th class="[if slog_tab_is_error]winix_slogerror[end][if slog_tab_is_warning]winix_slogwarning[end][if slog_tab_is_info]winix_sloginfo[end]">
|
||||
|
||||
[if slog_tab_is_info]
|
||||
{slog_info}:
|
||||
@@ -19,7 +19,7 @@
|
||||
{slog_error}:
|
||||
[end]
|
||||
|
||||
</td>
|
||||
</th>
|
||||
<td>
|
||||
[slog_tab_print]
|
||||
</td>
|
||||
|
||||
24
locale/en
24
locale/en
@@ -10,6 +10,9 @@ logged_as_long = You are logged as
|
||||
display_guest_name = guest
|
||||
unknown = unknown
|
||||
|
||||
syntax_error_in_line = Syntax error in line:
|
||||
|
||||
|
||||
this_ip_is_banned_until = We are sorry but your IP address is banned until to:
|
||||
|
||||
account_not_activated = This account is not activated yet.
|
||||
@@ -152,13 +155,32 @@ ls_header = Directory listing
|
||||
ls_pictures_in_dir = Pictures in directory
|
||||
ls_no_picture = There are not any pictures in this directory
|
||||
|
||||
ipban_header = IP Banned
|
||||
ipban_col_id = Id
|
||||
ipban_col_ip_address = IP address
|
||||
ipban_col_login_failures = login failures
|
||||
ipban_col_login_allowed = Login allowed
|
||||
ipban_col_ban_level = Ban level
|
||||
ipban_col_active_flag = Active flag
|
||||
ipban_col_last_used = Last used
|
||||
ipban_col_expires = Expires
|
||||
ipban_col_remove = Remove
|
||||
ipban_loggin_allowed = yes
|
||||
ipban_loggin_not_allowed = no
|
||||
ipban_has_active_flag = yes
|
||||
ipban_remove_ip = remove
|
||||
ipban_remove_all_ip = Remove all IP's from the list
|
||||
ipban_ban_list_empty = There are not any IP addresses banned at the moment.
|
||||
|
||||
|
||||
|
||||
man_header = Man
|
||||
man_winix_funcions = Winix functions
|
||||
man_ezc_functions = EZC templates functions
|
||||
|
||||
|
||||
meta_header = Meta
|
||||
form_meta_legend = Form for changing meta info
|
||||
meta_admin_header = Admin meta
|
||||
|
||||
|
||||
mkdir_header = Make directory
|
||||
|
||||
23
locale/pl
23
locale/pl
@@ -11,6 +11,9 @@ logged_as_long = Aktualnie jesteś zalogowany jako
|
||||
display_guest_name = gość
|
||||
unknown = nie znany
|
||||
|
||||
syntax_error_in_line = Błąd składni w linii:
|
||||
|
||||
|
||||
this_ip_is_banned_until = Przepraszamy ale twój adres IP jest zablokowany aż do:
|
||||
|
||||
|
||||
@@ -156,8 +159,26 @@ ls_pictures_in_dir = Obrazy w katalogu
|
||||
ls_no_picture = W tym katalogu nie ma żadnego obrazu
|
||||
|
||||
|
||||
ipban_header = Lista zbanowanych adresów IP
|
||||
ipban_col_id = L.p.
|
||||
ipban_col_ip_address = adres IP
|
||||
ipban_col_login_failures = nieprawidłowe logowania
|
||||
ipban_col_login_allowed = możliwe logowanie
|
||||
ipban_col_ban_level = Rodzaj banu
|
||||
ipban_col_active_flag = Flaga active
|
||||
ipban_col_last_used = Ostatnio używany
|
||||
ipban_col_expires = Wygasza
|
||||
ipban_col_remove = Usuń
|
||||
ipban_loggin_allowed = tak
|
||||
ipban_loggin_not_allowed = nie
|
||||
ipban_has_active_flag = tak
|
||||
ipban_remove_ip = usuń
|
||||
ipban_remove_all_ip = Usuń wszystkie adresy IP z listy
|
||||
ipban_ban_list_empty = W tej chwili nie ma żadnych zbanowanych adresów IP.
|
||||
|
||||
|
||||
meta_header = Meta
|
||||
form_meta_legend = Formularz zmiany meta informacji
|
||||
meta_admin_header = Admin meta
|
||||
|
||||
|
||||
man_header = Man
|
||||
|
||||
@@ -53,6 +53,15 @@ bool Reply::HasAccess()
|
||||
if( !files_dir || !system->HasWriteAccess(*files_dir) )
|
||||
return false;
|
||||
|
||||
|
||||
PT::Space * thread_space = cur->request->item.ameta.FindSpace(L"thread");
|
||||
|
||||
if( thread_space )
|
||||
{
|
||||
if( thread_space->Bool(L"closed", false) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ bool EditTicket::HasAccess()
|
||||
if( cur->mount->type != ticket_info->mount_type_ticket )
|
||||
return false;
|
||||
|
||||
// !! CHECKME what about closing threads?
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -187,19 +189,39 @@ void EditTicket::MakePost()
|
||||
}
|
||||
|
||||
|
||||
void EditTicket::CloseTicket()
|
||||
{
|
||||
PT::Space & ticket_space = cur->request->item.ameta.FindAddSpace(L"ticket");
|
||||
ticket_space.Add(L"closed", true);
|
||||
|
||||
PT::Space & thread_space = cur->request->item.ameta.FindAddSpace(L"thread");
|
||||
thread_space.Add(L"closed", true);
|
||||
|
||||
if( db->EditAdminMetaById(cur->request->item.ameta, cur->request->item.id) == WINIX_ERR_OK )
|
||||
log << log3 << "EditTicket: closing ticket" << logend;
|
||||
}
|
||||
|
||||
|
||||
void EditTicket::MakeGet()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
ticket_info->FindCurrentConf();
|
||||
if( cur->request->IsParam(L"close") )
|
||||
{
|
||||
CloseTicket();
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
ticket_info->Clear();
|
||||
ticket_info->FindCurrentConf();
|
||||
|
||||
Ticket & ticket = PrepareTicket();
|
||||
PT::Space & meta = PrepareSpace();
|
||||
ticket_info->ticket = &ticket;
|
||||
ticket_info->item = &cur->request->item;
|
||||
Ticket & ticket = PrepareTicket();
|
||||
PT::Space & meta = PrepareSpace();
|
||||
ticket_info->ticket = &ticket;
|
||||
ticket_info->item = &cur->request->item;
|
||||
|
||||
// copy meta info to display correctly new files
|
||||
ticket_info->CopyTicketSpace(meta, cur->request->item);
|
||||
// copy meta info to display correctly new files
|
||||
ticket_info->CopyTicketSpace(meta, cur->request->item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ private:
|
||||
PT::Space & PrepareSpace();
|
||||
void ChangeTicket(Ticket & ticket, Item & item);
|
||||
void Submit(Ticket & ticket, Item & item);
|
||||
void CloseTicket();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -274,6 +274,14 @@ void ticket_meta_value(Info & i)
|
||||
space(i, ticket_info.item->meta);
|
||||
}
|
||||
|
||||
void ticket_is_closed(Info & i)
|
||||
{
|
||||
PT::Space * ticket_space = cur->request->item.ameta.FindSpace(L"ticket");
|
||||
|
||||
if( ticket_space )
|
||||
i.res = ticket_space->Bool(L"closed", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace ns_tickets_tab
|
||||
@@ -414,6 +422,21 @@ void tickets_tab(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_is_closed(Info & i)
|
||||
{
|
||||
tickets_tab_check_reqid();
|
||||
|
||||
if( tickets_value.is_item )
|
||||
{
|
||||
PT::Space * ticket_space = tickets_value.item->ameta.FindSpace(L"ticket");
|
||||
|
||||
if( ticket_space )
|
||||
i.res = ticket_space->Bool(L"closed", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tickets_tab_url(Info & i)
|
||||
{
|
||||
tickets_tab_check_reqid();
|
||||
@@ -844,8 +867,10 @@ using namespace ns_ticket_tab;
|
||||
fun->Insert("ticket_can_edit", ticket_can_edit);
|
||||
fun->Insert("ticket_is_creating_new", ticket_is_creating_new);
|
||||
fun->Insert("ticket_meta_value", ticket_meta_value);
|
||||
fun->Insert("ticket_is_closed", ticket_is_closed);
|
||||
|
||||
fun->Insert("tickets_tab", tickets_tab);
|
||||
fun->Insert("tickets_tab_is_closed", tickets_tab_is_closed);
|
||||
fun->Insert("tickets_tab_url", tickets_tab_url);
|
||||
fun->Insert("tickets_tab_subject_empty", tickets_tab_subject_empty);
|
||||
fun->Insert("tickets_tab_subject", tickets_tab_subject);
|
||||
|
||||
@@ -132,7 +132,7 @@ dir.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
|
||||
dir.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
dir.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
|
||||
dir.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
|
||||
dir.o: ../functions/who.h ../functions/vim.h
|
||||
dir.o: ../functions/who.h ../functions/vim.h miscspace.h
|
||||
doc.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/generator.h
|
||||
doc.o: ../../ezc/src/pattern.h ../../ezc/src/item.h ../../ezc/src/funinfo.h
|
||||
doc.o: ../../ezc/src/functions.h ../../ezc/src/stringconv.h
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "templates.h"
|
||||
#include "core/misc.h"
|
||||
#include "functions/functions.h"
|
||||
#include "miscspace.h"
|
||||
|
||||
|
||||
namespace TemplatesFunctions
|
||||
@@ -432,14 +433,71 @@ void dir_last_has_html_template(Info & i)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void dir_last_meta_str(Info & i)
|
||||
{
|
||||
cur->request->dir_tab.back()->meta.Serialize(i.out, true, false);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_meta(Info & i)
|
||||
{
|
||||
space(i, cur->request->dir_tab.back()->meta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_meta_tab(Info & i)
|
||||
{
|
||||
spaces_tab(i, cur->request->dir_tab.back()->meta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_meta_tab_value(Info & i)
|
||||
{
|
||||
spaces_tab_value(i, cur->request->dir_tab.back()->meta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void dir_last_meta_tab_has_next(Info & i)
|
||||
{
|
||||
spaces_tab_has_next(i, cur->request->dir_tab.back()->meta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void dir_last_admin_meta_str(Info & i)
|
||||
{
|
||||
cur->request->dir_tab.back()->ameta.Serialize(i.out, true, false);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_admin_meta(Info & i)
|
||||
{
|
||||
space(i, cur->request->dir_tab.back()->ameta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_admin_meta_tab(Info & i)
|
||||
{
|
||||
spaces_tab(i, cur->request->dir_tab.back()->ameta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_admin_meta_tab_value(Info & i)
|
||||
{
|
||||
spaces_tab_value(i, cur->request->dir_tab.back()->ameta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_admin_meta_tab_has_next(Info & i)
|
||||
{
|
||||
spaces_tab_has_next(i, cur->request->dir_tab.back()->ameta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -393,10 +393,12 @@ void item_meta_str(Info & i)
|
||||
|
||||
void item_meta(Info & i)
|
||||
{
|
||||
space(i, cur->request->last_item->meta);
|
||||
space(i, cur->request->last_item->meta); // !! a new interface (last_item instead of item)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void item_meta_tab(Info & i)
|
||||
{
|
||||
spaces_tab(i, cur->request->last_item->meta);
|
||||
@@ -418,6 +420,38 @@ void item_meta_tab_has_next(Info & i)
|
||||
|
||||
|
||||
|
||||
void item_admin_meta_str(Info & i)
|
||||
{
|
||||
cur->request->item.ameta.Serialize(i.out, true, false);
|
||||
}
|
||||
|
||||
|
||||
void item_admin_meta(Info & i)
|
||||
{
|
||||
space(i, cur->request->last_item->ameta);
|
||||
}
|
||||
|
||||
|
||||
void item_admin_meta_tab(Info & i)
|
||||
{
|
||||
spaces_tab(i, cur->request->last_item->ameta);
|
||||
}
|
||||
|
||||
|
||||
void item_admin_meta_tab_value(Info & i)
|
||||
{
|
||||
spaces_tab_value(i, cur->request->last_item->ameta);
|
||||
}
|
||||
|
||||
|
||||
void item_admin_meta_tab_has_next(Info & i)
|
||||
{
|
||||
spaces_tab_has_next(i, cur->request->last_item->ameta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static size_t item_index;
|
||||
|
||||
@@ -225,8 +225,36 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("dir_last_html_template", dir_last_html_template);
|
||||
ezc_functions.Insert("dir_last_has_html_template", dir_last_has_html_template);
|
||||
ezc_functions.Insert("dir_last_meta_str", dir_last_meta_str);
|
||||
ezc_functions.Insert("dir_last_meta", dir_last_meta);
|
||||
ezc_functions.Insert("dir_last_meta_tab", dir_last_meta_tab);
|
||||
ezc_functions.Insert("dir_last_meta_tab_value", dir_last_meta_tab_value);
|
||||
ezc_functions.Insert("dir_last_meta_tab_has_next", dir_last_meta_tab_has_next);
|
||||
ezc_functions.Insert("dir_last_admin_meta_str", dir_last_admin_meta_str);
|
||||
ezc_functions.Insert("dir_last_admin_meta", dir_last_admin_meta);
|
||||
ezc_functions.Insert("dir_last_admin_meta_tab", dir_last_admin_meta_tab);
|
||||
ezc_functions.Insert("dir_last_admin_meta_tab_value", dir_last_admin_meta_tab_value);
|
||||
ezc_functions.Insert("dir_last_admin_meta_tab_has_next", dir_last_admin_meta_tab_has_next);
|
||||
|
||||
|
||||
/*
|
||||
doc
|
||||
*/
|
||||
ezc_functions.Insert("doc_title", doc_title);
|
||||
ezc_functions.Insert("doc_proto", doc_proto);
|
||||
ezc_functions.Insert("doc_proto_static", doc_proto_static);
|
||||
ezc_functions.Insert("doc_proto_common", doc_proto_common);
|
||||
ezc_functions.Insert("doc_base_url", doc_base_url);
|
||||
ezc_functions.Insert("doc_base_url_static", doc_base_url_static);
|
||||
ezc_functions.Insert("doc_base_url_common", doc_base_url_common);
|
||||
ezc_functions.Insert("doc_current_url", doc_current_url);
|
||||
ezc_functions.Insert("doc_css_tab", doc_css_tab);
|
||||
ezc_functions.Insert("doc_css_tab_file", doc_css_tab_file);
|
||||
ezc_functions.Insert("doc_css_tab_file_is_global", doc_css_tab_file_is_global);
|
||||
ezc_functions.Insert("doc_css_tab_has_next", doc_css_tab_has_next);
|
||||
ezc_functions.Insert("doc_css_is_empty", doc_css_is_empty);
|
||||
ezc_functions.Insert("doc_css_is_one", doc_css_is_one);
|
||||
ezc_functions.Insert("doc_css_more_than_one", doc_css_more_than_one);
|
||||
|
||||
/*
|
||||
env
|
||||
*/
|
||||
@@ -253,26 +281,6 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("fil_new_line_to_br", fil_new_line_to_br);
|
||||
|
||||
|
||||
/*
|
||||
doc
|
||||
*/
|
||||
ezc_functions.Insert("doc_title", doc_title);
|
||||
ezc_functions.Insert("doc_proto", doc_proto);
|
||||
ezc_functions.Insert("doc_proto_static", doc_proto_static);
|
||||
ezc_functions.Insert("doc_proto_common", doc_proto_common);
|
||||
ezc_functions.Insert("doc_base_url", doc_base_url);
|
||||
ezc_functions.Insert("doc_base_url_static", doc_base_url_static);
|
||||
ezc_functions.Insert("doc_base_url_common", doc_base_url_common);
|
||||
ezc_functions.Insert("doc_current_url", doc_current_url);
|
||||
ezc_functions.Insert("doc_css_tab", doc_css_tab);
|
||||
ezc_functions.Insert("doc_css_tab_file", doc_css_tab_file);
|
||||
ezc_functions.Insert("doc_css_tab_file_is_global", doc_css_tab_file_is_global);
|
||||
ezc_functions.Insert("doc_css_tab_has_next", doc_css_tab_has_next);
|
||||
ezc_functions.Insert("doc_css_is_empty", doc_css_is_empty);
|
||||
ezc_functions.Insert("doc_css_is_one", doc_css_is_one);
|
||||
ezc_functions.Insert("doc_css_more_than_one", doc_css_more_than_one);
|
||||
|
||||
|
||||
/*
|
||||
insert
|
||||
*/
|
||||
@@ -345,6 +353,11 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("item_meta_tab", item_meta_tab);
|
||||
ezc_functions.Insert("item_meta_tab_value", item_meta_tab_value);
|
||||
ezc_functions.Insert("item_meta_tab_has_next", item_meta_tab_has_next);
|
||||
ezc_functions.Insert("item_admin_meta_str", item_admin_meta_str);
|
||||
ezc_functions.Insert("item_admin_meta", item_admin_meta);
|
||||
ezc_functions.Insert("item_admin_meta_tab", item_admin_meta_tab);
|
||||
ezc_functions.Insert("item_admin_meta_tab_value", item_admin_meta_tab_value);
|
||||
ezc_functions.Insert("item_admin_meta_tab_has_next", item_admin_meta_tab_has_next);
|
||||
|
||||
ezc_functions.Insert("item_tab", item_tab);
|
||||
ezc_functions.Insert("item_tab_index", item_tab_index);
|
||||
|
||||
@@ -135,6 +135,15 @@ namespace TemplatesFunctions
|
||||
void dir_last_html_template(Info & i);
|
||||
void dir_last_has_html_template(Info & i);
|
||||
void dir_last_meta_str(Info & i);
|
||||
void dir_last_meta(Info & i);
|
||||
void dir_last_meta_tab(Info & i);
|
||||
void dir_last_meta_tab_value(Info & i);
|
||||
void dir_last_meta_tab_has_next(Info & i);
|
||||
void dir_last_admin_meta_str(Info & i);
|
||||
void dir_last_admin_meta(Info & i);
|
||||
void dir_last_admin_meta_tab(Info & i);
|
||||
void dir_last_admin_meta_tab_value(Info & i);
|
||||
void dir_last_admin_meta_tab_has_next(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
@@ -256,6 +265,11 @@ namespace TemplatesFunctions
|
||||
void item_meta_tab(Info & i);
|
||||
void item_meta_tab_value(Info & i);
|
||||
void item_meta_tab_has_next(Info & i);
|
||||
void item_admin_meta_str(Info & i);
|
||||
void item_admin_meta(Info & i);
|
||||
void item_admin_meta_tab(Info & i);
|
||||
void item_admin_meta_tab_value(Info & i);
|
||||
void item_admin_meta_tab_has_next(Info & i);
|
||||
|
||||
void item_tab(Info & i);
|
||||
void item_tab_index(Info & i);
|
||||
|
||||
Reference in New Issue
Block a user