added: container LastContainer (lastcontainer.h lastcontainer.cpp)

it consists of last logged users
added: function 'last'


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@492 e52654a7-88a9-db11-a3e9-0013d4bc506e
pull/3/head
Tomasz Sowa 14 years ago
parent bbaefd0f77
commit 7a4a8e0fe2

@ -1,4 +1,4 @@
o = content.o priv.o emacs.o login.o rm.o cat.o logout.o ls.o node.o mkdir.o default.o run.o last.o
o = content.o priv.o emacs.o login.o rm.o cat.o logout.o ls.o node.o mkdir.o default.o run.o last.o who.o
all: content.a

@ -5,63 +5,68 @@ cat.o: ../core/misc.h ../core/log.h ../core/item.h ../core/error.h
cat.o: ../core/dirs.h ../core/db.h ../core/dircontainer.h ../core/user.h
cat.o: ../core/group.h ../core/ugcontainer.h ../core/users.h ../core/groups.h
cat.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
cat.o: ../core/request.h ../core/requesttypes.h ../core/session.h
cat.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
cat.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
cat.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
cat.o: ../core/users.h ../core/groups.h ../core/log.h
cat.o: ../templates/patterncacher.h ../core/misc.h ../core/function.h
cat.o: ../core/functionparser.h ../core/request.h ../core/data.h
cat.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
cat.o: ../core/session.h ../core/done.h ../core/getparser.h
cat.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
cat.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
cat.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
cat.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
cat.o: ../core/function.h ../core/functionparser.h ../core/request.h
cat.o: ../core/data.h ../app/content.h
content.o: content.h ../templates/templates.h ../../ezc/src/ezc.h
content.o: ../core/data.h ../core/misc.h ../core/log.h ../core/item.h
content.o: ../core/error.h ../core/dirs.h ../core/db.h ../core/dircontainer.h
content.o: ../core/user.h ../core/group.h ../core/ugcontainer.h
content.o: ../core/users.h ../core/groups.h ../core/functions.h
content.o: ../core/function.h ../core/functioncodeparser.h ../core/request.h
content.o: ../core/requesttypes.h ../core/session.h ../core/done.h
content.o: ../core/getparser.h ../core/httpsimpleparser.h
content.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
content.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
content.o: ../core/users.h ../core/groups.h ../core/log.h
content.o: ../templates/patterncacher.h ../core/misc.h ../core/function.h
content.o: ../core/functionparser.h ../core/request.h ../core/data.h
content.o: ../core/function.h ../core/functioncodeparser.h
content.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
content.o: ../core/session.h ../core/done.h ../core/getparser.h
content.o: ../core/httpsimpleparser.h ../core/postparser.h
content.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
content.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
content.o: ../core/log.h ../templates/patterncacher.h ../app/templates.h
content.o: ../core/misc.h ../core/function.h ../core/functionparser.h
content.o: ../core/request.h ../core/data.h ../app/content.h
default.o: content.h ../templates/templates.h ../../ezc/src/ezc.h
default.o: ../core/data.h ../core/misc.h ../core/log.h ../core/item.h
default.o: ../core/error.h ../core/dirs.h ../core/db.h ../core/dircontainer.h
default.o: ../core/user.h ../core/group.h ../core/ugcontainer.h
default.o: ../core/users.h ../core/groups.h ../core/functions.h
default.o: ../core/function.h ../core/functioncodeparser.h ../core/request.h
default.o: ../core/requesttypes.h ../core/session.h ../core/done.h
default.o: ../core/getparser.h ../core/httpsimpleparser.h
default.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
default.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
default.o: ../core/users.h ../core/groups.h ../core/log.h
default.o: ../templates/patterncacher.h ../core/misc.h ../core/function.h
default.o: ../core/functionparser.h ../core/request.h ../core/data.h
default.o: ../core/function.h ../core/functioncodeparser.h
default.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
default.o: ../core/session.h ../core/done.h ../core/getparser.h
default.o: ../core/httpsimpleparser.h ../core/postparser.h
default.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
default.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
default.o: ../core/log.h ../templates/patterncacher.h ../app/templates.h
default.o: ../core/misc.h ../core/function.h ../core/functionparser.h
default.o: ../core/request.h ../core/data.h ../app/content.h
emacs.o: content.h ../templates/templates.h ../../ezc/src/ezc.h
emacs.o: ../core/data.h ../core/misc.h ../core/log.h ../core/item.h
emacs.o: ../core/error.h ../core/dirs.h ../core/db.h ../core/dircontainer.h
emacs.o: ../core/user.h ../core/group.h ../core/ugcontainer.h ../core/users.h
emacs.o: ../core/groups.h ../core/functions.h ../core/function.h
emacs.o: ../core/functioncodeparser.h ../core/request.h
emacs.o: ../core/requesttypes.h ../core/session.h ../core/done.h
emacs.o: ../core/getparser.h ../core/httpsimpleparser.h ../core/postparser.h
emacs.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
emacs.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
emacs.o: ../core/log.h ../templates/patterncacher.h ../core/misc.h
emacs.o: ../core/functioncodeparser.h ../core/lastcontainer.h
emacs.o: ../core/request.h ../core/requesttypes.h ../core/session.h
emacs.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
emacs.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
emacs.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
emacs.o: ../core/users.h ../core/groups.h ../core/log.h
emacs.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
emacs.o: ../core/function.h ../core/functionparser.h ../core/request.h
emacs.o: ../core/data.h
emacs.o: ../core/data.h ../app/content.h
last.o: content.h ../templates/templates.h ../../ezc/src/ezc.h ../core/data.h
last.o: ../core/misc.h ../core/log.h ../core/item.h ../core/error.h
last.o: ../core/dirs.h ../core/db.h ../core/dircontainer.h ../core/user.h
last.o: ../core/group.h ../core/ugcontainer.h ../core/users.h
last.o: ../core/groups.h ../core/functions.h ../core/function.h
last.o: ../core/functioncodeparser.h ../core/request.h ../core/requesttypes.h
last.o: ../core/session.h ../core/done.h ../core/getparser.h
last.o: ../core/httpsimpleparser.h ../core/postparser.h
last.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
last.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
last.o: ../core/log.h ../templates/patterncacher.h ../core/misc.h
last.o: ../core/functioncodeparser.h ../core/lastcontainer.h
last.o: ../core/request.h ../core/requesttypes.h ../core/session.h
last.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
last.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
last.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
last.o: ../core/users.h ../core/groups.h ../core/log.h
last.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
last.o: ../core/function.h ../core/functionparser.h ../core/request.h
last.o: ../core/data.h ../app/content.h
login.o: content.h ../templates/templates.h ../../ezc/src/ezc.h
@ -69,113 +74,120 @@ login.o: ../core/data.h ../core/misc.h ../core/log.h ../core/item.h
login.o: ../core/error.h ../core/dirs.h ../core/db.h ../core/dircontainer.h
login.o: ../core/user.h ../core/group.h ../core/ugcontainer.h ../core/users.h
login.o: ../core/groups.h ../core/functions.h ../core/function.h
login.o: ../core/functioncodeparser.h ../core/request.h
login.o: ../core/requesttypes.h ../core/session.h ../core/done.h
login.o: ../core/getparser.h ../core/httpsimpleparser.h ../core/postparser.h
login.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
login.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
login.o: ../core/log.h ../templates/patterncacher.h ../core/misc.h
login.o: ../core/functioncodeparser.h ../core/lastcontainer.h
login.o: ../core/request.h ../core/requesttypes.h ../core/session.h
login.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
login.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
login.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
login.o: ../core/users.h ../core/groups.h ../core/log.h
login.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
login.o: ../core/function.h ../core/functionparser.h ../core/request.h
login.o: ../core/data.h
login.o: ../core/data.h ../app/content.h
logout.o: content.h ../templates/templates.h ../../ezc/src/ezc.h
logout.o: ../core/data.h ../core/misc.h ../core/log.h ../core/item.h
logout.o: ../core/error.h ../core/dirs.h ../core/db.h ../core/dircontainer.h
logout.o: ../core/user.h ../core/group.h ../core/ugcontainer.h
logout.o: ../core/users.h ../core/groups.h ../core/functions.h
logout.o: ../core/function.h ../core/functioncodeparser.h ../core/request.h
logout.o: ../core/requesttypes.h ../core/session.h ../core/done.h
logout.o: ../core/getparser.h ../core/httpsimpleparser.h ../core/postparser.h
logout.o: ../core/function.h ../core/functioncodeparser.h
logout.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
logout.o: ../core/session.h ../core/done.h ../core/getparser.h
logout.o: ../core/httpsimpleparser.h ../core/postparser.h
logout.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
logout.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
logout.o: ../core/log.h ../templates/patterncacher.h ../core/misc.h
logout.o: ../core/function.h ../core/functionparser.h ../core/request.h
logout.o: ../core/data.h
logout.o: ../core/log.h ../templates/patterncacher.h ../app/templates.h
logout.o: ../core/misc.h ../core/function.h ../core/functionparser.h
logout.o: ../core/request.h ../core/data.h ../app/content.h
ls.o: content.h ../templates/templates.h ../../ezc/src/ezc.h ../core/data.h
ls.o: ../core/misc.h ../core/log.h ../core/item.h ../core/error.h
ls.o: ../core/dirs.h ../core/db.h ../core/dircontainer.h ../core/user.h
ls.o: ../core/group.h ../core/ugcontainer.h ../core/users.h ../core/groups.h
ls.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
ls.o: ../core/request.h ../core/requesttypes.h ../core/session.h
ls.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
ls.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h ../core/db.h
ls.o: ../core/error.h ../core/user.h ../core/group.h ../core/users.h
ls.o: ../core/groups.h ../core/log.h ../templates/patterncacher.h
ls.o: ../core/misc.h ../core/function.h ../core/functionparser.h
ls.o: ../core/request.h ../core/data.h
ls.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
ls.o: ../core/session.h ../core/done.h ../core/getparser.h
ls.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
ls.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
ls.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
ls.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
ls.o: ../core/function.h ../core/functionparser.h ../core/request.h
ls.o: ../core/data.h ../app/content.h
mkdir.o: content.h ../templates/templates.h ../../ezc/src/ezc.h
mkdir.o: ../core/data.h ../core/misc.h ../core/log.h ../core/item.h
mkdir.o: ../core/error.h ../core/dirs.h ../core/db.h ../core/dircontainer.h
mkdir.o: ../core/user.h ../core/group.h ../core/ugcontainer.h ../core/users.h
mkdir.o: ../core/groups.h ../core/functions.h ../core/function.h
mkdir.o: ../core/functioncodeparser.h ../core/request.h
mkdir.o: ../core/requesttypes.h ../core/session.h ../core/done.h
mkdir.o: ../core/getparser.h ../core/httpsimpleparser.h ../core/postparser.h
mkdir.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
mkdir.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
mkdir.o: ../core/log.h ../templates/patterncacher.h ../core/misc.h
mkdir.o: ../core/functioncodeparser.h ../core/lastcontainer.h
mkdir.o: ../core/request.h ../core/requesttypes.h ../core/session.h
mkdir.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
mkdir.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
mkdir.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
mkdir.o: ../core/users.h ../core/groups.h ../core/log.h
mkdir.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
mkdir.o: ../core/function.h ../core/functionparser.h ../core/request.h
mkdir.o: ../core/data.h
mkdir.o: ../core/data.h ../app/content.h
node.o: content.h ../templates/templates.h ../../ezc/src/ezc.h ../core/data.h
node.o: ../core/misc.h ../core/log.h ../core/item.h ../core/error.h
node.o: ../core/dirs.h ../core/db.h ../core/dircontainer.h ../core/user.h
node.o: ../core/group.h ../core/ugcontainer.h ../core/users.h
node.o: ../core/groups.h ../core/functions.h ../core/function.h
node.o: ../core/functioncodeparser.h ../core/request.h ../core/requesttypes.h
node.o: ../core/session.h ../core/done.h ../core/getparser.h
node.o: ../core/httpsimpleparser.h ../core/postparser.h
node.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
node.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
node.o: ../core/log.h ../templates/patterncacher.h ../core/misc.h
node.o: ../core/functioncodeparser.h ../core/lastcontainer.h
node.o: ../core/request.h ../core/requesttypes.h ../core/session.h
node.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
node.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
node.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
node.o: ../core/users.h ../core/groups.h ../core/log.h
node.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
node.o: ../core/function.h ../core/functionparser.h ../core/request.h
node.o: ../core/data.h
node.o: ../core/data.h ../app/content.h
priv.o: content.h ../templates/templates.h ../../ezc/src/ezc.h ../core/data.h
priv.o: ../core/misc.h ../core/log.h ../core/item.h ../core/error.h
priv.o: ../core/dirs.h ../core/db.h ../core/dircontainer.h ../core/user.h
priv.o: ../core/group.h ../core/ugcontainer.h ../core/users.h
priv.o: ../core/groups.h ../core/functions.h ../core/function.h
priv.o: ../core/functioncodeparser.h ../core/request.h ../core/requesttypes.h
priv.o: ../core/session.h ../core/done.h ../core/getparser.h
priv.o: ../core/httpsimpleparser.h ../core/postparser.h
priv.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
priv.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
priv.o: ../core/log.h ../templates/patterncacher.h ../core/misc.h
priv.o: ../core/functioncodeparser.h ../core/lastcontainer.h
priv.o: ../core/request.h ../core/requesttypes.h ../core/session.h
priv.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
priv.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
priv.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
priv.o: ../core/users.h ../core/groups.h ../core/log.h
priv.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
priv.o: ../core/function.h ../core/functionparser.h ../core/request.h
priv.o: ../core/data.h
priv.o: ../core/data.h ../app/content.h
rm.o: content.h ../templates/templates.h ../../ezc/src/ezc.h ../core/data.h
rm.o: ../core/misc.h ../core/log.h ../core/item.h ../core/error.h
rm.o: ../core/dirs.h ../core/db.h ../core/dircontainer.h ../core/user.h
rm.o: ../core/group.h ../core/ugcontainer.h ../core/users.h ../core/groups.h
rm.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
rm.o: ../core/request.h ../core/requesttypes.h ../core/session.h
rm.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
rm.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h ../core/db.h
rm.o: ../core/error.h ../core/user.h ../core/group.h ../core/users.h
rm.o: ../core/groups.h ../core/log.h ../templates/patterncacher.h
rm.o: ../core/misc.h ../core/function.h ../core/functionparser.h
rm.o: ../core/request.h ../core/data.h
rm.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
rm.o: ../core/session.h ../core/done.h ../core/getparser.h
rm.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
rm.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
rm.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
rm.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
rm.o: ../core/function.h ../core/functionparser.h ../core/request.h
rm.o: ../core/data.h ../app/content.h
run.o: content.h ../templates/templates.h ../../ezc/src/ezc.h ../core/data.h
run.o: ../core/misc.h ../core/log.h ../core/item.h ../core/error.h
run.o: ../core/dirs.h ../core/db.h ../core/dircontainer.h ../core/user.h
run.o: ../core/group.h ../core/ugcontainer.h ../core/users.h ../core/groups.h
run.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
run.o: ../core/request.h ../core/requesttypes.h ../core/session.h
run.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
run.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
run.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
run.o: ../core/users.h ../core/groups.h ../core/log.h
run.o: ../templates/patterncacher.h ../core/misc.h ../core/function.h
run.o: ../core/functionparser.h ../core/request.h ../core/data.h
run.o: ../app/content.h
run.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
run.o: ../core/session.h ../core/done.h ../core/getparser.h
run.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
run.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
run.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
run.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
run.o: ../core/function.h ../core/functionparser.h ../core/request.h
run.o: ../core/data.h ../app/content.h
who.o: content.h ../templates/templates.h ../../ezc/src/ezc.h ../core/data.h
who.o: ../core/misc.h ../core/log.h ../core/item.h ../core/error.h
who.o: ../core/dirs.h ../core/db.h ../core/dircontainer.h ../core/user.h
who.o: ../core/group.h ../core/ugcontainer.h ../core/users.h ../core/groups.h
who.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
who.o: ../core/request.h ../core/requesttypes.h ../core/session.h
who.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
who.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
who.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
who.o: ../core/users.h ../core/groups.h ../core/log.h
who.o: ../templates/patterncacher.h ../core/misc.h ../core/function.h
who.o: ../core/functionparser.h ../core/request.h ../core/data.h
who.o: ../app/content.h
who.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
who.o: ../core/session.h ../core/done.h ../core/getparser.h
who.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
who.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
who.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
who.o: ../templates/patterncacher.h ../app/templates.h ../core/misc.h
who.o: ../core/function.h ../core/functionparser.h ../core/request.h
who.o: ../core/data.h ../app/content.h

