added: Rebus

(when no logged user wants to send a message then he is asked a question)


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@521 e52654a7-88a9-db11-a3e9-0013d4bc506e
pull/3/head
Tomasz Sowa 13 years ago
parent c62d48160a
commit 2ca44ec361

@ -3,18 +3,19 @@
cat.o: content.h ../core/item.h ../templates/templates.h
cat.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
cat.o: ../core/requesttypes.h ../core/session.h ../core/done.h ../core/item.h
cat.o: ../core/error.h ../core/log.h ../core/user.h ../core/function.h
cat.o: ../core/thread.h ../core/compress.h ../core/acceptencodingparser.h
cat.o: ../core/acceptbaseparser.h ../core/error.h
cat.o: ../core/error.h ../core/log.h ../core/user.h ../core/rebus.h
cat.o: ../core/function.h ../core/thread.h ../core/compress.h
cat.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
cat.o: ../core/error.h
content.o: content.h ../core/item.h ../templates/templates.h
content.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
content.o: ../core/requesttypes.h ../core/session.h ../core/done.h
content.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
content.o: ../core/function.h ../core/thread.h ../core/compress.h
content.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
content.o: ../core/error.h ../core/db.h ../core/group.h
content.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/data.h
content.o: ../core/dirs.h ../core/users.h ../core/groups.h
content.o: ../core/rebus.h ../core/function.h ../core/thread.h
content.o: ../core/compress.h ../core/acceptencodingparser.h
content.o: ../core/acceptbaseparser.h ../core/error.h ../core/db.h
content.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
content.o: ../core/data.h ../core/dirs.h ../core/users.h ../core/groups.h
content.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
content.o: ../core/mount.h ../core/misc.h ../core/plugin.h ../core/request.h
content.o: ../core/data.h ../core/pluginmsg.h
@ -22,34 +23,36 @@ createthread.o: content.h ../core/item.h ../templates/templates.h
createthread.o: ../templates/patterncacher.h ../core/thread.h
createthread.o: ../core/request.h ../core/requesttypes.h ../core/session.h
createthread.o: ../core/done.h ../core/item.h ../core/error.h ../core/log.h
createthread.o: ../core/user.h ../core/function.h ../core/thread.h
createthread.o: ../core/compress.h ../core/acceptencodingparser.h
createthread.o: ../core/acceptbaseparser.h ../core/error.h ../core/db.h
createthread.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
createthread.o: ../core/mount.h ../core/data.h ../core/dirs.h ../core/users.h
createthread.o: ../core/user.h ../core/rebus.h ../core/function.h
createthread.o: ../core/thread.h ../core/compress.h
createthread.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
createthread.o: ../core/error.h ../core/db.h ../core/group.h
createthread.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/mount.h
createthread.o: ../core/data.h ../core/dirs.h ../core/users.h
createthread.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
createthread.o: ../core/mounts.h ../core/mount.h
default.o: content.h ../core/item.h ../templates/templates.h
default.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
default.o: ../core/requesttypes.h ../core/session.h ../core/done.h
default.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
default.o: ../core/function.h ../core/thread.h ../core/compress.h
default.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
default.o: ../core/error.h ../core/db.h ../core/group.h
default.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/data.h
default.o: ../core/dirs.h ../core/users.h ../core/groups.h
default.o: ../core/rebus.h ../core/function.h ../core/thread.h
default.o: ../core/compress.h ../core/acceptencodingparser.h
default.o: ../core/acceptbaseparser.h ../core/error.h ../core/db.h
default.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
default.o: ../core/data.h ../core/dirs.h ../core/users.h ../core/groups.h
default.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
default.o: ../core/mount.h
emacs.o: content.h ../core/item.h ../templates/templates.h
emacs.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
emacs.o: ../core/requesttypes.h ../core/session.h ../core/done.h
emacs.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
emacs.o: ../core/function.h ../core/thread.h ../core/compress.h
emacs.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
emacs.o: ../core/error.h ../core/db.h ../core/group.h ../core/dircontainer.h
emacs.o: ../core/ugcontainer.h ../core/data.h ../core/dirs.h ../core/users.h
emacs.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
emacs.o: ../core/mounts.h ../core/mount.h ../core/notify.h
emacs.o: ../core/rebus.h ../core/function.h ../core/thread.h
emacs.o: ../core/compress.h ../core/acceptencodingparser.h
emacs.o: ../core/acceptbaseparser.h ../core/error.h ../core/db.h
emacs.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
emacs.o: ../core/data.h ../core/dirs.h ../core/users.h ../core/groups.h
emacs.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
emacs.o: ../core/mount.h ../core/notify.h
emacs.o: ../templatesnotify/templatesnotify.h ../core/mount.h
last.o: content.h ../core/item.h ../templates/templates.h
last.o: ../templates/patterncacher.h ../core/thread.h
@ -57,87 +60,94 @@ login.o: content.h ../core/item.h ../templates/templates.h
login.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
login.o: ../core/requesttypes.h ../core/session.h ../core/done.h
login.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
login.o: ../core/function.h ../core/thread.h ../core/compress.h
login.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
login.o: ../core/error.h ../core/db.h ../core/group.h ../core/dircontainer.h
login.o: ../core/ugcontainer.h ../core/data.h ../core/dirs.h ../core/users.h
login.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
login.o: ../core/mounts.h ../core/mount.h
login.o: ../core/rebus.h ../core/function.h ../core/thread.h
login.o: ../core/compress.h ../core/acceptencodingparser.h
login.o: ../core/acceptbaseparser.h ../core/error.h ../core/db.h
login.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
login.o: ../core/data.h ../core/dirs.h ../core/users.h ../core/groups.h
login.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
login.o: ../core/mount.h
logout.o: content.h ../core/item.h ../templates/templates.h
logout.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
logout.o: ../core/requesttypes.h ../core/session.h ../core/done.h
logout.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
logout.o: ../core/function.h ../core/thread.h ../core/compress.h
logout.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
logout.o: ../core/data.h ../core/dirs.h ../core/dircontainer.h
logout.o: ../core/users.h ../core/ugcontainer.h ../core/groups.h
logout.o: ../core/group.h ../core/functions.h ../core/lastcontainer.h
logout.o: ../core/mounts.h ../core/mount.h
logout.o: ../core/rebus.h ../core/function.h ../core/thread.h
logout.o: ../core/compress.h ../core/acceptencodingparser.h
logout.o: ../core/acceptbaseparser.h ../core/data.h ../core/dirs.h
logout.o: ../core/dircontainer.h ../core/users.h ../core/ugcontainer.h
logout.o: ../core/groups.h ../core/group.h ../core/functions.h
logout.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
ls.o: content.h ../core/item.h ../templates/templates.h
ls.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
ls.o: ../core/requesttypes.h ../core/session.h ../core/done.h ../core/item.h
ls.o: ../core/error.h ../core/log.h ../core/user.h ../core/function.h
ls.o: ../core/thread.h ../core/compress.h ../core/acceptencodingparser.h
ls.o: ../core/acceptbaseparser.h ../core/db.h ../core/group.h
ls.o: ../core/dircontainer.h ../core/ugcontainer.h
ls.o: ../core/error.h ../core/log.h ../core/user.h ../core/rebus.h
ls.o: ../core/function.h ../core/thread.h ../core/compress.h
ls.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h ../core/db.h
ls.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
mkdir.o: content.h ../core/item.h ../templates/templates.h
mkdir.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
mkdir.o: ../core/requesttypes.h ../core/session.h ../core/done.h
mkdir.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
mkdir.o: ../core/function.h ../core/thread.h ../core/compress.h
mkdir.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
mkdir.o: ../core/error.h ../core/db.h ../core/group.h ../core/dircontainer.h
mkdir.o: ../core/ugcontainer.h ../core/data.h ../core/dirs.h ../core/users.h
mkdir.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
mkdir.o: ../core/mounts.h ../core/mount.h ../core/notify.h
mkdir.o: ../core/rebus.h ../core/function.h ../core/thread.h
mkdir.o: ../core/compress.h ../core/acceptencodingparser.h
mkdir.o: ../core/acceptbaseparser.h ../core/error.h ../core/db.h
mkdir.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
mkdir.o: ../core/data.h ../core/dirs.h ../core/users.h ../core/groups.h
mkdir.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
mkdir.o: ../core/mount.h ../core/notify.h
mkdir.o: ../templatesnotify/templatesnotify.h ../core/mount.h
node.o: content.h ../core/item.h ../templates/templates.h
node.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
node.o: ../core/requesttypes.h ../core/session.h ../core/done.h
node.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
node.o: ../core/function.h ../core/thread.h ../core/compress.h
node.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
node.o: ../core/rebus.h ../core/function.h ../core/thread.h
node.o: ../core/compress.h ../core/acceptencodingparser.h
node.o: ../core/acceptbaseparser.h
priv.o: content.h ../core/item.h ../templates/templates.h
priv.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
priv.o: ../core/requesttypes.h ../core/session.h ../core/done.h
priv.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
priv.o: ../core/function.h ../core/thread.h ../core/compress.h
priv.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
priv.o: ../core/error.h ../core/db.h ../core/group.h ../core/dircontainer.h
priv.o: ../core/ugcontainer.h ../core/data.h ../core/dirs.h ../core/users.h
priv.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
priv.o: ../core/mounts.h ../core/mount.h
priv.o: ../core/rebus.h ../core/function.h ../core/thread.h
priv.o: ../core/compress.h ../core/acceptencodingparser.h
priv.o: ../core/acceptbaseparser.h ../core/error.h ../core/db.h
priv.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
priv.o: ../core/data.h ../core/dirs.h ../core/users.h ../core/groups.h
priv.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
priv.o: ../core/mount.h
reload.o: content.h ../core/item.h ../templates/templates.h
reload.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
reload.o: ../core/requesttypes.h ../core/session.h ../core/done.h
reload.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
reload.o: ../core/function.h ../core/thread.h ../core/compress.h
reload.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
reload.o: ../core/error.h
reload.o: ../core/rebus.h ../core/function.h ../core/thread.h
reload.o: ../core/compress.h ../core/acceptencodingparser.h
reload.o: ../core/acceptbaseparser.h ../core/error.h
rm.o: content.h ../core/item.h ../templates/templates.h
rm.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
rm.o: ../core/requesttypes.h ../core/session.h ../core/done.h ../core/item.h
rm.o: ../core/error.h ../core/log.h ../core/user.h ../core/function.h
rm.o: ../core/thread.h ../core/compress.h ../core/acceptencodingparser.h
rm.o: ../core/acceptbaseparser.h ../core/error.h ../core/db.h ../core/group.h
rm.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/data.h
rm.o: ../core/dirs.h ../core/users.h ../core/groups.h ../core/functions.h
rm.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
rm.o: ../core/error.h ../core/log.h ../core/user.h ../core/rebus.h
rm.o: ../core/function.h ../core/thread.h ../core/compress.h
rm.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
rm.o: ../core/error.h ../core/db.h ../core/group.h ../core/dircontainer.h
rm.o: ../core/ugcontainer.h ../core/data.h ../core/dirs.h ../core/users.h
rm.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
rm.o: ../core/mounts.h ../core/mount.h
run.o: content.h ../core/item.h ../templates/templates.h
run.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
run.o: ../core/requesttypes.h ../core/session.h ../core/done.h ../core/item.h
run.o: ../core/error.h ../core/log.h ../core/user.h ../core/function.h
run.o: ../core/thread.h ../core/compress.h ../core/acceptencodingparser.h
run.o: ../core/acceptbaseparser.h ../core/error.h
run.o: ../core/error.h ../core/log.h ../core/user.h ../core/rebus.h
run.o: ../core/function.h ../core/thread.h ../core/compress.h
run.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
run.o: ../core/error.h
thread.o: content.h ../core/item.h ../templates/templates.h
thread.o: ../templates/patterncacher.h ../core/thread.h ../core/request.h
thread.o: ../core/requesttypes.h ../core/session.h ../core/done.h
thread.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
thread.o: ../core/function.h ../core/thread.h ../core/compress.h
thread.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
thread.o: ../core/db.h ../core/group.h ../core/dircontainer.h
thread.o: ../core/ugcontainer.h ../core/data.h ../core/dirs.h ../core/users.h
thread.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
thread.o: ../core/mounts.h ../core/mount.h ../core/mount.h
thread.o: ../core/rebus.h ../core/function.h ../core/thread.h
thread.o: ../core/compress.h ../core/acceptencodingparser.h
thread.o: ../core/acceptbaseparser.h ../core/db.h ../core/group.h
thread.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/data.h
thread.o: ../core/dirs.h ../core/users.h ../core/groups.h ../core/functions.h
thread.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
thread.o: ../core/mount.h
who.o: content.h ../core/item.h ../templates/templates.h
who.o: ../templates/patterncacher.h ../core/thread.h

