I have forgotten to add templates/rebus.cpp to the repository

git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@525 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2009-11-17 01:07:29 +00:00
parent dc5f002de3
commit 13b0204427
1 changed files with 52 additions and 0 deletions

52
templates/rebus.cpp Executable file
View File

@ -0,0 +1,52 @@
/*
* 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 "../core/request.h"
#include "../core/data.h"
#include "templates.h"
namespace TemplatesFunctions
{
static size_t rebus_reqid = 0;
void rebus_init()
{
if( rebus_reqid != request.id )
{
request.session->rebus_item = data.rebus.Rand();
rebus_reqid = request.id;
}
}
void rebus_question(Info & i)
{
rebus_init();
if( request.session->rebus_item )
i.out << request.session->rebus_item->question;
}
} // namespace