@ -121,6 +121,12 @@ void Content::MakeStandardFunction()
else
if( request.pfunction->code == FUN_NODE )
FunNode();
else
if( request.pfunction->code == FUN_WHO )
FunWho();
else
if( request.pfunction->code == FUN_LAST )
FunLast();
}

@ -8,8 +8,19 @@
*/
#include "content.h"
#include <arpa/inet.h>
/*
void Content::PostFunLoginAddLast()
{
}
*/
void Content::PostFunLogin()
@ -30,6 +41,8 @@ void Content::PostFunLogin()
return;
}
data.last.UserLogin(user_id, login, inet_addr(request.env_remote_addr), request.session->id);
log << log2 << "User " << login << " (id: " << user_id << ") logged" << logend;
}

@ -25,6 +25,8 @@ void Content::FunLogout()
{
log << log2 << "User: " << request.session->puser->name << ", id: " << request.session->puser->id << " logged out" << logend;
data.last.UserLogout(request.session->puser->id, request.session->id);
request.session->puser = 0;
}

@ -14,7 +14,7 @@
void Content::FunRun()
void Content::FunWho()
{

@ -1,4 +1,4 @@
o = data.o log.o sessionmanager.o requestcontroller.o dircontainer.o session.o main.o done.o request.o misc.o httpsimpleparser.o db.o error.o db_itemcolumns.o users.o config.o dirs.o groups.o function.o functionparser.o functions.o functioncodeparser.o sessioncontainer.o
o = data.o log.o sessionmanager.o requestcontroller.o dircontainer.o session.o main.o done.o request.o misc.o httpsimpleparser.o db.o error.o db_itemcolumns.o users.o config.o dirs.o groups.o function.o functionparser.o functions.o functioncodeparser.o sessioncontainer.o lastcontainer.o

@ -3,9 +3,10 @@
config.o: config.h ../confparser/confparser.h error.h log.h data.h misc.h
config.o: item.h dirs.h db.h dircontainer.h user.h group.h ugcontainer.h
config.o: users.h groups.h functions.h function.h functioncodeparser.h
config.o: lastcontainer.h
data.o: data.h misc.h log.h item.h error.h dirs.h db.h dircontainer.h user.h
data.o: group.h ugcontainer.h users.h groups.h functions.h function.h
data.o: functioncodeparser.h
data.o: functioncodeparser.h lastcontainer.h
db.o: db.h log.h item.h misc.h error.h dircontainer.h user.h group.h
db.o: ugcontainer.h
db_itemcolumns.o: db.h log.h item.h misc.h error.h dircontainer.h user.h
@ -21,22 +22,26 @@ functionparser.o: functionparser.h request.h requesttypes.h log.h session.h
functionparser.o: error.h item.h done.h user.h getparser.h httpsimpleparser.h
functionparser.o: postparser.h cookieparser.h function.h data.h misc.h dirs.h
functionparser.o: db.h dircontainer.h group.h ugcontainer.h users.h groups.h
functionparser.o: functions.h functioncodeparser.h
functionparser.o: functions.h functioncodeparser.h lastcontainer.h
functionparser.o: ../app/content.h ../core/log.h ../core/data.h
functionparser.o: ../core/function.h
functions.o: functions.h function.h log.h item.h functioncodeparser.h
groups.o: groups.h group.h db.h log.h item.h misc.h error.h dircontainer.h
groups.o: user.h ugcontainer.h
httpsimpleparser.o: httpsimpleparser.h
lastcontainer.o: lastcontainer.h log.h
log.o: log.h
main.o: requestcontroller.h data.h misc.h log.h item.h error.h dirs.h db.h
main.o: dircontainer.h user.h group.h ugcontainer.h users.h groups.h
main.o: functions.h function.h functioncodeparser.h request.h requesttypes.h
main.o: session.h done.h getparser.h httpsimpleparser.h postparser.h
main.o: cookieparser.h ../content/content.h ../templates/templates.h
main.o: ../../ezc/src/ezc.h ../core/data.h ../core/request.h ../core/item.h
main.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
main.o: ../core/users.h ../core/groups.h ../core/log.h
main.o: ../templates/patterncacher.h ../core/misc.h ../core/function.h
main.o: ../core/functionparser.h sessionmanager.h sessioncontainer.h config.h
main.o: functions.h function.h functioncodeparser.h lastcontainer.h request.h
main.o: requesttypes.h session.h done.h getparser.h httpsimpleparser.h
main.o: postparser.h cookieparser.h ../content/content.h
main.o: ../templates/templates.h ../../ezc/src/ezc.h ../core/data.h
main.o: ../core/request.h ../core/item.h ../core/db.h ../core/error.h
main.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
main.o: ../core/log.h ../templates/patterncacher.h ../app/templates.h
main.o: ../core/misc.h ../core/function.h ../core/functionparser.h
main.o: ../app/content.h sessionmanager.h sessioncontainer.h config.h
main.o: ../confparser/confparser.h
misc.o: misc.h log.h item.h
request.o: request.h requesttypes.h log.h session.h error.h item.h done.h
@ -45,17 +50,18 @@ request.o: function.h
requestcontroller.o: requestcontroller.h data.h misc.h log.h item.h error.h
requestcontroller.o: dirs.h db.h dircontainer.h user.h group.h ugcontainer.h
requestcontroller.o: users.h groups.h functions.h function.h
requestcontroller.o: functioncodeparser.h request.h requesttypes.h session.h
requestcontroller.o: done.h getparser.h httpsimpleparser.h postparser.h
requestcontroller.o: cookieparser.h ../content/content.h
requestcontroller.o: ../templates/templates.h ../../ezc/src/ezc.h
requestcontroller.o: ../core/data.h ../core/request.h ../core/item.h
requestcontroller.o: ../core/db.h ../core/error.h ../core/user.h
requestcontroller.o: ../core/group.h ../core/users.h ../core/groups.h
requestcontroller.o: ../core/log.h ../templates/patterncacher.h
requestcontroller.o: functioncodeparser.h lastcontainer.h request.h
requestcontroller.o: requesttypes.h session.h done.h getparser.h
requestcontroller.o: httpsimpleparser.h postparser.h cookieparser.h
requestcontroller.o: ../content/content.h ../templates/templates.h
requestcontroller.o: ../../ezc/src/ezc.h ../core/data.h ../core/request.h
requestcontroller.o: ../core/item.h ../core/db.h ../core/error.h
requestcontroller.o: ../core/user.h ../core/group.h ../core/users.h
requestcontroller.o: ../core/groups.h ../core/log.h
requestcontroller.o: ../templates/patterncacher.h ../app/templates.h
requestcontroller.o: ../core/misc.h ../core/function.h
requestcontroller.o: ../core/functionparser.h sessionmanager.h
requestcontroller.o: sessioncontainer.h
requestcontroller.o: ../core/functionparser.h ../app/content.h
requestcontroller.o: sessionmanager.h sessioncontainer.h
session.o: session.h requesttypes.h error.h log.h item.h done.h user.h
sessioncontainer.o: sessioncontainer.h session.h requesttypes.h error.h log.h
sessioncontainer.o: item.h done.h user.h
@ -63,6 +69,7 @@ sessionmanager.o: sessionmanager.h request.h requesttypes.h log.h session.h
sessionmanager.o: error.h item.h done.h user.h getparser.h httpsimpleparser.h
sessionmanager.o: postparser.h cookieparser.h function.h data.h misc.h dirs.h
sessionmanager.o: db.h dircontainer.h group.h ugcontainer.h users.h groups.h
sessionmanager.o: functions.h functioncodeparser.h sessioncontainer.h
sessionmanager.o: functions.h functioncodeparser.h lastcontainer.h
sessionmanager.o: sessioncontainer.h
users.o: users.h user.h db.h log.h item.h misc.h error.h dircontainer.h
users.o: group.h ugcontainer.h

@ -22,6 +22,8 @@
#include "users.h"
#include "groups.h"
#include "functions.h"
#include "lastcontainer.h"
@ -116,7 +118,8 @@ public:
// functions (ls, cat, etc)
Functions functions;
LastContainer last;
Data();

@ -0,0 +1,119 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa
* All rights reserved.
*
*/
#include "lastcontainer.h"
LastItem::LastItem()
{
user_id = 0;
ip = 0;
session_id = 0;
memset((char*)&start, 0, sizeof(start));
memset((char*)&end, 0, sizeof(end));
}
bool LastItem::IsLoggedOut()
{
if( end.tm_sec == 0 &&
end.tm_min == 0 &&
end.tm_hour == 0 &&
end.tm_mday == 0 &&
end.tm_mon == 0 &&
end.tm_year == 0 )
return false;
return true;
}
LastContainer::LastContainer()
{
}
LastContainer::Iterator LastContainer::Begin()
{
return last_tab.begin();
}
LastContainer::Iterator LastContainer::End()
{
return last_tab.end();
}
LastContainer::Iterator LastContainer::FindNotLoggedOut(long user_id, long session_id)
{
LastTab::iterator i;
for(i=last_tab.begin() ; i!=last_tab.end() ; ++i)
{
if( i->user_id == user_id && i->session_id == session_id && !i->IsLoggedOut() )
return i;
}
return last_tab.end();
}
void LastContainer::UserLogin(long user_id, const std::string & name, unsigned int ip, long session_id)
{
LastTab::iterator i = FindNotLoggedOut(user_id, session_id);
if( i != last_tab.end() )
{
log << log1 << "LC: such a user and session_id exist, not added as a new one" << logend;
return;
}
if( last_tab.size() >= LAST_TABLE_SIZE )
last_tab.erase(last_tab.begin());
LastItem li;
li.user_id = user_id;
li.name = name;
li.ip = ip;
li.session_id = session_id;
time_t t = std::time(0);
li.start = *localtime(&t);
last_tab.insert(last_tab.end(), li);
log << log2 << "LC: added user: " << name << " into the last table" << logend;
}
void LastContainer::UserLogout(long user_id, long session_id)
{
LastTab::iterator i = FindNotLoggedOut(user_id, session_id);
if( i != last_tab.end() )
{
time_t t = std::time(0);
i->end = *localtime(&t);
}
else
{
log << log1 << "LC: there is no such a user to log out" << logend;
}
}

@ -0,0 +1,82 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfilelastcontainer33
#define headerfilelastcontainer33
#include <string>
#include <list>
#include <cstring>
#include <ctime>
#include "log.h"
// how many items we store in the 'last' function
#define LAST_TABLE_SIZE 100
struct LastItem
{
long user_id;
// additional we store the whole string-name
// (you can delete a user from the database but we can still print the name)
std::string name;
// ip address
unsigned int ip;
// session id (used when logging out)
long session_id;
// start logging and end logging
tm start;
tm end;
LastItem();
bool IsLoggedOut();
};
class LastContainer
{
public:
typedef std::list<LastItem> LastTab;
typedef LastTab::iterator Iterator;
public:
// !! nie potrzebny, skasowac po stworzeniu jednej biblioteki cmslu.a
// chwilowo bez tego wystepuja problemy z linkowaniem
LastContainer();
Iterator Begin();
Iterator End();
void UserLogin(long user_id, const std::string & name, unsigned int ip, long session_id);
void UserLogout(long user_id, long session_id);
private:
LastTab last_tab;
Iterator FindNotLoggedOut(long user_id, long session_id);
};
#endif

@ -210,11 +210,36 @@ static char buffer[100];
}
const char * DateToStr(tm * ptm)
{
return DateToStr(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
}
const char * DateToStr(time_t t)
{
tm * ptm = std::localtime(&t);
return DateToStr(ptm->tm_year + 1900, ptm->tm_mon, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
return DateToStr(ptm);
}
const char * IpToStr(unsigned int ip_)
{
static char buffer[100];
union
{
unsigned int ip;
unsigned char c[4];
} ip;
ip.ip = ip_;
sprintf(buffer, "%u.%u.%u.%u", (int)ip.c[0], (int)ip.c[1], (int)ip.c[2], (int)ip.c[3]);
return buffer;
}

@ -33,7 +33,8 @@ void SetUrlFromSubject(Item & item);
void HtmlEscape(std::ostringstream & out, const std::string & in);
std::string HtmlEscape(const std::string & in);
const char * DateToStr(int year, int month, int day, int hour, int min, int sec);
const char * DateToStr(tm * ptm);
const char * DateToStr(time_t t);
const char * IpToStr(unsigned int ip_);
#endif

@ -24,10 +24,6 @@
class SessionManager
{
// !! zamienic na map
//typedef std::set<Session> SessionTable;
//SessionTable session_table;
SessionContainer session_table;

@ -1,4 +1,4 @@
o = templates.o sys.o item.o doc.o user.o dir.o done.o priv.o patterncacher.o who.o
o = templates.o sys.o item.o doc.o user.o dir.o done.o priv.o patterncacher.o who.o last.o
all: templates.a

@ -5,41 +5,57 @@ dir.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
dir.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
dir.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
dir.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
dir.o: ../core/request.h ../core/requesttypes.h ../core/session.h
dir.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
dir.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
dir.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
dir.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
dir.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
dir.o: ../core/session.h ../core/done.h ../core/getparser.h
dir.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
dir.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
dir.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
dir.o: patterncacher.h ../app/templates.h
doc.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
doc.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
doc.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
doc.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
doc.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
doc.o: ../core/request.h ../core/requesttypes.h ../core/session.h
doc.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
doc.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
doc.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
doc.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
doc.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
doc.o: ../core/session.h ../core/done.h ../core/getparser.h
doc.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
doc.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
doc.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
doc.o: patterncacher.h ../app/templates.h
done.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
done.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
done.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
done.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
done.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
done.o: ../core/request.h ../core/requesttypes.h ../core/session.h
done.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
done.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
done.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
done.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
done.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
done.o: ../core/session.h ../core/done.h ../core/getparser.h
done.o: ../core/httpsimpleparser.h ../core/postparser.h
done.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
done.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
done.o: ../core/log.h patterncacher.h ../app/templates.h
item.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
item.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
item.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
item.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
item.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
item.o: ../core/request.h ../core/requesttypes.h ../core/session.h
item.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
item.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
item.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
item.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
item.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
item.o: ../core/session.h ../core/done.h ../core/getparser.h
item.o: ../core/httpsimpleparser.h ../core/postparser.h
item.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
item.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
item.o: ../core/log.h patterncacher.h ../app/templates.h
last.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
last.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
last.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
last.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
last.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
last.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
last.o: ../core/session.h ../core/done.h ../core/getparser.h
last.o: ../core/httpsimpleparser.h ../core/postparser.h
last.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
last.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
last.o: ../core/log.h patterncacher.h ../app/templates.h
last.o: ../core/lastcontainer.h ../core/misc.h
patterncacher.o: patterncacher.h ../core/item.h ../../ezc/src/ezc.h
patterncacher.o: ../core/log.h
priv.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
@ -47,53 +63,58 @@ priv.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
priv.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
priv.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
priv.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
priv.o: ../core/request.h ../core/requesttypes.h ../core/session.h
priv.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
priv.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
priv.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
priv.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
priv.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
priv.o: ../core/session.h ../core/done.h ../core/getparser.h
priv.o: ../core/httpsimpleparser.h ../core/postparser.h
priv.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
priv.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
priv.o: ../core/log.h patterncacher.h ../app/templates.h
sys.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
sys.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
sys.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
sys.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
sys.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
sys.o: ../core/request.h ../core/requesttypes.h ../core/session.h
sys.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
sys.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
sys.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
sys.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
sys.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
sys.o: ../core/session.h ../core/done.h ../core/getparser.h
sys.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
sys.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
sys.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
sys.o: patterncacher.h ../app/templates.h
templates.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
templates.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
templates.o: ../core/db.h ../core/dircontainer.h ../core/user.h
templates.o: ../core/group.h ../core/ugcontainer.h ../core/users.h
templates.o: ../core/groups.h ../core/functions.h ../core/function.h
templates.o: ../core/functioncodeparser.h ../core/request.h
templates.o: ../core/requesttypes.h ../core/session.h ../core/done.h
templates.o: ../core/getparser.h ../core/httpsimpleparser.h
templates.o: ../core/functioncodeparser.h ../core/lastcontainer.h
templates.o: ../core/request.h ../core/requesttypes.h ../core/session.h
templates.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
templates.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
templates.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
templates.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
templates.o: ../app/templates.h
user.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
user.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
user.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
user.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
user.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
user.o: ../core/request.h ../core/requesttypes.h ../core/session.h
user.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
user.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
user.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
user.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
user.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
user.o: ../core/session.h ../core/done.h ../core/getparser.h
user.o: ../core/httpsimpleparser.h ../core/postparser.h
user.o: ../core/cookieparser.h ../core/item.h ../core/db.h ../core/error.h
user.o: ../core/user.h ../core/group.h ../core/users.h ../core/groups.h
user.o: ../core/log.h patterncacher.h ../app/templates.h
who.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
who.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
who.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
who.o: ../core/ugcontainer.h ../core/users.h ../core/groups.h
who.o: ../core/functions.h ../core/function.h ../core/functioncodeparser.h
who.o: ../core/request.h ../core/requesttypes.h ../core/session.h
who.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
who.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
who.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
who.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
who.o: ../core/sessioncontainer.h ../core/requestcontroller.h ../core/data.h
who.o: ../core/request.h ../content/content.h ../templates/templates.h
who.o: ../core/misc.h ../core/function.h ../core/functionparser.h
who.o: ../core/lastcontainer.h ../core/request.h ../core/requesttypes.h
who.o: ../core/session.h ../core/done.h ../core/getparser.h
who.o: ../core/httpsimpleparser.h ../core/postparser.h ../core/cookieparser.h
who.o: ../core/item.h ../core/db.h ../core/error.h ../core/user.h
who.o: ../core/group.h ../core/users.h ../core/groups.h ../core/log.h
who.o: patterncacher.h ../app/templates.h ../core/sessioncontainer.h
who.o: ../core/requestcontroller.h ../core/data.h ../core/request.h
who.o: ../content/content.h ../templates/templates.h ../core/misc.h
who.o: ../core/function.h ../core/functionparser.h ../app/content.h
who.o: ../core/sessionmanager.h ../core/sessioncontainer.h

@ -0,0 +1,85 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008, Tomasz Sowa
* All rights reserved.
*
*/
#include "templates.h"
#include "../core/lastcontainer.h"
#include "../core/misc.h"
namespace TemplatesFunctions
{
static size_t last_reqid = 0;
static LastContainer::Iterator last_iterator;
bool last_init()
{
if( last_reqid != request.id )
{
last_reqid = request.id;
last_iterator = data.last.Begin();
}
return last_iterator != data.last.End();
}
void last_tab(Info & i)
{
last_init();
if( i.iter != 0 && last_iterator != data.last.End() )
++last_iterator;
i.result = last_iterator != data.last.End();
}
void last_tab_name(Info & i)
{
if( !last_init() )
return;
HtmlEscape(i.out, last_iterator->name);
}
void last_tab_ip(Info & i)
{
if( !last_init() )
return;
i.out << IpToStr(last_iterator->ip);
}
void last_tab_start(Info & i)
{
if( !last_init() )
return;
i.out << DateToStr(&last_iterator->start);
}
void last_tab_end(Info & i)
{
if( !last_init() )
return;
if( last_iterator->IsLoggedOut() )
i.out << DateToStr(&last_iterator->end);
}
} // namespace TemplatesFunctions

@ -24,6 +24,7 @@ Ezc::Pattern pat_fun_priv;
Ezc::Pattern pat_fun_rm;
Ezc::Pattern pat_fun_who;
Ezc::Pattern pat_fun_run;
Ezc::Pattern pat_fun_last;
Ezc::Pattern pat_err_item_required;
Ezc::Pattern pat_err_404;
Ezc::Pattern pat_err_per_denied;
@ -103,6 +104,10 @@ Ezc::Pattern * p = 0;
p = &pat_fun_who;
break;
case FUN_LAST:
p = &pat_fun_last;
break;
default:
break;
}
@ -297,12 +302,23 @@ void Templates::CreateFunctions()
/*
who
*/
functions.Insert("who_tab", who_tab);
functions.Insert("who_tab_lp", who_tab_lp);
functions.Insert("who_tab_user", who_tab_user);
functions.Insert("who_tab_time", who_tab_time);
functions.Insert("who_tab_last_time", who_tab_last_time);
functions.Insert("who_tab", who_tab);
functions.Insert("who_tab_lp", who_tab_lp);
functions.Insert("who_tab_user", who_tab_user);
functions.Insert("who_tab_time", who_tab_time);
functions.Insert("who_tab_last_time", who_tab_last_time);
/*
last
*/
functions.Insert("last_tab", last_tab);
functions.Insert("last_tab_name", last_tab_name);
functions.Insert("last_tab_ip", last_tab_ip);
functions.Insert("last_tab_start", last_tab_start);
functions.Insert("last_tab_end", last_tab_end);
// !! tymczasowa
functions.Insert("is_group_tv", is_group_tv);
@ -363,6 +379,9 @@ void Templates::Read()
pat_fun_run.Directory(data.templates);
pat_fun_run.ParseFile("fun_run.html");
pat_fun_last.Directory(data.templates);
pat_fun_last.ParseFile("fun_last.html");
pat_item_info.Directory(data.templates);
pat_item_info.ParseFile("item_info.html");

@ -175,6 +175,15 @@ namespace TemplatesFunctions
void who_tab_time(Info & i);
void who_tab_last_time(Info & i);
/*
last
*/
void last_tab(Info & i);
void last_tab_name(Info & i);
void last_tab_ip(Info & i);
void last_tab_start(Info & i);
void last_tab_end(Info & i);
} // namespace TemplatesFunctions

Loading…
Cancel
Save