@ -371,3 +371,53 @@ void Content::PrepareUrl(Item & item)
bool Content::CheckRebus()
{
if( request.session->puser )
// logged user don't have to use the rebus
return true;
if( !request.session->rebus_item )
{
log << log1 << "Content: rebus not set" << logend;
return false;
}
try
{
std::string & answer = request.PostVar("rebus");
if( data.rebus.IsAnswerOk(request.session->rebus_item, answer) )
return true;
}
catch(const Error &)
{
}
log << log1 << "Content: rebus has an incorrect answer" << logend;
return false;
}
void Content::SetUser()
{
if( request.session->puser )
{
request.item.user_id = request.session->puser->id;
request.item.guest_name.clear();
}
else
{
request.item.user_id = -1;
try
{
request.item.guest_name = request.PostVar("guestname");
}
catch(const Error &)
{
}
}
}

@ -36,7 +36,8 @@ class Content
void MakeStandardFunction();
void SetUser();
bool CheckRebus();
void MakePost();

@ -22,7 +22,8 @@ bool Content::FunCreateThreadCheckAccess()
request.status = Error::permision_denied;
return false;
}
return true;
}
@ -33,6 +34,36 @@ void Content::PostFunCreateThread()
if( !FunCreateThreadCheckAccess() )
return;
if( !CheckRebus() )
{
request.status = Error::rebus_bad_answer;
try
{
try
{
request.item.url = request.PostVar("url");
}
catch(...)
{
}
request.item.subject = request.PostVar("subject");
request.item.content = request.PostVar("content");
SetUser();
}
catch(...)
{
}
return;
}
request.post_table.insert( std::make_pair(std::string("url"), std::string()) ); // !! tymczasowo, zrobic aby mkdir i emacs nie rzucaly wyjatkiem gdy nie ma url zdefiniowanego
request.thread.parent_id = request.dir_table.back()->id;
@ -73,8 +104,6 @@ void Content::PostFunCreateThread()
void Content::FunCreateThread()
{
FunCreateThreadCheckAccess();
TemplatesFunctions::thread_show_edit_subject_var = true; // !! tymczasowe rozwiazanie
}

@ -42,16 +42,8 @@ void Content::PostFunEmacsAdd()
request.session->done = Done::added_item;
request.is_item = true;
if( request.session->puser )
{
request.item.user_id = request.session->puser->id;
}
else
{
request.item.user_id = -1;
request.item.guest_name = request.PostVar("guestname");
}
SetUser();
request.item.group_id = -1;
request.item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask
@ -96,6 +88,7 @@ void Content::PostFunEmacsEdit(bool with_url)
void Content::PostFunEmacs()
{
bool adding = true;
@ -131,6 +124,14 @@ bool adding = true;
PrepareUrl(request.item);
if( !CheckRebus() )
{
request.status = Error::rebus_bad_answer;
SetUser();
return;
}
if( adding )
PostFunEmacsAdd();
else

@ -4,12 +4,12 @@ acceptbaseparser.o: acceptbaseparser.h
compress.o: compress.h log.h
config.o: config.h ../confparser/confparser.h log.h data.h dirs.h item.h
config.o: dircontainer.h users.h user.h ugcontainer.h groups.h group.h
config.o: functions.h function.h lastcontainer.h mounts.h mount.h plugin.h
config.o: request.h requesttypes.h session.h done.h error.h thread.h
config.o: functions.h function.h lastcontainer.h mounts.h mount.h rebus.h
config.o: plugin.h request.h requesttypes.h session.h done.h error.h thread.h
config.o: compress.h acceptencodingparser.h acceptbaseparser.h pluginmsg.h
data.o: data.h dirs.h item.h dircontainer.h users.h user.h ugcontainer.h
data.o: log.h groups.h group.h functions.h function.h lastcontainer.h
data.o: mounts.h mount.h
data.o: mounts.h mount.h rebus.h
db.o: db.h item.h user.h group.h thread.h error.h log.h dircontainer.h
db.o: ugcontainer.h misc.h
db_itemcolumns.o: db.h item.h user.h group.h thread.h error.h log.h
@ -17,7 +17,7 @@ db_itemcolumns.o: dircontainer.h ugcontainer.h
dircontainer.o: dircontainer.h item.h log.h
dirs.o: dirs.h item.h dircontainer.h error.h log.h db.h user.h group.h
dirs.o: thread.h ugcontainer.h data.h users.h groups.h functions.h function.h
dirs.o: lastcontainer.h mounts.h mount.h
dirs.o: lastcontainer.h mounts.h mount.h rebus.h
done.o: done.h
error.o: error.h log.h
function.o: function.h item.h
@ -25,8 +25,8 @@ functioncodeparser.o: functioncodeparser.h item.h function.h log.h
functionparser.o: functionparser.h requesttypes.h log.h item.h error.h data.h
functionparser.o: dirs.h dircontainer.h users.h user.h ugcontainer.h groups.h
functionparser.o: group.h functions.h function.h lastcontainer.h mounts.h
functionparser.o: mount.h db.h thread.h request.h session.h done.h compress.h
functionparser.o: acceptencodingparser.h acceptbaseparser.h
functionparser.o: mount.h rebus.h db.h thread.h request.h session.h done.h
functionparser.o: compress.h acceptencodingparser.h acceptbaseparser.h
functions.o: functions.h function.h item.h
groups.o: groups.h group.h ugcontainer.h log.h db.h item.h user.h thread.h
groups.o: error.h dircontainer.h
@ -37,32 +37,34 @@ misc.o: misc.h item.h log.h
mount.o: mount.h
mountparser.o: mountparser.h mount.h item.h error.h log.h data.h dirs.h
mountparser.o: dircontainer.h users.h user.h ugcontainer.h groups.h group.h
mountparser.o: functions.h function.h lastcontainer.h mounts.h
mountparser.o: functions.h function.h lastcontainer.h mounts.h rebus.h
mounts.o: mounts.h mount.h data.h dirs.h item.h dircontainer.h users.h user.h
mounts.o: ugcontainer.h log.h groups.h group.h functions.h function.h
mounts.o: lastcontainer.h request.h requesttypes.h session.h done.h error.h
mounts.o: thread.h compress.h acceptencodingparser.h acceptbaseparser.h
mounts.o: mountparser.h db.h
mounts.o: lastcontainer.h rebus.h request.h requesttypes.h session.h done.h
mounts.o: error.h thread.h compress.h acceptencodingparser.h
mounts.o: acceptbaseparser.h mountparser.h db.h
notify.o: log.h notify.h ../templatesnotify/templatesnotify.h ../core/mount.h
notify.o: data.h dirs.h item.h dircontainer.h users.h user.h ugcontainer.h
notify.o: groups.h group.h functions.h function.h lastcontainer.h mounts.h
notify.o: mount.h misc.h request.h requesttypes.h session.h done.h error.h
notify.o: thread.h compress.h acceptencodingparser.h acceptbaseparser.h
notify.o: mount.h rebus.h misc.h request.h requesttypes.h session.h done.h
notify.o: error.h thread.h compress.h acceptencodingparser.h
notify.o: acceptbaseparser.h
plugin.o: plugin.h request.h requesttypes.h session.h done.h item.h error.h
plugin.o: log.h user.h function.h thread.h compress.h acceptencodingparser.h
plugin.o: acceptbaseparser.h data.h dirs.h dircontainer.h users.h
plugin.o: ugcontainer.h groups.h group.h functions.h lastcontainer.h mounts.h
plugin.o: mount.h pluginmsg.h
plugin.o: log.h user.h rebus.h function.h thread.h compress.h
plugin.o: acceptencodingparser.h acceptbaseparser.h data.h dirs.h
plugin.o: dircontainer.h users.h ugcontainer.h groups.h group.h functions.h
plugin.o: lastcontainer.h mounts.h mount.h pluginmsg.h
rebus.o: log.h rebus.h misc.h item.h
request.o: request.h requesttypes.h session.h done.h item.h error.h log.h
request.o: user.h function.h thread.h compress.h acceptencodingparser.h
request.o: acceptbaseparser.h getparser.h httpsimpleparser.h postparser.h
request.o: cookieparser.h data.h dirs.h dircontainer.h users.h ugcontainer.h
request.o: groups.h group.h functions.h lastcontainer.h mounts.h mount.h
request.o: plugin.h pluginmsg.h
request.o: user.h rebus.h function.h thread.h compress.h
request.o: acceptencodingparser.h acceptbaseparser.h getparser.h
request.o: httpsimpleparser.h postparser.h cookieparser.h data.h dirs.h
request.o: dircontainer.h users.h ugcontainer.h groups.h group.h functions.h
request.o: lastcontainer.h mounts.h mount.h plugin.h pluginmsg.h
requestcontroller.o: requestcontroller.h ../content/content.h ../core/item.h
requestcontroller.o: ../templates/templates.h ../templates/patterncacher.h
requestcontroller.o: ../core/thread.h sessionmanager.h sessioncontainer.h
requestcontroller.o: session.h done.h item.h error.h log.h user.h
requestcontroller.o: session.h done.h item.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
@ -70,14 +72,14 @@ requestcontroller.o: request.h thread.h compress.h acceptencodingparser.h
requestcontroller.o: acceptbaseparser.h postparser.h httpsimpleparser.h
requestcontroller.o: cookieparser.h notify.h
requestcontroller.o: ../templatesnotify/templatesnotify.h ../core/mount.h
session.o: session.h done.h item.h error.h log.h user.h
session.o: session.h done.h item.h error.h log.h user.h rebus.h
sessioncontainer.o: sessioncontainer.h session.h done.h item.h error.h log.h
sessioncontainer.o: user.h data.h dirs.h dircontainer.h users.h ugcontainer.h
sessioncontainer.o: groups.h group.h functions.h function.h lastcontainer.h
sessioncontainer.o: mounts.h mount.h
sessioncontainer.o: user.h rebus.h data.h dirs.h dircontainer.h users.h
sessioncontainer.o: ugcontainer.h groups.h group.h functions.h function.h
sessioncontainer.o: lastcontainer.h mounts.h mount.h
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h done.h item.h
sessionmanager.o: error.h log.h user.h request.h requesttypes.h function.h
sessionmanager.o: thread.h compress.h acceptencodingparser.h
sessionmanager.o: error.h log.h user.h rebus.h request.h requesttypes.h
sessionmanager.o: function.h thread.h compress.h acceptencodingparser.h
sessionmanager.o: acceptbaseparser.h data.h dirs.h dircontainer.h users.h
sessionmanager.o: ugcontainer.h groups.h group.h functions.h lastcontainer.h
sessionmanager.o: mounts.h mount.h

@ -1 +1 @@
o = acceptbaseparser.o compress.o config.o data.o db.o db_itemcolumns.o dircontainer.o dirs.o done.o error.o function.o functioncodeparser.o functionparser.o functions.o groups.o httpsimpleparser.o lastcontainer.o log.o misc.o mount.o mountparser.o mounts.o notify.o plugin.o request.o requestcontroller.o session.o sessioncontainer.o sessionmanager.o users.o
o = acceptbaseparser.o compress.o config.o data.o db.o db_itemcolumns.o dircontainer.o dirs.o done.o error.o function.o functioncodeparser.o functionparser.o functions.o groups.o httpsimpleparser.o lastcontainer.o log.o misc.o mount.o mountparser.o mounts.o notify.o plugin.o rebus.o request.o requestcontroller.o session.o sessioncontainer.o sessionmanager.o users.o

@ -21,7 +21,7 @@
#include "functions.h"
#include "lastcontainer.h"
#include "mounts.h"
#include "rebus.h"
class Data
@ -127,6 +127,8 @@ public:
// mount points
Mounts mounts;
// rebus (captcha)
Rebus rebus;
Data();

@ -51,6 +51,8 @@ public:
no_thread,
empty,
rebus_bad_answer,
unknown = 1000

@ -348,6 +348,15 @@ std::string::size_type i;
}
const char * SkipWhite(const char * s)
{
while( IsWhite(*s) )
++s;
return s;
}
void ToSmall(std::string & s)
{
std::string::size_type i;

@ -42,6 +42,7 @@ const char * IpToStr(unsigned int ip_);
bool IsWhite(int s);
void TrimWhite(std::string & s);
void ToSmall(std::string & s);
const char * SkipWhite(const char * s);
bool ValidateEmail(const std::string & email);

@ -0,0 +1,131 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
* All rights reserved.
*
*/
#include <cstdlib>
#include <limits.h>
#include "log.h"
#include "rebus.h"
#include "misc.h"
bool Rebus::InitPair(int a, int b, Item & item)
{
char buffer[100];
bool add = false;
if( a+b <= 15 )
{
sprintf(buffer, "%d+%d", a, b);
item.question = buffer;
item.answer = a+b;
add = true;
}
if( a-b >= 0 )
{
sprintf(buffer, "%d-%d", a, b);
item.question = buffer;
item.answer = a-b;
add = true;
}
return add;
}
void Rebus::Init()
{
int a, b;
Item item;
item.key = 0;
for(a=1 ; a<10 ; ++a)
{
for(b=1 ; b<10 ; ++b)
{
if( InitPair(a, b, item) )
{
table.push_back(item);
item.key += 1;
}
}
}
}
Rebus::Item * Rebus::Rand()
{
size_t len = table.size();
if( len == 0 )
// empty table, call Init() first
return 0;
size_t i = size_t( ((double)rand()*(double)len) / (double(RAND_MAX)+1.0) );
if( i >= table.size() )
{
log << log1 << "Rebus: Rand() index too big" << logend;
// oops, it should not be greater then table.size()
return &table[0];
}
return &table[0] + i;
}
bool Rebus::IsAnswerOk(Rebus::Item * item, const std::string & answer)
{
if( item == 0 )
return false;
char * end;
const char * a = answer.c_str();
a = SkipWhite(a);
int value = (int)strtol(a, &end, 10);
if( a == end )
// nothing has been read
return false;
log << log2 << "Rebus: your answer is: " << value << logend;
end = (char*)SkipWhite(end);
if( *end != 0 )
{
// something is at the end
return false;
}
bool result = (item->answer == value);
if( result )
log << log3 << "Rebus: the answer is correct" << logend;
return result;
}

@ -0,0 +1,43 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfilecmslucorerebus
#define headerfilecmslucorerebus
#include <string>
#include <vector>
class Rebus
{
public:
struct Item
{
int key;
std::string question;
int answer;
};
void Init();
Item * Rand();
bool IsAnswerOk(Item * item, const std::string & answer);
private:
bool InitPair(int a, int b, Item & item);
std::vector<Item> table;
};
#endif

@ -86,6 +86,10 @@ void Request::Clear()
browser_msie = false;
// should be always empty
// this is only for safety
//string_empty.clear();
plugin.Call(CMSLU_REQUEST_CLEAR);
}
@ -167,7 +171,10 @@ bool Request::PostVar(const char * var, std::string & result)
p = post_table.find(var);
if( p == post_table.end() )
{
result.clear();
return false;
}
result = p->second;

