added: new plugin: menu
fixed: System::FollowAllLinks didn't check permissions to a file (only to a simlink or a directory) added: new ezc function: insert_page now we are able to nest pages in pages git-svn-id: svn://ttmath.org/publicrep/winix/trunk@750 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -136,6 +136,33 @@ indexpatterns.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
||||
indexpatterns.o: ../templates/htmltextstream.h ../core/session.h
|
||||
indexpatterns.o: ../core/user.h ../core/plugindata.h ../core/rebus.h
|
||||
indexpatterns.o: ../core/mount.h ../templates/locale.h
|
||||
insert.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
||||
insert.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
||||
insert.o: ../../ezc/src/item.h ../../ezc/src/funinfo.h
|
||||
insert.o: ../../ezc/src/functions.h ../../ezc/src/stringconv.h misc.h
|
||||
insert.o: localefilter.h locale.h ../core/confparser.h htmltextstream.h
|
||||
insert.o: ../core/textstream.h ../core/user.h patterncacher.h ../core/item.h
|
||||
insert.o: ckeditorgetparser.h ../core/httpsimpleparser.h ../core/log.h
|
||||
insert.o: ../core/textstream.h ../core/logmanipulators.h ../core/slog.h
|
||||
insert.o: ../core/cur.h ../core/request.h ../core/requesttypes.h
|
||||
insert.o: ../core/error.h ../core/config.h ../core/confparser.h
|
||||
insert.o: ../core/htmlfilter.h ../templates/htmltextstream.h
|
||||
insert.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
||||
insert.o: ../core/rebus.h ../core/mount.h ../templates/locale.h
|
||||
insert.o: indexpatterns.h ../core/config.h ../core/cur.h ../core/system.h
|
||||
insert.o: ../core/dirs.h ../core/dircontainer.h ../db/db.h ../db/dbbase.h
|
||||
insert.o: ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
|
||||
insert.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/group.h
|
||||
insert.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/log.h
|
||||
insert.o: ../notify/notify.h ../notify/notifypool.h ../templates/misc.h
|
||||
insert.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
|
||||
insert.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
|
||||
insert.o: ../core/lastcontainer.h ../core/mounts.h ../core/mountparser.h
|
||||
insert.o: ../core/crypt.h ../core/run.h ../core/users.h ../core/groups.h
|
||||
insert.o: ../core/group.h ../core/loadavg.h ../core/thumb.h
|
||||
insert.o: ../core/basethread.h ../core/sessionmanager.h
|
||||
insert.o: ../core/sessioncontainer.h ../core/system.h ../core/htmlfilter.h
|
||||
insert.o: ../core/request.h ../core/misc.h
|
||||
item.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
||||
item.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
||||
item.o: ../../ezc/src/item.h ../../ezc/src/funinfo.h
|
||||
|
@@ -1 +1 @@
|
||||
o = adduser.o dir.o doc.o filters.o htmltextstream.o indexpatterns.o item.o last.o locale.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o slog.o stat.o sys.o template.o templates.o upload.o uptime.o user.o who.o winix.o
|
||||
o = adduser.o dir.o doc.o filters.o htmltextstream.o indexpatterns.o insert.o item.o last.o locale.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o slog.o stat.o sys.o template.o templates.o upload.o uptime.o user.o who.o winix.o
|
||||
|
107
templates/insert.cpp
Executable file
107
templates/insert.cpp
Executable file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "templates.h"
|
||||
#include "misc.h"
|
||||
#include "core/request.h"
|
||||
#include "core/misc.h"
|
||||
|
||||
|
||||
// max 20 nested insert_page ezc functions allowed
|
||||
#define WINIX_TEMPLATES_INSERT_PAGE_MAX 20
|
||||
|
||||
|
||||
|
||||
namespace TemplatesFunctions
|
||||
{
|
||||
|
||||
struct InsertPageInfo
|
||||
{
|
||||
std::vector<Item*> dirs;
|
||||
Item item;
|
||||
EzcGen ezc_gen;
|
||||
HtmlTextStream run_content;
|
||||
};
|
||||
|
||||
|
||||
static InsertPageInfo insert_page_info[WINIX_TEMPLATES_INSERT_PAGE_MAX];
|
||||
size_t insert_page_cur = 0;
|
||||
size_t insert_page_reqid = 0;
|
||||
|
||||
|
||||
|
||||
void insert_page_run(Info & i)
|
||||
{
|
||||
InsertPageInfo & info = insert_page_info[insert_page_cur];
|
||||
Ezc::Pattern * pat = pattern_cacher.GetPattern(info.item);
|
||||
|
||||
log << "insert page: using " << insert_page_cur << " generator" << logend;
|
||||
insert_page_cur += 1;
|
||||
|
||||
info.run_content.Clear();
|
||||
info.ezc_gen.Generate(info.run_content, *pat);
|
||||
item_print_content(i.out, info.run_content.Str(), info.item.content_type);
|
||||
|
||||
insert_page_cur -= 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool insert_page_init(const std::wstring & path)
|
||||
{
|
||||
if( path.empty() )
|
||||
return false;
|
||||
|
||||
log << "insert page: " << path << logend;
|
||||
|
||||
if( insert_page_reqid != cur->request->id )
|
||||
{
|
||||
insert_page_reqid = cur->request->id;
|
||||
insert_page_cur = 0;
|
||||
}
|
||||
|
||||
if( insert_page_cur >= WINIX_TEMPLATES_INSERT_PAGE_MAX )
|
||||
{
|
||||
log << log1 << "Templates: insert_page: maximum nested insert_page exceeded" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void insert_page(Info & i)
|
||||
{
|
||||
if( !insert_page_init(i.par) )
|
||||
return;
|
||||
|
||||
InsertPageInfo & info = insert_page_info[insert_page_cur];
|
||||
|
||||
if( system->FollowAllLinks(cur->request->dir_tab, i.par, info.dirs, info.item) == 1 )
|
||||
{
|
||||
if( system->HasReadExecAccess(info.item) )
|
||||
insert_page_run(i);
|
||||
else
|
||||
if( system->HasReadAccess(info.item) )
|
||||
item_print_content(i.out, info.item.content, info.item.content_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -210,6 +210,11 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("doc_css_more_than_one", doc_css_more_than_one);
|
||||
|
||||
|
||||
/*
|
||||
insert
|
||||
*/
|
||||
ezc_functions.Insert("insert_page", insert_page);
|
||||
|
||||
|
||||
/*
|
||||
item
|
||||
|
@@ -140,6 +140,13 @@ namespace TemplatesFunctions
|
||||
void fil_tosmall(Info & i);
|
||||
void fil_firstup(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
insert
|
||||
*/
|
||||
void insert_page(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
item
|
||||
*/
|
||||
|
Reference in New Issue
Block a user