2008-12-30 02:05:03 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2008-12-30 02:05:03 +01:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2010-02-28 22:33:06 +01:00
|
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
2008-12-30 02:05:03 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "templates.h"
|
2010-02-15 01:31:14 +01:00
|
|
|
#include "misc.h"
|
2010-11-21 01:19:17 +01:00
|
|
|
#include "core/request.h"
|
|
|
|
#include "core/misc.h"
|
|
|
|
#include "core/bbcodeparser.h"
|
|
|
|
#include "core/textstream.h"
|
2009-04-21 22:50:55 +02:00
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
namespace TemplatesFunctions
|
|
|
|
{
|
2010-06-30 20:42:50 +02:00
|
|
|
static BBCODEParser bbcode_parser;
|
2011-01-20 19:37:51 +01:00
|
|
|
static HtmlTextStream item_run_content;
|
|
|
|
static EzcGen ezc_generator;
|
2010-06-30 20:42:50 +02:00
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void item_is(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->is_item;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void item_id(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->item.id;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void item_subject(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->item.subject;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_subject_noescape(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << R(cur->request->item.subject);
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void item_content(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->item.content;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void item_content_noescape(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << R(cur->request->item.content);
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-10 22:43:38 +02:00
|
|
|
void item_content_type_is(Item & item, Info & i)
|
2009-06-05 22:29:06 +02:00
|
|
|
{
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = false;
|
2010-01-25 05:52:17 +01:00
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
if( item.content_type == Item::ct_text && i.par == L"text" )
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = true;
|
2010-08-10 22:43:38 +02:00
|
|
|
else
|
2010-11-21 01:19:17 +01:00
|
|
|
if( item.content_type == Item::ct_formatted_text && i.par == L"formatted text" )
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = true;
|
2010-08-10 22:43:38 +02:00
|
|
|
else
|
2010-11-21 01:19:17 +01:00
|
|
|
if( item.content_type == Item::ct_html && i.par == L"html" )
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = true;
|
2010-08-10 22:43:38 +02:00
|
|
|
else
|
2010-11-21 01:19:17 +01:00
|
|
|
if( item.content_type == Item::ct_bbcode && i.par == L"bbcode" )
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = true;
|
2010-08-10 22:43:38 +02:00
|
|
|
else
|
2010-11-21 01:19:17 +01:00
|
|
|
if( item.content_type == Item::ct_raw && i.par == L"raw" )
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = true;
|
2010-01-11 15:47:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-10 22:43:38 +02:00
|
|
|
void item_content_type_is(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
item_content_type_is(cur->request->item, i);
|
2010-08-10 22:43:38 +02:00
|
|
|
}
|
|
|
|
|
2010-01-11 15:47:52 +01:00
|
|
|
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
void item_print_content(HtmlTextStream & out, const std::wstring & content, Item::ContentType content_type)
|
2010-01-11 15:47:52 +01:00
|
|
|
{
|
|
|
|
if( content_type == Item::ct_text )
|
|
|
|
{
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
out << content;
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
else
|
2010-01-11 15:47:52 +01:00
|
|
|
if( content_type == Item::ct_formatted_text )
|
2009-06-05 22:29:06 +02:00
|
|
|
{
|
2010-01-11 15:47:52 +01:00
|
|
|
HtmlEscapeFormTxt(out, content);
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
else
|
2010-06-30 20:42:50 +02:00
|
|
|
if( content_type == Item::ct_html || content_type == Item::ct_raw )
|
2009-06-05 22:29:06 +02:00
|
|
|
{
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
out << R(content);
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
else
|
2010-01-11 15:47:52 +01:00
|
|
|
if( content_type == Item::ct_bbcode )
|
2009-06-05 22:29:06 +02:00
|
|
|
{
|
2010-11-21 01:19:17 +01:00
|
|
|
static std::wstring out_temp;
|
2010-06-30 20:42:50 +02:00
|
|
|
out_temp.clear();
|
|
|
|
out_temp.reserve(content.size()*2);
|
|
|
|
|
|
|
|
bbcode_parser.Filter(content.c_str(), out_temp);
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
out << R(out_temp);
|
2010-01-11 15:47:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-13 00:16:13 +01:00
|
|
|
void item_content_is_empty(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.content.empty();
|
2010-02-13 00:16:13 +01:00
|
|
|
}
|
|
|
|
|
2010-01-11 15:47:52 +01:00
|
|
|
void item_print_content(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
item_print_content(i.out, cur->request->item.content, cur->request->item.content_type);
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-11 15:47:52 +01:00
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
void item_privileges(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << Toa(cur->request->item.privileges, 8);
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_dir(Info & i)
|
|
|
|
{
|
|
|
|
dir(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_url(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->item.url;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-08 21:02:16 +01:00
|
|
|
void item_url_is(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( !cur->request->is_item )
|
2010-02-15 01:31:14 +01:00
|
|
|
return; // default false
|
2010-02-08 21:02:16 +01:00
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = (cur->request->item.url == i.par);
|
2010-02-08 21:02:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
void item_link(Info & i)
|
|
|
|
{
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
i.out << config->base_url;
|
2008-12-30 02:05:03 +01:00
|
|
|
item_dir(i);
|
|
|
|
item_url(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-30 21:46:12 +01:00
|
|
|
|
|
|
|
|
2010-12-10 22:07:01 +01:00
|
|
|
void item_filetype_is_none(Info & i)
|
2009-12-30 21:46:12 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.file_type == WINIX_ITEM_FILETYPE_NONE;
|
2009-12-30 21:46:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-10 22:07:01 +01:00
|
|
|
void item_filetype_is_image(Info & i)
|
2009-12-30 21:46:12 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.file_type == WINIX_ITEM_FILETYPE_IMAGE;
|
2009-12-30 21:46:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
void item_has_static_file(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.file_type != WINIX_ITEM_FILETYPE_NONE && !cur->request->item.file_path.empty();
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-11 23:55:48 +01:00
|
|
|
void item_has_thumb(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.has_thumb;
|
2010-12-11 23:55:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-23 00:54:15 +01:00
|
|
|
void item_can_read(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = system->HasReadAccess(cur->request->item);
|
2009-03-23 00:54:15 +01:00
|
|
|
}
|
|
|
|
|
2010-02-11 21:56:52 +01:00
|
|
|
|
2009-06-05 22:29:06 +02:00
|
|
|
void item_can_write(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = system->HasWriteAccess(cur->request->item);
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
2009-03-23 00:54:15 +01:00
|
|
|
|
2010-02-11 21:56:52 +01:00
|
|
|
|
|
|
|
void item_can_remove(Info & i)
|
|
|
|
{
|
2010-08-10 18:12:50 +02:00
|
|
|
// !! tutaj trzeba bedzie cos innego zrobic
|
|
|
|
// zwlaszcza jak dojdzie sticky bit
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = system->HasWriteAccess(*cur->request->dir_tab.back());
|
2010-02-11 21:56:52 +01:00
|
|
|
}
|
|
|
|
|
2009-03-23 00:54:15 +01:00
|
|
|
|
|
|
|
void item_user(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
User * puser = system->users.GetUser(cur->request->item.user_id);
|
|
|
|
print_user_name(i, puser, cur->request->item.guest_name);
|
2010-06-22 23:09:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void item_modification_user(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
User * puser = system->users.GetUser(cur->request->item.modification_user_id);
|
|
|
|
print_user_name(i, puser, cur->request->item.guest_name);
|
2010-06-22 23:09:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_users_different(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = (cur->request->item.user_id != cur->request->item.modification_user_id);
|
2009-03-23 00:54:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_date_creation(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
tm rtm = system->LocalTime(cur->request->item.date_creation);
|
2010-10-24 01:12:47 +02:00
|
|
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
2009-03-23 00:54:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_date_modification(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
tm rtm = system->LocalTime(cur->request->item.date_modification);
|
2010-10-24 01:12:47 +02:00
|
|
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
2009-03-23 00:54:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-15 01:31:14 +01:00
|
|
|
void item_date_creation_nice(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
print_date_nice(i, cur->request->item.date_creation);
|
2010-02-15 01:31:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_date_modification_nice(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
print_date_nice(i, cur->request->item.date_modification);
|
2010-02-15 01:31:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-23 00:54:15 +01:00
|
|
|
void item_dates_equal(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
tm * ptm1 = &cur->request->item.date_creation;
|
|
|
|
tm * ptm2 = &cur->request->item.date_modification;
|
2009-03-23 00:54:15 +01:00
|
|
|
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = ptm1->tm_year == ptm2->tm_year &&
|
2009-03-23 00:54:15 +01:00
|
|
|
ptm1->tm_mon == ptm2->tm_mon &&
|
|
|
|
ptm1->tm_mday == ptm2->tm_mday &&
|
|
|
|
ptm1->tm_hour == ptm2->tm_hour &&
|
|
|
|
ptm1->tm_min == ptm2->tm_min &&
|
|
|
|
ptm1->tm_sec == ptm2->tm_sec;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-11 15:47:52 +01:00
|
|
|
|
2009-03-23 00:54:15 +01:00
|
|
|
void item_run(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( !cur->request->is_item )
|
2009-03-23 00:54:15 +01:00
|
|
|
{
|
|
|
|
i.out << "<!-- there is no an item to run -->";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
if( system->HasReadExecAccess(cur->request->item) )
|
2009-03-23 00:54:15 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
Ezc::Pattern * p = pattern_cacher.GetPattern(cur->request->item);
|
2010-01-11 15:47:52 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
item_run_content.Clear();
|
|
|
|
ezc_generator.Generate(item_run_content, *p);
|
2010-01-11 15:47:52 +01:00
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
item_print_content(i.out, item_run_content.Str(), cur->request->item.content_type);
|
2011-01-20 19:37:51 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
i.out << "<!-- run: permission denied -->";
|
|
|
|
}
|
2009-03-23 00:54:15 +01:00
|
|
|
}
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
|
2009-11-17 00:36:38 +01:00
|
|
|
void item_guest_name(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->item.guest_name;
|
2009-11-17 00:36:38 +01:00
|
|
|
}
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
|
2010-08-13 22:04:57 +02:00
|
|
|
void item_html_template(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->item.html_template;
|
2010-08-13 22:04:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_has_html_template(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = !cur->request->item.html_template.empty();
|
2010-08-13 22:04:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
void item_type_is_dir(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.type == Item::dir;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_type_is_file(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.type == Item::file;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_type_is_symlink(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.type == Item::symlink;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_is_link_to(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = !cur->request->item.link_to.empty();
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_link_to(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->item.link_to;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_is_link_redirect(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item.link_redirect == 1;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static size_t item_index;
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab(Info & i)
|
|
|
|
{
|
|
|
|
item_index = i.iter;
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = item_index < cur->request->item_tab.size();
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_id(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.out << cur->request->item_tab[item_index].id;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_subject(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.out << cur->request->item_tab[item_index].subject;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void item_tab_subject_noescape(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.out << R(cur->request->item_tab[item_index].subject);
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_content(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.out << cur->request->item_tab[item_index].content;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_content_noescape(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.out << R(cur->request->item_tab[item_index].content);
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-05 22:29:06 +02:00
|
|
|
void item_tab_print_content(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index >= cur->request->item_tab.size() )
|
2009-06-05 22:29:06 +02:00
|
|
|
return;
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
std::wstring & content = cur->request->item_tab[item_index].content;
|
|
|
|
Item::ContentType type = cur->request->item_tab[item_index].content_type;
|
2009-06-05 22:29:06 +02:00
|
|
|
|
2010-01-11 15:47:52 +01:00
|
|
|
item_print_content(i.out, content, type);
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
void item_tab_privileges(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.out << "0" << Toa(cur->request->item_tab[item_index].privileges, 8);
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_dir(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2008-12-30 02:05:03 +01:00
|
|
|
{
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring path;
|
2008-12-30 02:05:03 +01:00
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
if( system->dirs.MakePath(cur->request->item_tab[item_index].parent_id, path) )
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
i.out << path;
|
2008-12-30 02:05:03 +01:00
|
|
|
else
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
i.out << "/the path does not exist/"; // !! do konfiga
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_url(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.out << cur->request->item_tab[item_index].url;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_link(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2008-12-30 02:05:03 +01:00
|
|
|
{
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
i.out << config->base_url;
|
2008-12-30 02:05:03 +01:00
|
|
|
item_tab_dir(i);
|
|
|
|
item_tab_url(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-11 21:56:52 +01:00
|
|
|
|
|
|
|
|
2009-04-21 01:49:28 +02:00
|
|
|
void item_tab_can_read(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2009-04-21 01:49:28 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( system->HasReadAccess(cur->request->item_tab[item_index]) )
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = true;
|
2009-04-21 01:49:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-30 21:56:32 +02:00
|
|
|
|
|
|
|
void item_tab_can_write(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2010-06-30 21:56:32 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( system->HasWriteAccess(cur->request->item_tab[item_index]) )
|
2010-06-30 21:56:32 +02:00
|
|
|
i.res = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-21 01:49:28 +02:00
|
|
|
|
|
|
|
void item_tab_user(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2009-04-21 01:49:28 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
User * puser = system->users.GetUser(cur->request->item_tab[item_index].user_id);
|
|
|
|
print_user_name(i, puser, cur->request->item_tab[item_index].guest_name);
|
2009-04-21 01:49:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-22 23:09:37 +02:00
|
|
|
|
|
|
|
void item_tab_modification_user(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2010-06-22 23:09:37 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
User * puser = system->users.GetUser(cur->request->item_tab[item_index].modification_user_id);
|
|
|
|
print_user_name(i, puser, cur->request->item_tab[item_index].guest_name);
|
2010-06-22 23:09:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_users_different(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2010-06-22 23:09:37 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = (cur->request->item_tab[item_index].user_id != cur->request->item_tab[item_index].modification_user_id);
|
2010-06-22 23:09:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-22 23:52:09 +01:00
|
|
|
void item_tab_group(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2010-02-22 23:52:09 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
long group_id = cur->request->item_tab[item_index].group_id;
|
2010-08-10 18:12:50 +02:00
|
|
|
Group * pgroup = system->groups.GetGroup(group_id);
|
2010-02-22 23:52:09 +01:00
|
|
|
|
|
|
|
if( pgroup )
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
i.out << pgroup->name;
|
2010-02-22 23:52:09 +01:00
|
|
|
else
|
|
|
|
i.out << group_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-21 01:49:28 +02:00
|
|
|
void item_tab_date_creation(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2009-04-21 01:49:28 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
tm rtm = system->LocalTime(cur->request->item_tab[item_index].date_creation);
|
2010-10-24 01:12:47 +02:00
|
|
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
2009-04-21 01:49:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_date_modification(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2009-04-21 01:49:28 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
tm rtm = system->LocalTime(cur->request->item_tab[item_index].date_modification);
|
2010-10-24 01:12:47 +02:00
|
|
|
i.out << DateToStr(rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, rtm.tm_hour, rtm.tm_min, rtm.tm_sec);
|
2009-04-21 01:49:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-15 01:31:14 +01:00
|
|
|
void item_tab_date_creation_nice(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2010-02-15 01:31:14 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
print_date_nice(i, cur->request->item_tab[item_index].date_creation);
|
2010-02-15 01:31:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-22 23:09:37 +02:00
|
|
|
|
2010-02-15 01:31:14 +01:00
|
|
|
void item_tab_date_modification_nice(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2010-02-15 01:31:14 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
print_date_nice(i, cur->request->item_tab[item_index].date_modification);
|
2010-02-15 01:31:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-21 01:49:28 +02:00
|
|
|
void item_tab_dates_equal(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2009-04-21 01:49:28 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
tm * ptm1 = &cur->request->item_tab[item_index].date_creation;
|
|
|
|
tm * ptm2 = &cur->request->item_tab[item_index].date_modification;
|
2009-04-21 01:49:28 +02:00
|
|
|
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = ptm1->tm_year == ptm2->tm_year &&
|
2010-06-22 15:01:56 +02:00
|
|
|
ptm1->tm_mon == ptm2->tm_mon &&
|
|
|
|
ptm1->tm_mday == ptm2->tm_mday &&
|
|
|
|
ptm1->tm_hour == ptm2->tm_hour &&
|
|
|
|
ptm1->tm_min == ptm2->tm_min &&
|
|
|
|
ptm1->tm_sec == ptm2->tm_sec;
|
2009-04-21 01:49:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_run(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2009-04-21 01:49:28 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( system->HasReadExecAccess(cur->request->item_tab[item_index]) )
|
2011-01-20 19:37:51 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
Ezc::Pattern * p = pattern_cacher.GetPattern(cur->request->item_tab[item_index]);
|
2011-01-20 19:37:51 +01:00
|
|
|
item_run_content.Clear();
|
|
|
|
ezc_generator.Generate(item_run_content, *p);
|
2011-01-23 15:15:30 +01:00
|
|
|
item_print_content(i.out, item_run_content.Str(), cur->request->item_tab[item_index].content_type);
|
2011-01-20 19:37:51 +01:00
|
|
|
}
|
|
|
|
else
|
2009-04-21 01:49:28 +02:00
|
|
|
{
|
|
|
|
i.out << "<!-- run: permission denied -->";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-30 21:56:32 +02:00
|
|
|
void item_tab_can_use_emacs(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2010-06-30 21:56:32 +02:00
|
|
|
{
|
2010-08-10 18:12:50 +02:00
|
|
|
// !!
|
2011-01-23 15:15:30 +01:00
|
|
|
//i.res = cur->request->CanUseEmacs(cur->request->item_tab[item_index], true);
|
2010-06-30 21:56:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
void item_tab_has_static_file(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
2011-01-05 22:24:11 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->item_tab[item_index].file_type != WINIX_ITEM_FILETYPE_NONE &&
|
|
|
|
!cur->request->item_tab[item_index].file_path.empty();
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-21 01:49:28 +02:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
void item_tab_has_thumb(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.res = cur->request->item_tab[item_index].has_thumb;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_type_is_dir(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.res = cur->request->item_tab[item_index].type == Item::dir;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_type_is_file(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.res = cur->request->item_tab[item_index].type == Item::file;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_type_is_symlink(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.res = cur->request->item_tab[item_index].type == Item::symlink;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_is_link_to(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.res = !cur->request->item_tab[item_index].link_to.empty();
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_link_to(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.out << cur->request->item_tab[item_index].link_to;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void item_tab_is_link_redirect(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( item_index < cur->request->item_tab.size() )
|
|
|
|
i.res = cur->request->item_tab[item_index].link_redirect == 1;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
2009-04-21 01:49:28 +02:00
|
|
|
|
2009-01-14 21:11:12 +01:00
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
} // namespace TemplatesFunctions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|