@ -187,6 +187,9 @@ private:
// it contains '\0'
const char char_empty;
// used when returning a reference to std::string (when the string doesn't exist)
const std::string string_empty;
const char * SetEnvVar(const char * var);
void StandardLog();

@ -107,6 +107,8 @@ bool RequestController::Init()
data.groups.ReadGroups();
data.functions.ReadFunctions();
data.mounts.ReadMounts();
data.rebus.Init();
//

@ -32,7 +32,8 @@ void Session::Clear()
done_status = Error::ok;
item.Clear();
done_timer = 0;
rebus_item = 0;
dir_old.clear();
}

@ -15,7 +15,7 @@
#include "item.h"
#include "error.h"
#include "user.h"
#include "rebus.h"
struct Session
@ -48,6 +48,8 @@ struct Session
Item item;
Rebus::Item * rebus_item;
std::string dir_old;
// -------------------

@ -4,7 +4,7 @@ main.o: ../core/requestcontroller.h ../content/content.h ../core/item.h
main.o: ../templates/templates.h ../templates/patterncacher.h
main.o: ../core/thread.h ../core/sessionmanager.h ../core/sessioncontainer.h
main.o: ../core/session.h ../core/done.h ../core/item.h ../core/error.h
main.o: ../core/log.h ../core/user.h ../core/functionparser.h
main.o: ../core/log.h ../core/user.h ../core/rebus.h ../core/functionparser.h
main.o: ../core/requesttypes.h ../core/data.h ../core/dirs.h
main.o: ../core/dircontainer.h ../core/users.h ../core/ugcontainer.h
main.o: ../core/groups.h ../core/group.h ../core/functions.h

