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:
2010-02-11 20:56:52 +00:00
parent fc3c303d30
commit adf36e71ce
51 changed files with 1006 additions and 353 deletions

55
templates/uptime.cpp Executable file
View File

@@ -0,0 +1,55 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include <ctime>
#include "templates.h"
#include "../core/data.h"
namespace TemplatesFunctions
{
void uptime_more_than_one_day(Info & i)
{
time_t up = time(0) - data.system_start;
time_t days = up / 60 / 60 / 24;
i.result = ( days > 1 );
}
void uptime_days(Info & i)
{
time_t up = time(0) - data.system_start;
time_t days = up / 60 / 60 / 24;
i.out << days;
}
void uptime_hours(Info & i)
{
char buf[50];
time_t sec = time(0) - data.system_start;
time_t min = sec / 60;
time_t hour = min / 60;
if( hour == 0 && min == 0 )
sprintf(buf, "%d:%02d:%02d", hour, min, sec);
else
sprintf(buf, "%d:%02d", hour, min);
i.out << buf;
}
} // namespace