/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2010, Tomasz Sowa * All rights reserved. * */ #include "../core/misc.h" #include "../core/request.h" #include "templates.h" #include "misc.h" namespace TemplatesFunctions { void print_date_nice(Ezc::Info & i, const tm * ptm) { tm tm_temp(*ptm); time_t t = mktime(&tm_temp); // mktime do something in tm_temp time_t now = time(0); time_t one_day = 60 * 60 * 24; 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); else i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday); } int ParseCKeditorFun() { ckeditor_getparser.fun_num = 2; // default if there is a problem with parsing info if( !request->get_tab.empty() ) { size_t last = request->get_tab.size()-1; if( !request->get_tab[last].empty() ) { const char * str = request->get_tab[last].c_str() + 1; // the first char is '?' ckeditor_getparser.Parse(str); } } return ckeditor_getparser.fun_num; } // those functions from here are used in the second thread too void Read(Patterns & patterns, size_t pat, Locale & locale, LocaleFilter & locale_filter, const char * file, bool delete_white) { size_t i; size_t len = patterns.size(); for(i=0 ; itemplates_dir, config->templates_dir_default); patterns[i][pat].ParseFile(file); locale_filter.Filter(patterns[i][pat], locale, static_cast(i)); } } } void ClearPatterns(Patterns & patterns, size_t len) { size_t loc, pat; patterns.resize(Locale::lang_unknown); for(loc=0 ; loc < static_cast(Locale::lang_unknown) ; ++loc) { patterns[loc].resize(len); for(pat=0 ; pat