@ -2,113 +2,126 @@
dir.o: templates.h patterncacher.h ../core/item.h ../core/request.h
dir.o: ../core/requesttypes.h ../core/session.h ../core/done.h ../core/item.h
dir.o: ../core/error.h ../core/log.h ../core/user.h ../core/function.h
dir.o: ../core/thread.h ../core/compress.h ../core/acceptencodingparser.h
dir.o: ../core/acceptbaseparser.h ../core/data.h ../core/dirs.h
dir.o: ../core/dircontainer.h ../core/users.h ../core/ugcontainer.h
dir.o: ../core/groups.h ../core/group.h ../core/functions.h
dir.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h ../core/db.h
dir.o: ../core/log.h ../core/misc.h
dir.o: ../core/error.h ../core/log.h ../core/user.h ../core/rebus.h
dir.o: ../core/function.h ../core/thread.h ../core/compress.h
dir.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
dir.o: ../core/data.h ../core/dirs.h ../core/dircontainer.h ../core/users.h
dir.o: ../core/ugcontainer.h ../core/groups.h ../core/group.h
dir.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
dir.o: ../core/mount.h ../core/db.h ../core/log.h ../core/misc.h
doc.o: templates.h patterncacher.h ../core/item.h ../core/data.h
doc.o: ../core/dirs.h ../core/item.h ../core/dircontainer.h ../core/users.h
doc.o: ../core/user.h ../core/ugcontainer.h ../core/log.h ../core/groups.h
doc.o: ../core/group.h ../core/functions.h ../core/function.h
doc.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
doc.o: ../core/request.h ../core/requesttypes.h ../core/session.h
doc.o: ../core/done.h ../core/error.h ../core/thread.h ../core/compress.h
doc.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
doc.o: ../core/misc.h
doc.o: ../core/rebus.h ../core/request.h ../core/requesttypes.h
doc.o: ../core/session.h ../core/done.h ../core/error.h ../core/thread.h
doc.o: ../core/compress.h ../core/acceptencodingparser.h
doc.o: ../core/acceptbaseparser.h ../core/misc.h
done.o: templates.h patterncacher.h ../core/item.h ../core/request.h
done.o: ../core/requesttypes.h ../core/session.h ../core/done.h
done.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
done.o: ../core/function.h ../core/thread.h ../core/compress.h
done.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
done.o: ../core/misc.h
done.o: ../core/rebus.h ../core/function.h ../core/thread.h
done.o: ../core/compress.h ../core/acceptencodingparser.h
done.o: ../core/acceptbaseparser.h ../core/misc.h
item.o: templates.h patterncacher.h ../core/item.h ../core/data.h
item.o: ../core/dirs.h ../core/item.h ../core/dircontainer.h ../core/users.h
item.o: ../core/user.h ../core/ugcontainer.h ../core/log.h ../core/groups.h
item.o: ../core/group.h ../core/functions.h ../core/function.h
item.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
item.o: ../core/request.h ../core/requesttypes.h ../core/session.h
item.o: ../core/done.h ../core/error.h ../core/thread.h ../core/compress.h
item.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
item.o: ../core/misc.h
item.o: ../core/rebus.h ../core/request.h ../core/requesttypes.h
item.o: ../core/session.h ../core/done.h ../core/error.h ../core/thread.h
item.o: ../core/compress.h ../core/acceptencodingparser.h
item.o: ../core/acceptbaseparser.h ../core/misc.h
last.o: templates.h patterncacher.h ../core/item.h ../core/lastcontainer.h
last.o: ../core/data.h ../core/dirs.h ../core/item.h ../core/dircontainer.h
last.o: ../core/users.h ../core/user.h ../core/ugcontainer.h ../core/log.h
last.o: ../core/groups.h ../core/group.h ../core/functions.h
last.o: ../core/function.h ../core/lastcontainer.h ../core/mounts.h
last.o: ../core/mount.h ../core/request.h ../core/requesttypes.h
last.o: ../core/session.h ../core/done.h ../core/error.h ../core/thread.h
last.o: ../core/compress.h ../core/acceptencodingparser.h
last.o: ../core/acceptbaseparser.h ../core/misc.h
last.o: ../core/mount.h ../core/rebus.h ../core/request.h
last.o: ../core/requesttypes.h ../core/session.h ../core/done.h
last.o: ../core/error.h ../core/thread.h ../core/compress.h
last.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
last.o: ../core/misc.h
mount.o: templates.h patterncacher.h ../core/item.h ../core/data.h
mount.o: ../core/dirs.h ../core/item.h ../core/dircontainer.h ../core/users.h
mount.o: ../core/user.h ../core/ugcontainer.h ../core/log.h ../core/groups.h
mount.o: ../core/group.h ../core/functions.h ../core/function.h
mount.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
mount.o: ../core/rebus.h
patterncacher.o: patterncacher.h ../core/item.h ../core/data.h ../core/dirs.h
patterncacher.o: ../core/item.h ../core/dircontainer.h ../core/users.h
patterncacher.o: ../core/user.h ../core/ugcontainer.h ../core/log.h
patterncacher.o: ../core/groups.h ../core/group.h ../core/functions.h
patterncacher.o: ../core/function.h ../core/lastcontainer.h ../core/mounts.h
patterncacher.o: ../core/mount.h ../core/log.h
patterncacher.o: ../core/mount.h ../core/rebus.h ../core/log.h
priv.o: templates.h patterncacher.h ../core/item.h ../core/data.h
priv.o: ../core/dirs.h ../core/item.h ../core/dircontainer.h ../core/users.h
priv.o: ../core/user.h ../core/ugcontainer.h ../core/log.h ../core/groups.h
priv.o: ../core/group.h ../core/functions.h ../core/function.h
priv.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
priv.o: ../core/request.h ../core/requesttypes.h ../core/session.h
priv.o: ../core/done.h ../core/error.h ../core/thread.h ../core/compress.h
priv.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
priv.o: ../core/misc.h
priv.o: ../core/rebus.h ../core/request.h ../core/requesttypes.h
priv.o: ../core/session.h ../core/done.h ../core/error.h ../core/thread.h
priv.o: ../core/compress.h ../core/acceptencodingparser.h
priv.o: ../core/acceptbaseparser.h ../core/misc.h
rebus.o: ../core/request.h ../core/requesttypes.h ../core/session.h
rebus.o: ../core/done.h ../core/item.h ../core/error.h ../core/log.h
rebus.o: ../core/user.h ../core/rebus.h ../core/function.h ../core/thread.h
rebus.o: ../core/compress.h ../core/acceptencodingparser.h
rebus.o: ../core/acceptbaseparser.h ../core/data.h ../core/dirs.h
rebus.o: ../core/dircontainer.h ../core/users.h ../core/ugcontainer.h
rebus.o: ../core/groups.h ../core/group.h ../core/functions.h
rebus.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h templates.h
rebus.o: patterncacher.h ../core/item.h
sys.o: templates.h patterncacher.h ../core/item.h ../core/data.h
sys.o: ../core/dirs.h ../core/item.h ../core/dircontainer.h ../core/users.h
sys.o: ../core/user.h ../core/ugcontainer.h ../core/log.h ../core/groups.h
sys.o: ../core/group.h ../core/functions.h ../core/function.h
sys.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
sys.o: ../core/request.h ../core/requesttypes.h ../core/session.h
sys.o: ../core/done.h ../core/error.h ../core/thread.h ../core/compress.h
sys.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
sys.o: ../core/misc.h
sys.o: ../core/rebus.h ../core/request.h ../core/requesttypes.h
sys.o: ../core/session.h ../core/done.h ../core/error.h ../core/thread.h
sys.o: ../core/compress.h ../core/acceptencodingparser.h
sys.o: ../core/acceptbaseparser.h ../core/misc.h
templates.o: templates.h patterncacher.h ../core/item.h ../core/data.h
templates.o: ../core/dirs.h ../core/item.h ../core/dircontainer.h
templates.o: ../core/users.h ../core/user.h ../core/ugcontainer.h
templates.o: ../core/log.h ../core/groups.h ../core/group.h
templates.o: ../core/functions.h ../core/function.h ../core/lastcontainer.h
templates.o: ../core/mounts.h ../core/mount.h ../core/request.h
templates.o: ../core/requesttypes.h ../core/session.h ../core/done.h
templates.o: ../core/error.h ../core/thread.h ../core/compress.h
templates.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
templates.o: ../core/misc.h ../core/plugin.h ../core/request.h ../core/data.h
templates.o: ../core/pluginmsg.h
templates.o: ../core/mounts.h ../core/mount.h ../core/rebus.h
templates.o: ../core/request.h ../core/requesttypes.h ../core/session.h
templates.o: ../core/done.h ../core/error.h ../core/thread.h
templates.o: ../core/compress.h ../core/acceptencodingparser.h
templates.o: ../core/acceptbaseparser.h ../core/misc.h ../core/plugin.h
templates.o: ../core/request.h ../core/data.h ../core/pluginmsg.h
thread.o: templates.h patterncacher.h ../core/item.h ../core/data.h
thread.o: ../core/dirs.h ../core/item.h ../core/dircontainer.h
thread.o: ../core/users.h ../core/user.h ../core/ugcontainer.h ../core/log.h
thread.o: ../core/groups.h ../core/group.h ../core/functions.h
thread.o: ../core/function.h ../core/lastcontainer.h ../core/mounts.h
thread.o: ../core/mount.h ../core/request.h ../core/requesttypes.h
thread.o: ../core/session.h ../core/done.h ../core/error.h ../core/thread.h
thread.o: ../core/compress.h ../core/acceptencodingparser.h
thread.o: ../core/acceptbaseparser.h ../core/misc.h
thread.o: ../core/mount.h ../core/rebus.h ../core/request.h
thread.o: ../core/requesttypes.h ../core/session.h ../core/done.h
thread.o: ../core/error.h ../core/thread.h ../core/compress.h
thread.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
thread.o: ../core/misc.h
user.o: templates.h patterncacher.h ../core/item.h ../core/data.h
user.o: ../core/dirs.h ../core/item.h ../core/dircontainer.h ../core/users.h
user.o: ../core/user.h ../core/ugcontainer.h ../core/log.h ../core/groups.h
user.o: ../core/group.h ../core/functions.h ../core/function.h
user.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
user.o: ../core/request.h ../core/requesttypes.h ../core/session.h
user.o: ../core/done.h ../core/error.h ../core/thread.h ../core/compress.h
user.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
user.o: ../core/misc.h
user.o: ../core/rebus.h ../core/request.h ../core/requesttypes.h
user.o: ../core/session.h ../core/done.h ../core/error.h ../core/thread.h
user.o: ../core/compress.h ../core/acceptencodingparser.h
user.o: ../core/acceptbaseparser.h ../core/misc.h
who.o: templates.h patterncacher.h ../core/item.h ../core/sessioncontainer.h
who.o: ../core/session.h ../core/done.h ../core/item.h ../core/error.h
who.o: ../core/log.h ../core/user.h ../core/requestcontroller.h
who.o: ../content/content.h ../templates/templates.h ../core/thread.h
who.o: ../core/sessionmanager.h ../core/sessioncontainer.h
who.o: ../core/functionparser.h ../core/requesttypes.h ../core/data.h
who.o: ../core/dirs.h ../core/dircontainer.h ../core/users.h
who.o: ../core/ugcontainer.h ../core/groups.h ../core/group.h
who.o: ../core/functions.h ../core/function.h ../core/lastcontainer.h
who.o: ../core/mounts.h ../core/mount.h ../core/request.h ../core/thread.h
who.o: ../core/compress.h ../core/acceptencodingparser.h
who.o: ../core/acceptbaseparser.h ../core/misc.h
who.o: ../core/log.h ../core/user.h ../core/rebus.h
who.o: ../core/requestcontroller.h ../content/content.h
who.o: ../templates/templates.h ../core/thread.h ../core/sessionmanager.h
who.o: ../core/sessioncontainer.h ../core/functionparser.h
who.o: ../core/requesttypes.h ../core/data.h ../core/dirs.h
who.o: ../core/dircontainer.h ../core/users.h ../core/ugcontainer.h
who.o: ../core/groups.h ../core/group.h ../core/functions.h
who.o: ../core/function.h ../core/lastcontainer.h ../core/mounts.h
who.o: ../core/mount.h ../core/request.h ../core/thread.h ../core/compress.h
who.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
who.o: ../core/misc.h

