fixed: there were mktime() used on some dirs Items
so sometimes the time of the dir was changed now for converting tm into time_t use: time_t Time(const tm & par); time_t Time(const tm * par); tm Time(time_t par); from core/misc.h now winix internally use GMT time only when printing it is converted to local user time temporarily all users use the same local time (config: time_zone_offset) (only logs are genereted with local system time) added to system: time_t LocalTime(time_t gmt_time); tm LocalTime(const tm * ptm); tm LocalTime(const tm & ptm); they convert GMT time to local user time git-svn-id: svn://ttmath.org/publicrep/winix/trunk@666 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
a1bee81a5b
commit
c48241f78a
|
@ -83,7 +83,8 @@ groups.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
||||||
groups.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h
|
groups.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||||
htmlfilter.o: htmlfilter.h
|
htmlfilter.o: htmlfilter.h
|
||||||
httpsimpleparser.o: httpsimpleparser.h
|
httpsimpleparser.o: httpsimpleparser.h
|
||||||
lastcontainer.o: lastcontainer.h log.h
|
item.o: item.h misc.h
|
||||||
|
lastcontainer.o: lastcontainer.h log.h misc.h item.h
|
||||||
loadavg.o: loadavg.h log.h
|
loadavg.o: loadavg.h log.h
|
||||||
locale.o: locale.h confparser.h log.h
|
locale.o: locale.h confparser.h log.h
|
||||||
log.o: log.h
|
log.o: log.h
|
||||||
|
@ -231,9 +232,9 @@ request.o: ../core/item.h ../templates/ckeditorgetparser.h
|
||||||
request.o: ../core/httpsimpleparser.h ../core/log.h
|
request.o: ../core/httpsimpleparser.h ../core/log.h
|
||||||
request.o: ../templates/indexpatterns.h ../templates/localefilter.h
|
request.o: ../templates/indexpatterns.h ../templates/localefilter.h
|
||||||
request.o: ../core/locale.h ../core/locale.h ../core/sessionmanager.h
|
request.o: ../core/locale.h ../core/locale.h ../core/sessionmanager.h
|
||||||
session.o: session.h item.h error.h user.h plugindata.h rebus.h
|
session.o: session.h item.h error.h user.h plugindata.h rebus.h misc.h
|
||||||
sessioncontainer.o: sessioncontainer.h session.h item.h error.h user.h
|
sessioncontainer.o: sessioncontainer.h session.h item.h error.h user.h
|
||||||
sessioncontainer.o: plugindata.h rebus.h lastcontainer.h log.h
|
sessioncontainer.o: plugindata.h rebus.h lastcontainer.h log.h misc.h
|
||||||
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h item.h
|
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h item.h
|
||||||
sessionmanager.o: error.h user.h plugindata.h rebus.h lastcontainer.h
|
sessionmanager.o: error.h user.h plugindata.h rebus.h lastcontainer.h
|
||||||
sessionmanager.o: config.h confparser.h htmlfilter.h request.h requesttypes.h
|
sessionmanager.o: config.h confparser.h htmlfilter.h request.h requesttypes.h
|
||||||
|
@ -277,7 +278,7 @@ sessionparser.o: ../db/dbtextstream.h ../core/textstream.h ../core/error.h
|
||||||
sessionparser.o: log.h ../db/dbitemquery.h ../core/item.h
|
sessionparser.o: log.h ../db/dbitemquery.h ../core/item.h
|
||||||
sessionparser.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
sessionparser.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
||||||
sessionparser.o: ../core/thread.h ../core/dircontainer.h
|
sessionparser.o: ../core/thread.h ../core/dircontainer.h
|
||||||
sessionparser.o: ../core/ugcontainer.h
|
sessionparser.o: ../core/ugcontainer.h misc.h
|
||||||
system.o: system.h dirs.h item.h dircontainer.h ../db/db.h ../db/dbbase.h
|
system.o: system.h dirs.h item.h dircontainer.h ../db/db.h ../db/dbbase.h
|
||||||
system.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
|
system.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
|
||||||
system.o: ../core/error.h log.h ../db/dbitemquery.h ../core/item.h
|
system.o: ../core/error.h log.h ../db/dbitemquery.h ../core/item.h
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
o = acceptbaseparser.o app.o bbcodeparser.o compress.o config.o confparser.o dircontainer.o dirs.o groups.o htmlfilter.o httpsimpleparser.o lastcontainer.o loadavg.o locale.o log.o misc.o mount.o mountparser.o mounts.o notify.o plugin.o plugindata.o postmultiparser.o rebus.o request.o session.o sessioncontainer.o sessionmanager.o sessionparser.o system.o textstream.o users.o
|
o = acceptbaseparser.o app.o bbcodeparser.o compress.o config.o confparser.o dircontainer.o dirs.o groups.o htmlfilter.o httpsimpleparser.o item.o lastcontainer.o loadavg.o locale.o log.o misc.o mount.o mountparser.o mounts.o notify.o plugin.o plugindata.o postmultiparser.o rebus.o request.o session.o sessioncontainer.o sessionmanager.o sessionparser.o system.o textstream.o users.o
|
||||||
|
|
18
core/app.cpp
18
core/app.cpp
|
@ -19,7 +19,7 @@
|
||||||
App::App()
|
App::App()
|
||||||
{
|
{
|
||||||
stdout_is_closed = false;
|
stdout_is_closed = false;
|
||||||
last_sessions_save = time(0);
|
last_sessions_save = std::time(0);
|
||||||
|
|
||||||
db.SetConn(db_conn);
|
db.SetConn(db_conn);
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ void App::Start()
|
||||||
|
|
||||||
void App::SaveSessionsIfNeeded()
|
void App::SaveSessionsIfNeeded()
|
||||||
{
|
{
|
||||||
time_t t = time(0);
|
time_t t = std::time(0);
|
||||||
|
|
||||||
if( last_sessions_save + 86400 > t )
|
if( last_sessions_save + 86400 > t )
|
||||||
return;
|
return;
|
||||||
|
@ -531,17 +531,9 @@ void App::PrepareSessionCookie()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
time_t t = time(0) + config.session_remember_max_idle;
|
time_t t = std::time(0) + config.session_remember_max_idle;
|
||||||
tm * expires = localtime(&t);
|
tm expires = Time(t);
|
||||||
|
request.SetCookie(config.http_session_id_name.c_str(), request.session->id, &expires);
|
||||||
if( !expires )
|
|
||||||
{
|
|
||||||
// oops, something wrong
|
|
||||||
request.SetCookie(config.http_session_id_name.c_str(), request.session->id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
request.SetCookie(config.http_session_id_name.c_str(), request.session->id, expires);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,9 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||||
plugins_dir = Text("plugins_dir", "/usr/local/winix/plugins");
|
plugins_dir = Text("plugins_dir", "/usr/local/winix/plugins");
|
||||||
NoLastSlash(plugins_dir);
|
NoLastSlash(plugins_dir);
|
||||||
parser.ListText("plugins", plugin_file);
|
parser.ListText("plugins", plugin_file);
|
||||||
|
|
||||||
|
time_zone_offset = Int("time_zone_offset", 0);
|
||||||
|
time_zone_offset_guest = Int("time_zone_offset_guest", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,15 @@ public:
|
||||||
// (if true the html code for root is not filtered)
|
// (if true the html code for root is not filtered)
|
||||||
bool editors_html_safe_mode_skip_root;
|
bool editors_html_safe_mode_skip_root;
|
||||||
|
|
||||||
|
// temporarily we do not support time zones per user
|
||||||
|
// there is one offset for all users
|
||||||
|
// default: 0
|
||||||
|
int time_zone_offset;
|
||||||
|
|
||||||
|
// time zone offset for guests (not logged users)
|
||||||
|
// default: 0
|
||||||
|
int time_zone_offset_guest;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of Winix
|
||||||
|
* and is not publicly distributed
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "item.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item::Item()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Item::SetDateToNow()
|
||||||
|
{
|
||||||
|
date_creation = Time(std::time(0));
|
||||||
|
date_modification = date_creation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Item::SetDateModifyToNow()
|
||||||
|
{
|
||||||
|
date_modification = Time(std::time(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Item::Clear()
|
||||||
|
{
|
||||||
|
id = -1;
|
||||||
|
|
||||||
|
user_id = -1;
|
||||||
|
group_id = -1;
|
||||||
|
privileges = 0;
|
||||||
|
modification_user_id = -1;
|
||||||
|
|
||||||
|
guest_name.clear();
|
||||||
|
|
||||||
|
subject.clear();
|
||||||
|
content.clear();
|
||||||
|
url.clear();
|
||||||
|
|
||||||
|
content_type = ct_formatted_text;
|
||||||
|
|
||||||
|
type = none;
|
||||||
|
parent_id = -1;
|
||||||
|
default_item = -1;
|
||||||
|
|
||||||
|
content_id = -1;
|
||||||
|
|
||||||
|
auth = auth_none;
|
||||||
|
auth_path.clear();
|
||||||
|
|
||||||
|
html_template.clear();
|
||||||
|
|
||||||
|
SetDateToNow();
|
||||||
|
}
|
63
core/item.h
63
core/item.h
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Item
|
struct Item
|
||||||
{
|
{
|
||||||
long id;
|
long id;
|
||||||
|
@ -83,64 +82,12 @@ std::string auth_path; // path to a file (if auth!=auth_none)
|
||||||
|
|
||||||
std::string html_template;
|
std::string html_template;
|
||||||
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
|
Item();
|
||||||
Item()
|
void SetDateToNow();
|
||||||
{
|
void SetDateModifyToNow();
|
||||||
Clear();
|
void Clear();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SetDateToNow()
|
|
||||||
{
|
|
||||||
time_t t = std::time(0);
|
|
||||||
date_creation = *std::localtime( &t );
|
|
||||||
date_modification = date_creation;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SetDateModifyToNow()
|
|
||||||
{
|
|
||||||
time_t t = std::time(0);
|
|
||||||
date_modification = *std::localtime( &t );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
id = -1;
|
|
||||||
|
|
||||||
user_id = -1;
|
|
||||||
group_id = -1;
|
|
||||||
privileges = 0;
|
|
||||||
modification_user_id = -1;
|
|
||||||
|
|
||||||
guest_name.clear();
|
|
||||||
|
|
||||||
subject.clear();
|
|
||||||
content.clear();
|
|
||||||
url.clear();
|
|
||||||
|
|
||||||
content_type = ct_formatted_text;
|
|
||||||
|
|
||||||
type = none;
|
|
||||||
parent_id = -1;
|
|
||||||
default_item = -1;
|
|
||||||
|
|
||||||
content_id = -1;
|
|
||||||
|
|
||||||
auth = auth_none;
|
|
||||||
auth_path.clear();
|
|
||||||
|
|
||||||
html_template.clear();
|
|
||||||
|
|
||||||
SetDateToNow();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "lastcontainer.h"
|
#include "lastcontainer.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
|
||||||
LastItem::LastItem()
|
LastItem::LastItem()
|
||||||
|
@ -87,9 +87,7 @@ LastTab::iterator i = FindNotLoggedOut(user_id, session_id);
|
||||||
li.name = name;
|
li.name = name;
|
||||||
li.ip = ip;
|
li.ip = ip;
|
||||||
li.session_id = session_id;
|
li.session_id = session_id;
|
||||||
|
li.start = Time(std::time(0));
|
||||||
time_t t = std::time(0);
|
|
||||||
li.start = *localtime(&t);
|
|
||||||
|
|
||||||
last_tab.insert(last_tab.end(), li);
|
last_tab.insert(last_tab.end(), li);
|
||||||
|
|
||||||
|
@ -105,8 +103,7 @@ LastTab::iterator i = FindNotLoggedOut(user_id, session_id);
|
||||||
|
|
||||||
if( i != last_tab.end() )
|
if( i != last_tab.end() )
|
||||||
{
|
{
|
||||||
time_t t = std::time(0);
|
i->end = Time(std::time(0));
|
||||||
i->end = *localtime(&t);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,8 @@ void Log::OpenFile()
|
||||||
|
|
||||||
void Log::PutDate(Manipulators m)
|
void Log::PutDate(Manipulators m)
|
||||||
{
|
{
|
||||||
|
// logs are related to localtime
|
||||||
|
|
||||||
time_t t = std::time(0);
|
time_t t = std::time(0);
|
||||||
std::tm * loct = std::localtime(&t);
|
std::tm * loct = std::localtime(&t);
|
||||||
|
|
||||||
|
|
|
@ -311,31 +311,43 @@ static char buffer[100];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char * DateToStr(tm * ptm)
|
const char * DateToStr(const tm * ptm)
|
||||||
{
|
{
|
||||||
return DateToStr(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
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)
|
const char * DateToStr(const tm & rtm)
|
||||||
{
|
{
|
||||||
tm * ptm = std::localtime(&t);
|
return DateToStr(rtm.tm_year + 1900, rtm.tm_mon+1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
|
|
||||||
return DateToStr(ptm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char * DateToStrWithoutHours(tm * ptm)
|
const char * DateToStr(time_t t)
|
||||||
|
{
|
||||||
|
tm rtm = Time(t);
|
||||||
|
|
||||||
|
return DateToStr(rtm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char * DateToStrWithoutHours(const tm * ptm)
|
||||||
{
|
{
|
||||||
return DateToStr(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday);
|
return DateToStr(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char * DateToStrWithoutHours(const tm & rtm)
|
||||||
|
{
|
||||||
|
return DateToStr(rtm.tm_year + 1900, rtm.tm_mon+1, rtm.tm_mday);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char * DateToStrWithoutHours(time_t t)
|
const char * DateToStrWithoutHours(time_t t)
|
||||||
{
|
{
|
||||||
tm * ptm = std::localtime(&t);
|
tm rtm = Time(t);
|
||||||
|
|
||||||
return DateToStrWithoutHours(ptm);
|
return DateToStrWithoutHours(rtm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,17 +372,23 @@ return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char * DateToStrCookie(tm * ptm)
|
const char * DateToStrCookie(const tm * ptm)
|
||||||
{
|
{
|
||||||
return DateToStrCookie(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
return DateToStrCookie(ptm->tm_year + 1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char * DateToStrCookie(const tm & rtm)
|
||||||
|
{
|
||||||
|
return DateToStrCookie(rtm.tm_year + 1900, rtm.tm_mon+1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char * DateToStrCookie(time_t t)
|
const char * DateToStrCookie(time_t t)
|
||||||
{
|
{
|
||||||
tm * ptm = std::localtime(&t);
|
tm rtm = Time(t);
|
||||||
|
|
||||||
return DateToStrCookie(ptm);
|
return DateToStrCookie(rtm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -801,3 +819,47 @@ Item::Auth SelectFileType(const char * file_name)
|
||||||
return Item::auth_other;
|
return Item::auth_other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
time_t Time(const tm & par)
|
||||||
|
{
|
||||||
|
tm t;
|
||||||
|
|
||||||
|
memset(&t, 0, sizeof(t));
|
||||||
|
|
||||||
|
t.tm_year = par.tm_year;
|
||||||
|
t.tm_mon = par.tm_mon;
|
||||||
|
t.tm_mday = par.tm_mday;
|
||||||
|
t.tm_hour = par.tm_hour;
|
||||||
|
t.tm_min = par.tm_min;
|
||||||
|
t.tm_sec = par.tm_sec;
|
||||||
|
|
||||||
|
return timegm(&t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
time_t Time(const tm * par)
|
||||||
|
{
|
||||||
|
return Time(*par);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tm Time(time_t par)
|
||||||
|
{
|
||||||
|
tm * ptm = gmtime(&par);
|
||||||
|
tm res;
|
||||||
|
|
||||||
|
memset(&res, 0, sizeof(res));
|
||||||
|
|
||||||
|
if( ptm )
|
||||||
|
{
|
||||||
|
res.tm_year = ptm->tm_year;
|
||||||
|
res.tm_mon = ptm->tm_mon;
|
||||||
|
res.tm_mday = ptm->tm_mday;
|
||||||
|
res.tm_hour = ptm->tm_hour;
|
||||||
|
res.tm_min = ptm->tm_min;
|
||||||
|
res.tm_sec = ptm->tm_sec;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
15
core/misc.h
15
core/misc.h
|
@ -14,8 +14,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "item.h"
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include "item.h"
|
||||||
|
|
||||||
|
|
||||||
void ToString(std::string & s, int value);
|
void ToString(std::string & s, int value);
|
||||||
|
@ -34,13 +34,16 @@ std::string HtmlEscapeFormTxt(const std::string & in);
|
||||||
|
|
||||||
const char * DateToStr(int year, int month, int day);
|
const char * DateToStr(int year, int month, int day);
|
||||||
const char * DateToStr(int year, int month, int day, int hour, int min, int sec);
|
const char * DateToStr(int year, int month, int day, int hour, int min, int sec);
|
||||||
const char * DateToStr(tm * ptm);
|
const char * DateToStr(const tm * ptm);
|
||||||
|
const char * DateToStr(const tm & rtm);
|
||||||
const char * DateToStr(time_t t);
|
const char * DateToStr(time_t t);
|
||||||
const char * DateToStrWithoutHours(tm * ptm);
|
const char * DateToStrWithoutHours(const tm * ptm);
|
||||||
|
const char * DateToStrWithoutHours(const tm & rtm);
|
||||||
const char * DateToStrWithoutHours(time_t t);
|
const char * DateToStrWithoutHours(time_t t);
|
||||||
|
|
||||||
const char * DateToStrCookie(int year, int month, int day, int hour, int min, int sec);
|
const char * DateToStrCookie(int year, int month, int day, int hour, int min, int sec);
|
||||||
const char * DateToStrCookie(tm * ptm);
|
const char * DateToStrCookie(const tm * ptm);
|
||||||
|
const char * DateToStrCookie(const tm & rtm);
|
||||||
const char * DateToStrCookie(time_t t);
|
const char * DateToStrCookie(time_t t);
|
||||||
|
|
||||||
const char * IpToStr(unsigned int ip_);
|
const char * IpToStr(unsigned int ip_);
|
||||||
|
@ -76,4 +79,8 @@ bool CopyFile(const std::string & src, const std::string & dst);
|
||||||
const char * GetFileExt(const char * name);
|
const char * GetFileExt(const char * name);
|
||||||
Item::Auth SelectFileType(const char * file_name);
|
Item::Auth SelectFileType(const char * file_name);
|
||||||
|
|
||||||
|
time_t Time(const tm & par);
|
||||||
|
time_t Time(const tm * par);
|
||||||
|
tm Time(time_t par);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Session::Session()
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
time = std::time(0);
|
time = std::time(0);
|
||||||
tm_time = *std::localtime(&time);
|
tm_time = Time(time);
|
||||||
|
|
||||||
last_time = time;
|
last_time = time;
|
||||||
tm_last_time = tm_time;
|
tm_last_time = tm_time;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "sessioncontainer.h"
|
#include "sessioncontainer.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ void SessionContainer::UpdateLastTime(SessionContainer::Iterator iter, time_t ne
|
||||||
index_time.insert( std::make_pair(new_time, iter) );
|
index_time.insert( std::make_pair(new_time, iter) );
|
||||||
|
|
||||||
iter->last_time = new_time;
|
iter->last_time = new_time;
|
||||||
iter->tm_last_time = *std::localtime(&new_time);
|
iter->tm_last_time = Time(new_time);
|
||||||
|
|
||||||
log << log3 << "SC: last time and the time index for session id: " << iter->id << " updated" << logend;
|
log << log3 << "SC: last time and the time index for session id: " << iter->id << " updated" << logend;
|
||||||
found = true;
|
found = true;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "sessionparser.h"
|
#include "sessionparser.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,8 +99,8 @@ bool SessionParser::MakeSession(long user_id)
|
||||||
|
|
||||||
session.puser = puser;
|
session.puser = puser;
|
||||||
session.new_session = true;
|
session.new_session = true;
|
||||||
session.tm_time = *std::localtime(&session.time);
|
session.tm_time = Time(session.time);
|
||||||
session.tm_last_time = *std::localtime(&session.last_time);
|
session.tm_last_time = Time(session.last_time);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ void System::Init()
|
||||||
|
|
||||||
users.SetRequest(request);
|
users.SetRequest(request);
|
||||||
users.ReadUsers(db);
|
users.ReadUsers(db);
|
||||||
|
users.SetTimeZoneOffset(config->time_zone_offset);
|
||||||
groups.ReadGroups(db); // !! chwilowe przekazanie argumentu, db bedzie zmienione
|
groups.ReadGroups(db); // !! chwilowe przekazanie argumentu, db bedzie zmienione
|
||||||
|
|
||||||
rebus.SetRequest(request);
|
rebus.SetRequest(request);
|
||||||
|
@ -533,3 +534,35 @@ Error System::EditFile(Item & item, bool with_url, bool notify)
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
time_t System::LocalTime(time_t gmt_time)
|
||||||
|
{
|
||||||
|
int time_offset;
|
||||||
|
|
||||||
|
if( request->session && request->session->puser )
|
||||||
|
time_offset = request->session->puser->time_zone_offset;
|
||||||
|
else
|
||||||
|
time_offset = config->time_zone_offset_guest;
|
||||||
|
|
||||||
|
return gmt_time + (time_t)time_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tm System::LocalTime(const tm * ptm)
|
||||||
|
{
|
||||||
|
time_t t;
|
||||||
|
tm rtm;
|
||||||
|
|
||||||
|
t = Time(ptm);
|
||||||
|
t = LocalTime(t);
|
||||||
|
rtm = Time(t);
|
||||||
|
|
||||||
|
return rtm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tm System::LocalTime(const tm & ptm)
|
||||||
|
{
|
||||||
|
return LocalTime(&ptm);
|
||||||
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "groups.h"
|
#include "groups.h"
|
||||||
#include "rebus.h"
|
#include "rebus.h"
|
||||||
#include "loadavg.h"
|
#include "loadavg.h"
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,6 +86,13 @@ public:
|
||||||
Error AddFile(Item & item, bool notify = true);
|
Error AddFile(Item & item, bool notify = true);
|
||||||
Error EditFile(Item & item, bool with_url = true, bool notify = true);
|
Error EditFile(Item & item, bool with_url = true, bool notify = true);
|
||||||
|
|
||||||
|
// converting GMT time to local time (different for each user)
|
||||||
|
time_t LocalTime(time_t gmt_time);
|
||||||
|
tm LocalTime(const tm * ptm);
|
||||||
|
tm LocalTime(const tm & ptm);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Request * request;
|
Request * request;
|
||||||
Config * config;
|
Config * config;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
Item last_item;
|
Item last_item;
|
||||||
|
|
||||||
// used when sorting
|
// used when sorting
|
||||||
long sort;
|
unsigned long sort;
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,10 @@ struct User
|
||||||
int cms_notify;
|
int cms_notify;
|
||||||
int thread_notify;
|
int thread_notify;
|
||||||
|
|
||||||
|
// !! currently all users have the same offset
|
||||||
|
// option in config: time_zone_offset
|
||||||
|
int time_zone_offset;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
User()
|
User()
|
||||||
|
@ -42,6 +46,7 @@ struct User
|
||||||
email.clear();
|
email.clear();
|
||||||
cms_notify = 0;
|
cms_notify = 0;
|
||||||
thread_notify = 0;
|
thread_notify = 0;
|
||||||
|
time_zone_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,17 @@ void Users::ReadUsers(Db * db)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Users::SetTimeZoneOffset(int offset)
|
||||||
|
{
|
||||||
|
Table::Iterator i;
|
||||||
|
|
||||||
|
for(i=table.Begin() ; i!=table.End() ; ++i)
|
||||||
|
{
|
||||||
|
i->time_zone_offset = offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Users::AddUser(const User & user)
|
bool Users::AddUser(const User & user)
|
||||||
{
|
{
|
||||||
Table::Iterator i = table.PushBack(user);
|
Table::Iterator i = table.PushBack(user);
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
void ReadUsers(Db * db);
|
void ReadUsers(Db * db);
|
||||||
|
void SetTimeZoneOffset(int offset); // !! temporarily one time_zone for all users
|
||||||
bool AddUser(const User & user);
|
bool AddUser(const User & user);
|
||||||
bool IsUser(const std::string & name);
|
bool IsUser(const std::string & name);
|
||||||
User * GetUser(long user_id);
|
User * GetUser(long user_id);
|
||||||
|
|
|
@ -273,12 +273,12 @@ functions.o: ../templates/patterncacher.h ../core/item.h
|
||||||
functions.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
functions.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||||
functions.o: ../core/log.h ../templates/indexpatterns.h
|
functions.o: ../core/log.h ../templates/indexpatterns.h
|
||||||
functions.o: ../core/sessionmanager.h
|
functions.o: ../core/sessionmanager.h
|
||||||
funthread.o: funthread.h functionbase.h ../core/item.h ../db/db.h
|
funthread.o: ../core/misc.h ../core/item.h funthread.h functionbase.h
|
||||||
funthread.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
|
funthread.o: ../core/item.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
|
||||||
funthread.o: ../core/textstream.h ../core/error.h ../core/log.h
|
funthread.o: ../db/dbtextstream.h ../core/textstream.h ../core/error.h
|
||||||
funthread.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
funthread.o: ../core/log.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
||||||
funthread.o: ../core/group.h ../core/thread.h ../core/dircontainer.h
|
funthread.o: ../core/user.h ../core/group.h ../core/thread.h
|
||||||
funthread.o: ../core/item.h ../core/ugcontainer.h ../core/request.h
|
funthread.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/request.h
|
||||||
funthread.o: ../core/requesttypes.h ../core/session.h ../core/error.h
|
funthread.o: ../core/requesttypes.h ../core/session.h ../core/error.h
|
||||||
funthread.o: ../core/user.h ../core/plugindata.h ../core/rebus.h
|
funthread.o: ../core/user.h ../core/plugindata.h ../core/rebus.h
|
||||||
funthread.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
funthread.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "core/misc.h"
|
||||||
#include "funthread.h"
|
#include "funthread.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
namespace Fun
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -46,7 +46,9 @@ size_t i;
|
||||||
Item * pdir = system->dirs.GetDir(thread_tab[i].dir_id);
|
Item * pdir = system->dirs.GetDir(thread_tab[i].dir_id);
|
||||||
|
|
||||||
if( pdir )
|
if( pdir )
|
||||||
thread_tab[i].sort = (long)mktime(&pdir->date_creation);
|
thread_tab[i].sort = (unsigned long)Time(pdir->date_creation);
|
||||||
|
else
|
||||||
|
thread_tab[i].sort = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ funticket.o: ../../core/plugindata.h ../../core/config.h ../../core/notify.h
|
||||||
funticket.o: ../../templatesnotify/templatesnotify.h ../../../ezc/src/ezc.h
|
funticket.o: ../../templatesnotify/templatesnotify.h ../../../ezc/src/ezc.h
|
||||||
funticket.o: ../../core/mount.h ../../core/locale.h ../../templates/misc.h
|
funticket.o: ../../core/mount.h ../../core/locale.h ../../templates/misc.h
|
||||||
funticket.o: ../../templates/localefilter.h ../../core/locale.h
|
funticket.o: ../../templates/localefilter.h ../../core/locale.h
|
||||||
funticket.o: ../../core/system.h
|
funticket.o: ../../core/system.h ../../core/misc.h
|
||||||
init.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
init.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||||
init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/error.h
|
init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/error.h
|
||||||
init.o: ../../core/log.h funticket.h ticketinfo.h ticketparser.h ticketconf.h
|
init.o: ../../core/log.h funticket.h ticketinfo.h ticketparser.h ticketconf.h
|
||||||
|
|
|
@ -7,9 +7,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "funticket.h"
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "funticket.h"
|
||||||
|
#include "core/misc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,8 +102,8 @@ bool FunTicket::SortByDate::operator()(const Item * item1, const Item * item2)
|
||||||
tm tm1 = item1->date_creation;
|
tm tm1 = item1->date_creation;
|
||||||
tm tm2 = item2->date_creation;
|
tm tm2 = item2->date_creation;
|
||||||
|
|
||||||
time_t time1 = mktime(&tm1);
|
time_t time1 = Time(tm1);
|
||||||
time_t time2 = mktime(&tm2);
|
time_t time2 = Time(tm2);
|
||||||
|
|
||||||
return time1 < time2;
|
return time1 < time2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ std::vector<Ticket>::iterator i;
|
||||||
for(i=ticket_tab.begin() ; i!=ticket_tab.end() ; ++i)
|
for(i=ticket_tab.begin() ; i!=ticket_tab.end() ; ++i)
|
||||||
{
|
{
|
||||||
Item * dir = system->dirs.GetDir(i->dir_id);
|
Item * dir = system->dirs.GetDir(i->dir_id);
|
||||||
i->sort_id = ( dir ) ? (unsigned long)mktime(&dir->date_creation) : 0;
|
i->sort_id = ( dir ) ? (unsigned long)Time(dir->date_creation) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(ticket_tab.begin(), ticket_tab.end(), SortTicketsFun);
|
std::sort(ticket_tab.begin(), ticket_tab.end(), SortTicketsFun);
|
||||||
|
|
|
@ -433,4 +433,4 @@ winix.o: ../functions/run.h ../functions/stat.h ../functions/subject.h
|
||||||
winix.o: ../functions/funthread.h ../functions/template.h
|
winix.o: ../functions/funthread.h ../functions/template.h
|
||||||
winix.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
winix.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||||
winix.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h
|
winix.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h
|
||||||
winix.o: ../templates/templates.h
|
winix.o: ../templates/templates.h ../core/misc.h
|
||||||
|
|
|
@ -350,31 +350,27 @@ void dir_last_url_is(Info & i)
|
||||||
|
|
||||||
void dir_last_date_creation(Info & i)
|
void dir_last_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->dir_tab.back()->date_creation;
|
tm rtm = system->LocalTime(request->dir_tab.back()->date_creation);
|
||||||
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dir_last_date_modification(Info & i)
|
void dir_last_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->dir_tab.back()->date_modification;
|
tm rtm = system->LocalTime(request->dir_tab.back()->date_modification);
|
||||||
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dir_last_date_creation_nice(Info & i)
|
void dir_last_date_creation_nice(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->dir_tab.back()->date_creation;
|
print_date_nice(i, request->dir_tab.back()->date_creation);
|
||||||
print_date_nice(i, ptm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dir_last_date_modification_nice(Info & i)
|
void dir_last_date_modification_nice(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->dir_tab.back()->date_modification;
|
print_date_nice(i, request->dir_tab.back()->date_modification);
|
||||||
print_date_nice(i, ptm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -224,31 +224,27 @@ void item_users_different(Info & i)
|
||||||
|
|
||||||
void item_date_creation(Info & i)
|
void item_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->item.date_creation;
|
tm rtm = system->LocalTime(request->item.date_creation);
|
||||||
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void item_date_modification(Info & i)
|
void item_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->item.date_modification;
|
tm rtm = system->LocalTime(request->item.date_modification);
|
||||||
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void item_date_creation_nice(Info & i)
|
void item_date_creation_nice(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->item.date_creation;
|
print_date_nice(i, request->item.date_creation);
|
||||||
print_date_nice(i, ptm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void item_date_modification_nice(Info & i)
|
void item_date_modification_nice(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->item.date_modification;
|
print_date_nice(i, request->item.date_modification);
|
||||||
print_date_nice(i, ptm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -492,9 +488,8 @@ void item_tab_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
if( item_index < request->item_tab.size() )
|
if( item_index < request->item_tab.size() )
|
||||||
{
|
{
|
||||||
tm * ptm = &request->item_tab[item_index].date_creation;
|
tm rtm = system->LocalTime(request->item_tab[item_index].date_creation);
|
||||||
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,9 +498,8 @@ void item_tab_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
if( item_index < request->item_tab.size() )
|
if( item_index < request->item_tab.size() )
|
||||||
{
|
{
|
||||||
tm * ptm = &request->item_tab[item_index].date_modification;
|
tm rtm = system->LocalTime(request->item_tab[item_index].date_modification);
|
||||||
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,8 +508,7 @@ void item_tab_date_creation_nice(Info & i)
|
||||||
{
|
{
|
||||||
if( item_index < request->item_tab.size() )
|
if( item_index < request->item_tab.size() )
|
||||||
{
|
{
|
||||||
tm * ptm = &request->item_tab[item_index].date_creation;
|
print_date_nice(i, request->item_tab[item_index].date_creation);
|
||||||
print_date_nice(i, ptm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,8 +518,7 @@ void item_tab_date_modification_nice(Info & i)
|
||||||
{
|
{
|
||||||
if( item_index < request->item_tab.size() )
|
if( item_index < request->item_tab.size() )
|
||||||
{
|
{
|
||||||
tm * ptm = &request->item_tab[item_index].date_modification;
|
print_date_nice(i, request->item_tab[item_index].date_modification);
|
||||||
print_date_nice(i, ptm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,19 +18,18 @@ namespace TemplatesFunctions
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
void print_date_nice(Ezc::Info & i, const tm * ptm)
|
void print_date_nice(Ezc::Info & i, const tm & rtm)
|
||||||
{
|
{
|
||||||
tm tm_temp(*ptm);
|
time_t t = Time(rtm);
|
||||||
|
time_t now = std::time(0);
|
||||||
time_t t = mktime(&tm_temp); // mktime do something in tm_temp
|
|
||||||
time_t now = time(0);
|
|
||||||
time_t one_day = 60 * 60 * 24;
|
time_t one_day = 60 * 60 * 24;
|
||||||
|
|
||||||
|
tm ltm = system->LocalTime(rtm);
|
||||||
|
|
||||||
if( t + one_day > now )
|
if( t + one_day > now )
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
i.out << DateToStr(ltm.tm_year + 1900, ltm.tm_mon + 1, ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec);
|
||||||
else
|
else
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday);
|
i.out << DateToStr(ltm.tm_year + 1900, ltm.tm_mon + 1, ltm.tm_mday);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace TemplatesFunctions
|
||||||
// table: [language][file]
|
// table: [language][file]
|
||||||
typedef std::vector<std::vector<Ezc::Pattern> > Patterns;
|
typedef std::vector<std::vector<Ezc::Pattern> > Patterns;
|
||||||
|
|
||||||
void print_date_nice(Ezc::Info & i, const tm * ptm);
|
void print_date_nice(Ezc::Info & i, const tm & rtm);
|
||||||
void print_user_name(Ezc::Info & i, const User * puser, const std::string & guest_name);
|
void print_user_name(Ezc::Info & i, const User * puser, const std::string & guest_name);
|
||||||
|
|
||||||
int ParseCKeditorFun();
|
int ParseCKeditorFun();
|
||||||
|
|
|
@ -71,15 +71,15 @@ void stat_item_privileges(Info & i)
|
||||||
|
|
||||||
void stat_item_date_creation(Info & i)
|
void stat_item_date_creation(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->last_item->date_creation;
|
tm rtm = system->LocalTime(request->last_item->date_creation);
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void stat_item_date_modification(Info & i)
|
void stat_item_date_modification(Info & i)
|
||||||
{
|
{
|
||||||
tm * ptm = &request->last_item->date_modification;
|
tm rtm = system->LocalTime(request->last_item->date_modification);
|
||||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ void thread_tab_last_item_date_modification_nice(Info & i)
|
||||||
{
|
{
|
||||||
if( thread_tab_index < functions->fun_thread.thread_tab.size() )
|
if( thread_tab_index < functions->fun_thread.thread_tab.size() )
|
||||||
if( functions->fun_thread.thread_tab[thread_tab_index].last_item.id != -1 )
|
if( functions->fun_thread.thread_tab[thread_tab_index].last_item.id != -1 )
|
||||||
print_date_nice(i, &functions->fun_thread.thread_tab[thread_tab_index].last_item.date_modification);
|
print_date_nice(i, functions->fun_thread.thread_tab[thread_tab_index].last_item.date_modification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "core/request.h"
|
#include "core/request.h"
|
||||||
#include "core/plugin.h"
|
#include "core/plugin.h"
|
||||||
|
#include "core/misc.h"
|
||||||
#include "functions/functions.h"
|
#include "functions/functions.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,10 +25,9 @@ void winix_cur_time(Info & i)
|
||||||
{
|
{
|
||||||
static char buffer[100];
|
static char buffer[100];
|
||||||
|
|
||||||
time_t t = time(0);
|
tm rtm = Time(std::time(0));
|
||||||
tm * ptm = localtime(&t);
|
|
||||||
|
|
||||||
sprintf(buffer, "%02d:%02d:%02d", ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
sprintf(buffer, "%02d:%02d:%02d", rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
||||||
i.out << buffer;
|
i.out << buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue