added: functions: ckeditor, uptime
added: for function: login - a html pattern for GET request git-svn-id: svn://ttmath.org/publicrep/winix/trunk@567 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -84,15 +84,17 @@ request.o: mounts.h mount.h locale.h ../confparser/confparser.h plugin.h
|
||||
request.o: pluginmsg.h misc.h db.h
|
||||
requestcontroller.o: requestcontroller.h ../content/content.h ../core/item.h
|
||||
requestcontroller.o: ../templates/templates.h ../templates/patterncacher.h
|
||||
requestcontroller.o: misc.h item.h ../core/thread.h ../core/ticket.h
|
||||
requestcontroller.o: ../core/done.h sessionmanager.h sessioncontainer.h
|
||||
requestcontroller.o: session.h done.h error.h log.h user.h rebus.h
|
||||
requestcontroller.o: functionparser.h requesttypes.h data.h dirs.h
|
||||
requestcontroller.o: dircontainer.h users.h ugcontainer.h groups.h group.h
|
||||
requestcontroller.o: functions.h function.h lastcontainer.h mounts.h mount.h
|
||||
requestcontroller.o: locale.h ../confparser/confparser.h request.h thread.h
|
||||
requestcontroller.o: compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
requestcontroller.o: htmlfilter.h postmultiparser.h ticket.h postparser.h
|
||||
requestcontroller.o: misc.h item.h ../templates/ckeditorgetparser.h
|
||||
requestcontroller.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
requestcontroller.o: ../core/thread.h ../core/ticket.h ../core/done.h
|
||||
requestcontroller.o: sessionmanager.h sessioncontainer.h session.h done.h
|
||||
requestcontroller.o: error.h log.h user.h rebus.h functionparser.h
|
||||
requestcontroller.o: requesttypes.h data.h dirs.h dircontainer.h users.h
|
||||
requestcontroller.o: ugcontainer.h groups.h group.h functions.h function.h
|
||||
requestcontroller.o: lastcontainer.h mounts.h mount.h locale.h
|
||||
requestcontroller.o: ../confparser/confparser.h request.h thread.h compress.h
|
||||
requestcontroller.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
requestcontroller.o: postmultiparser.h ticket.h postparser.h
|
||||
requestcontroller.o: httpsimpleparser.h cookieparser.h notify.h
|
||||
requestcontroller.o: ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
requestcontroller.o: ../core/locale.h ../templates/misc.h
|
||||
|
@@ -121,6 +121,7 @@ void Config::AssignValues()
|
||||
data.base_server = Text("base_server");
|
||||
data.base_url_prefix = Text("base_url_prefix");
|
||||
data.base_url_static_prefix = Text("base_url_static_prefix");
|
||||
data.base_url_static_ext_prefix = Text("base_url_static_ext_prefix");
|
||||
data.base_url_static_auth_prefix = Text("base_url_static_auth_prefix");
|
||||
|
||||
NoLastSlash(data.base_server);
|
||||
@@ -128,6 +129,7 @@ void Config::AssignValues()
|
||||
|
||||
data.base_url = data.base_url_prefix + data.base_server;
|
||||
data.base_url_static = data.base_url_static_prefix + data.base_server;
|
||||
data.base_url_static_ext = data.base_url_static_ext_prefix + data.base_server;
|
||||
data.base_url_static_auth = data.base_url_static_auth_prefix + data.base_server;
|
||||
|
||||
data.priv_no_user = Text("priv_no_user", "-- no user --");
|
||||
|
@@ -17,6 +17,7 @@ Data::Data()
|
||||
{
|
||||
signal_hup = false;
|
||||
stdout_is_closed = false;
|
||||
how_many_logged = 0;
|
||||
|
||||
// the rest will be read from a config file
|
||||
}
|
||||
|
@@ -72,6 +72,7 @@ public:
|
||||
std::string base_server;
|
||||
std::string base_url_prefix;
|
||||
std::string base_url_static_prefix;
|
||||
std::string base_url_static_ext_prefix;
|
||||
std::string base_url_static_auth_prefix;
|
||||
|
||||
std::string http_session_id_name;
|
||||
@@ -133,6 +134,9 @@ public:
|
||||
// base_url_static_prefix + base_server
|
||||
std::string base_url_static;
|
||||
|
||||
// additional static server for common content such as ckeditor
|
||||
std::string base_url_static_ext;
|
||||
|
||||
// base_url_static_auth_prefix + base_server
|
||||
std::string base_url_static_auth;
|
||||
|
||||
@@ -185,6 +189,11 @@ public:
|
||||
// rebus (captcha)
|
||||
Rebus rebus;
|
||||
|
||||
// the time when the winix starts
|
||||
time_t system_start;
|
||||
|
||||
// how many logged users
|
||||
long how_many_logged;
|
||||
|
||||
Data();
|
||||
|
||||
|
@@ -35,6 +35,12 @@
|
||||
#define FUN_CREATETICKET 18
|
||||
#define FUN_EDITTICKET 19
|
||||
#define FUN_TICKET 20
|
||||
#define FUN_UPTIME 21
|
||||
//#define FUN_MV 23
|
||||
//#define FUN_UNAME 24
|
||||
//#define FUN_CHMOD 25
|
||||
//#define FUN_CHOWN 26
|
||||
#define FUN_CKEDITOR 27
|
||||
|
||||
|
||||
|
||||
|
@@ -112,6 +112,32 @@ void Functions::ReadFunctions()
|
||||
f.item.url = "ticket";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
|
||||
f.code = FUN_UPTIME;
|
||||
f.item.url = "uptime";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
|
||||
/*
|
||||
f.code = FUN_MV;
|
||||
f.item.url = "mv";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
|
||||
f.code = FUN_UNAME;
|
||||
f.item.url = "uname";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
|
||||
f.code = FUN_CHMOD;
|
||||
f.item.url = "chmod";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
|
||||
f.code = FUN_CHOWN;
|
||||
f.item.url = "chown";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
*/
|
||||
|
||||
f.code = FUN_CKEDITOR;
|
||||
f.item.url = "ckeditor";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
|
||||
|
||||
// functions which need more privileges
|
||||
|
||||
|
@@ -48,8 +48,8 @@ void HTMLFilter::Filter(const std::string & in, std::string & out)
|
||||
|
||||
HTMLFilter::HTMLFilter()
|
||||
{
|
||||
pstack = new Item[CMSLU_HTMLFILTER_STACK_MAXLEN];
|
||||
buffer = new char[CMSLU_HTMLFILTER_BUFFER_MAXLEN];
|
||||
pstack = new Item[WINIX_HTMLFILTER_STACK_MAXLEN];
|
||||
buffer = new char[WINIX_HTMLFILTER_BUFFER_MAXLEN];
|
||||
|
||||
tab_size = 2;
|
||||
trim_white = false;
|
||||
@@ -60,16 +60,16 @@ HTMLFilter::HTMLFilter()
|
||||
HTMLFilter::HTMLFilter(const HTMLFilter & f)
|
||||
{
|
||||
// don't need to copy the stack
|
||||
pstack = new Item[CMSLU_HTMLFILTER_STACK_MAXLEN];
|
||||
buffer = new char[CMSLU_HTMLFILTER_BUFFER_MAXLEN];
|
||||
pstack = new Item[WINIX_HTMLFILTER_STACK_MAXLEN];
|
||||
buffer = new char[WINIX_HTMLFILTER_BUFFER_MAXLEN];
|
||||
}
|
||||
|
||||
|
||||
HTMLFilter & HTMLFilter::operator=(const HTMLFilter & f)
|
||||
{
|
||||
// don't need to copy the stack
|
||||
pstack = new Item[CMSLU_HTMLFILTER_STACK_MAXLEN];
|
||||
buffer = new char[CMSLU_HTMLFILTER_BUFFER_MAXLEN];
|
||||
pstack = new Item[WINIX_HTMLFILTER_STACK_MAXLEN];
|
||||
buffer = new char[WINIX_HTMLFILTER_BUFFER_MAXLEN];
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ return pstack[stack_len-1];
|
||||
|
||||
bool HTMLFilter::PushStack()
|
||||
{
|
||||
if( stack_len == CMSLU_HTMLFILTER_STACK_MAXLEN )
|
||||
if( stack_len == WINIX_HTMLFILTER_STACK_MAXLEN )
|
||||
// oops, too many items
|
||||
return false;
|
||||
|
||||
@@ -302,7 +302,7 @@ void HTMLFilter::ReadItemName()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for( i=0 ; IsValidCharForName(*pchar) && i<CMSLU_HTMLFILTER_ITEM_MAXLEN-1 ; ++i )
|
||||
for( i=0 ; IsValidCharForName(*pchar) && i<WINIX_HTMLFILTER_ITEM_MAXLEN-1 ; ++i )
|
||||
{
|
||||
LastItem().name[i] = *pchar;
|
||||
++pchar;
|
||||
@@ -331,7 +331,7 @@ size_t i = 0;
|
||||
bool was_white;
|
||||
|
||||
|
||||
for( ; str < end && i<CMSLU_HTMLFILTER_BUFFER_MAXLEN-1 ; ++str )
|
||||
for( ; str < end && i<WINIX_HTMLFILTER_BUFFER_MAXLEN-1 ; ++str )
|
||||
{
|
||||
was_white = false;
|
||||
|
||||
@@ -373,7 +373,7 @@ void HTMLFilter::PutTrim(const char * str, const char * end)
|
||||
size_t buf_len;
|
||||
|
||||
// this buffer must have at least 2 bytes (PutTrimFillBuffer needs it)
|
||||
if( !trim_white || CMSLU_HTMLFILTER_BUFFER_MAXLEN < 2 )
|
||||
if( !trim_white || WINIX_HTMLFILTER_BUFFER_MAXLEN < 2 )
|
||||
{
|
||||
Put(str, end);
|
||||
return;
|
||||
@@ -391,7 +391,7 @@ void HTMLFilter::PutOpeningTag(const char * tag)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if( CMSLU_HTMLFILTER_BUFFER_MAXLEN < CMSLU_HTMLFILTER_ITEM_MAXLEN+2 )
|
||||
if( WINIX_HTMLFILTER_BUFFER_MAXLEN < WINIX_HTMLFILTER_ITEM_MAXLEN+2 )
|
||||
return;
|
||||
|
||||
buffer[0] = '<';
|
||||
@@ -411,7 +411,7 @@ void HTMLFilter::PutClosingTag(const char * tag)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if( CMSLU_HTMLFILTER_BUFFER_MAXLEN < CMSLU_HTMLFILTER_ITEM_MAXLEN+3 )
|
||||
if( WINIX_HTMLFILTER_BUFFER_MAXLEN < WINIX_HTMLFILTER_ITEM_MAXLEN+3 )
|
||||
return;
|
||||
|
||||
buffer[0] = '<';
|
||||
@@ -439,7 +439,7 @@ void HTMLFilter::PutTabs(size_t len)
|
||||
size_t spaces = (len-1) * tab_size;
|
||||
size_t i;
|
||||
|
||||
if( spaces < CMSLU_HTMLFILTER_BUFFER_MAXLEN )
|
||||
if( spaces < WINIX_HTMLFILTER_BUFFER_MAXLEN )
|
||||
{
|
||||
for(i=0 ; i<spaces ; ++i)
|
||||
buffer[i] = ' ';
|
||||
|
@@ -16,14 +16,14 @@
|
||||
|
||||
|
||||
// max length of a name of a html tag (with terminating null)
|
||||
#define CMSLU_HTMLFILTER_ITEM_MAXLEN 30
|
||||
#define WINIX_HTMLFILTER_ITEM_MAXLEN 30
|
||||
|
||||
// depth of the html tree
|
||||
#define CMSLU_HTMLFILTER_STACK_MAXLEN 100
|
||||
#define WINIX_HTMLFILTER_STACK_MAXLEN 100
|
||||
|
||||
// length of a buffer used for printing
|
||||
// it should be at least: CMSLU_HTMLFILTER_ITEM_MAXLEN+3
|
||||
#define CMSLU_HTMLFILTER_BUFFER_MAXLEN 1024
|
||||
// it should be at least: WINIX_HTMLFILTER_ITEM_MAXLEN+3
|
||||
#define WINIX_HTMLFILTER_BUFFER_MAXLEN 1024
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ protected:
|
||||
|
||||
struct Item
|
||||
{
|
||||
char name[CMSLU_HTMLFILTER_ITEM_MAXLEN];
|
||||
char name[WINIX_HTMLFILTER_ITEM_MAXLEN];
|
||||
size_t name_len;
|
||||
|
||||
enum Type
|
||||
|
@@ -295,6 +295,7 @@ return DateToStr(ptm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// this format is used with cookies
|
||||
const char * DateToStrCookie(int year, int month, int day, int hour, int min, int sec)
|
||||
{
|
||||
|
@@ -16,10 +16,10 @@
|
||||
#include "../templatesnotify/templatesnotify.h"
|
||||
|
||||
|
||||
#define CMSLU_NOTIFY_ITEM_ADD 1
|
||||
#define CMSLU_NOTIFY_ITEM_EDIT 2
|
||||
#define CMSLU_NOTIFY_ITEM_DELETE 4
|
||||
#define CMSLU_NOTIFY_DIR_ADD 8
|
||||
#define WINIX_NOTIFY_ITEM_ADD 1
|
||||
#define WINIX_NOTIFY_ITEM_EDIT 2
|
||||
#define WINIX_NOTIFY_ITEM_DELETE 4
|
||||
#define WINIX_NOTIFY_DIR_ADD 8
|
||||
|
||||
|
||||
|
||||
|
@@ -12,10 +12,10 @@
|
||||
#define headerfilecmslupluginmsg
|
||||
|
||||
|
||||
#define CMSLU_TEMPLATES_CREATEFUNCTIONS 999
|
||||
#define CMSLU_REQUEST_CLEAR 1000
|
||||
#define WINIX_TEMPLATES_CREATEFUNCTIONS 999
|
||||
#define WINIX_REQUEST_CLEAR 1000
|
||||
|
||||
#define CMSLU_CONTENT_MAKE 2000
|
||||
#define WINIX_CONTENT_MAKE 2000
|
||||
|
||||
|
||||
|
||||
|
@@ -14,20 +14,20 @@
|
||||
|
||||
PostMultiParser::PostMultiParser()
|
||||
{
|
||||
in_buffer = new unsigned char[CMSLU_POSTMULTI_INPUT_BUFFER];
|
||||
in_buffer = new unsigned char[WINIX_POSTMULTI_INPUT_BUFFER];
|
||||
}
|
||||
|
||||
|
||||
PostMultiParser::PostMultiParser(const PostMultiParser &)
|
||||
{
|
||||
in_buffer = new unsigned char[CMSLU_POSTMULTI_INPUT_BUFFER];
|
||||
in_buffer = new unsigned char[WINIX_POSTMULTI_INPUT_BUFFER];
|
||||
}
|
||||
|
||||
|
||||
|
||||
PostMultiParser & PostMultiParser::operator=(const PostMultiParser &)
|
||||
{
|
||||
in_buffer = new unsigned char[CMSLU_POSTMULTI_INPUT_BUFFER];
|
||||
in_buffer = new unsigned char[WINIX_POSTMULTI_INPUT_BUFFER];
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -256,11 +256,11 @@ bool has_boundary = false;
|
||||
content += last;
|
||||
ReadChar();
|
||||
|
||||
if( content.size() > CMSLU_POSTMULTI_OUTPUT_BUFFER + boundary.size() + 2 ) // +2 for the new line character
|
||||
if( content.size() > WINIX_POSTMULTI_OUTPUT_BUFFER + boundary.size() + 2 ) // +2 for the new line character
|
||||
{
|
||||
tmp_file.write(content.c_str(), CMSLU_POSTMULTI_OUTPUT_BUFFER);
|
||||
content_len += CMSLU_POSTMULTI_OUTPUT_BUFFER;
|
||||
content.erase(0, CMSLU_POSTMULTI_OUTPUT_BUFFER);
|
||||
tmp_file.write(content.c_str(), WINIX_POSTMULTI_OUTPUT_BUFFER);
|
||||
content_len += WINIX_POSTMULTI_OUTPUT_BUFFER;
|
||||
content.erase(0, WINIX_POSTMULTI_OUTPUT_BUFFER);
|
||||
}
|
||||
|
||||
if( data.post_file_max != 0 && content_len > (size_t)data.post_file_max )
|
||||
@@ -290,7 +290,7 @@ void PostMultiParser::ReadContentToFile()
|
||||
time_t t1, t2;
|
||||
|
||||
content.clear();
|
||||
content.reserve(CMSLU_POSTMULTI_OUTPUT_BUFFER + boundary.size());
|
||||
content.reserve(WINIX_POSTMULTI_OUTPUT_BUFFER + boundary.size());
|
||||
content_len = 0;
|
||||
t1 = time(0);
|
||||
|
||||
@@ -343,10 +343,10 @@ void PostMultiParser::ReadContent()
|
||||
|
||||
void PostMultiParser::AddNormalPostVar()
|
||||
{
|
||||
if( post_table->size() >= CMSLU_POSTTABLE_MAXSIZE )
|
||||
if( post_table->size() >= WINIX_POSTTABLE_MAXSIZE )
|
||||
{
|
||||
err = Error::input_too_large;
|
||||
log << log1 << "PMP: more than " << CMSLU_POSTTABLE_MAXSIZE << " post variables (skipping)" << logend;
|
||||
log << log1 << "PMP: more than " << WINIX_POSTTABLE_MAXSIZE << " post variables (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -364,10 +364,10 @@ void PostMultiParser::AddNormalPostVar()
|
||||
|
||||
void PostMultiParser::AddFilePostVar()
|
||||
{
|
||||
if( post_file_table->size() >= CMSLU_POSTTABLE_MAXSIZE )
|
||||
if( post_file_table->size() >= WINIX_POSTTABLE_MAXSIZE )
|
||||
{
|
||||
err = Error::input_too_large;
|
||||
log << log1 << "PMP: more than " << CMSLU_POSTTABLE_MAXSIZE << " post file variables (skipping)" << logend;
|
||||
log << log1 << "PMP: more than " << WINIX_POSTTABLE_MAXSIZE << " post file variables (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ void PostMultiParser::CreateTmpFile()
|
||||
{
|
||||
char buf[100];
|
||||
|
||||
sprintf(buf, "/tmp/cmslu_%u_%d_%u", (unsigned)getpid(), tmp_filename_postfix, rand());
|
||||
sprintf(buf, "/tmp/winix_%u_%d_%u", (unsigned)getpid(), tmp_filename_postfix, rand());
|
||||
tmp_filename_postfix += 1;
|
||||
|
||||
tmp_file.open(buf, std::ios_base::binary | std::ios_base::out);
|
||||
@@ -493,13 +493,13 @@ void PostMultiParser::ReadChar()
|
||||
|
||||
if( in_buffer_ind >= in_buffer_len )
|
||||
{
|
||||
if( in_buffer_len < CMSLU_POSTMULTI_INPUT_BUFFER )
|
||||
if( in_buffer_len < WINIX_POSTMULTI_INPUT_BUFFER )
|
||||
{
|
||||
last = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
in_buffer_len = FCGX_GetStr((char*)in_buffer, CMSLU_POSTMULTI_INPUT_BUFFER, in);
|
||||
in_buffer_len = FCGX_GetStr((char*)in_buffer, WINIX_POSTMULTI_INPUT_BUFFER, in);
|
||||
in_buffer_ind = 0;
|
||||
}
|
||||
|
||||
@@ -522,8 +522,8 @@ Error PostMultiParser::Parse(FCGX_Stream * in_, PostTable & post_table_, PostFil
|
||||
last = 0;
|
||||
err = Error::ok;
|
||||
line_end_dos = false;
|
||||
in_buffer_ind = CMSLU_POSTMULTI_INPUT_BUFFER;
|
||||
in_buffer_len = CMSLU_POSTMULTI_INPUT_BUFFER;
|
||||
in_buffer_ind = WINIX_POSTMULTI_INPUT_BUFFER;
|
||||
in_buffer_len = WINIX_POSTMULTI_INPUT_BUFFER;
|
||||
post_table = &post_table_;
|
||||
post_file_table = &post_file_table_;
|
||||
tmp_filename_postfix = 1;
|
||||
|
@@ -17,8 +17,8 @@
|
||||
#include "requesttypes.h"
|
||||
|
||||
// 2 MB
|
||||
#define CMSLU_POSTMULTI_INPUT_BUFFER 2097152
|
||||
#define CMSLU_POSTMULTI_OUTPUT_BUFFER 2097152
|
||||
#define WINIX_POSTMULTI_INPUT_BUFFER 2097152
|
||||
#define WINIX_POSTMULTI_OUTPUT_BUFFER 2097152
|
||||
|
||||
|
||||
class PostMultiParser
|
||||
|
@@ -105,7 +105,7 @@ void Request::Clear()
|
||||
redirect_to.clear();
|
||||
|
||||
|
||||
plugin.Call(CMSLU_REQUEST_CLEAR);
|
||||
plugin.Call(WINIX_REQUEST_CLEAR);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <map>
|
||||
|
||||
|
||||
#define CMSLU_POSTTABLE_MAXSIZE 20
|
||||
#define WINIX_POSTTABLE_MAXSIZE 20
|
||||
|
||||
|
||||
struct PostFile
|
||||
|
@@ -66,6 +66,7 @@ bool SessionParser::Parse(SessionContainer & container)
|
||||
|
||||
if( MakeSession(user_id) )
|
||||
{
|
||||
data.how_many_logged += 1;
|
||||
container.PushBack(session);
|
||||
log << log2 << "SP: read session id: " << session.id << " for user: " << session.puser->name << logend;
|
||||
}
|
||||
|
@@ -40,7 +40,6 @@ public:
|
||||
Iterator End();
|
||||
SizeType Size();
|
||||
User & operator[](SizeType pos);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user