@ -1 +1 @@
o = dir.o doc.o done.o item.o last.o mount.o patterncacher.o priv.o sys.o templates.o thread.o user.o who.o
o = dir.o doc.o done.o item.o last.o mount.o patterncacher.o priv.o rebus.o sys.o templates.o thread.o user.o who.o

@ -207,6 +207,10 @@ void item_run(Info & i)
}
void item_guest_name(Info & i)
{
HtmlEscape(i.out, request.item.guest_name);
}

@ -136,6 +136,7 @@ Ezc::Pattern * p = 0;
switch( request.status )
{
case Error::ok:
case Error::rebus_bad_answer:
p = content_for_function();
break;
@ -231,6 +232,7 @@ void Templates::CreateFunctions()
functions.Insert("item_date_modification", item_date_modification);
functions.Insert("item_dates_equal", item_dates_equal);
functions.Insert("item_run", item_run);
functions.Insert("item_guest_name", item_guest_name);
functions.Insert("item_old_id", item_old_id);
functions.Insert("item_old_subject", item_old_subject);
@ -360,7 +362,6 @@ void Templates::CreateFunctions()
thread
*/
functions.Insert("thread_is", thread_is);
functions.Insert("thread_show_edit_subject", thread_show_edit_subject);
functions.Insert("thread_tab", thread_tab);
functions.Insert("thread_tab_url", thread_tab_url);
functions.Insert("thread_tab_subject", thread_tab_subject);
@ -382,6 +383,13 @@ void Templates::CreateFunctions()
functions.Insert("mount_is_cms", mount_is_cms);
/*
rebus
*/
functions.Insert("rebus_question", rebus_question);
plugin.Call(CMSLU_TEMPLATES_CREATEFUNCTIONS, &functions);
}

@ -21,9 +21,7 @@
namespace TemplatesFunctions
{
using Ezc::Info;
extern bool thread_show_edit_subject_var;
extern PatternCacher pattern_cacher;
extern Ezc::Functions functions;
extern Ezc::Pattern pat_item_info;
@ -74,6 +72,7 @@ namespace TemplatesFunctions
void item_date_modification(Info & i);
void item_dates_equal(Info & i);
void item_run(Info & i);
void item_guest_name(Info & i);
// !! wprowadzic item_old_is ?
void item_old_id(Info & i);
@ -200,7 +199,6 @@ namespace TemplatesFunctions
thread
*/
void thread_is(Info & i);
void thread_show_edit_subject(Info & i);
void thread_tab(Info & i);
void thread_tab_url(Info & i);
void thread_tab_subject(Info & i);
@ -221,6 +219,12 @@ namespace TemplatesFunctions
void mount_is_thread(Info & i);
void mount_is_cms(Info & i);
/*
rebus
*/
void rebus_question(Info & i);
} // namespace TemplatesFunctions

@ -23,18 +23,6 @@ void thread_is(Info & i)
}
bool thread_show_edit_subject_var = false; // !! tymczasowe rozwiazanie, cos lepszego wymyslec
void thread_show_edit_subject(Info & i)
{
i.result = thread_show_edit_subject_var;
thread_show_edit_subject_var = false;
}
static size_t thread_tab_index;
@ -74,7 +62,10 @@ void thread_tab_subject(Info & i)
if( dir )
{
HtmlEscape(i.out, dir->subject);
if( !dir->subject.empty() )
HtmlEscape(i.out, dir->subject);
else
HtmlEscape(i.out, dir->url);
}
else
{

Loading…
Cancel
Save