2008-12-30 02:05:03 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2014-10-04 20:04:03 +02:00
|
|
|
* and is distributed under the 2-Clause BSD licence.
|
|
|
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2021-02-24 01:19:47 +01:00
|
|
|
* Copyright (c) 2008-2021, Tomasz Sowa
|
2008-12-30 02:05:03 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2014-10-04 20:04:03 +02:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2008-12-30 02:05:03 +01:00
|
|
|
*/
|
2014-02-12 17:30:49 +01:00
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
#include "templates.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "core/misc.h"
|
|
|
|
#include "functions/functions.h"
|
2008-12-30 02:05:03 +01:00
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
namespace Winix
|
|
|
|
{
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
namespace TemplatesFunctions
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void dir(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
for(size_t a=0 ; a<cur->request->dir_tab.size() ; ++a)
|
|
|
|
i.out << cur->request->dir_tab[a]->url << '/';
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-16 01:37:00 +01:00
|
|
|
void dir_without_slash(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
for(size_t a=0 ; a<cur->request->dir_tab.size() ; ++a)
|
2010-02-16 01:37:00 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->dir_tab[a]->url;
|
2010-02-16 01:37:00 +01:00
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
if( a < cur->request->dir_tab.size()-1 )
|
2010-02-16 01:37:00 +01:00
|
|
|
i.out << '/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
void dir_is_root(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->dir_tab.size() == 1;
|
2011-01-05 22:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-05 21:44:49 +02:00
|
|
|
void dir_parent(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( cur->request->dir_tab.empty() )
|
2010-06-05 21:44:49 +02:00
|
|
|
return;
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
for(size_t a=0 ; a<cur->request->dir_tab.size()-1 ; ++a)
|
2010-06-05 21:44:49 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->dir_tab[a]->url << '/';
|
2010-06-05 21:44:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_parent_without_slash(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( cur->request->dir_tab.empty() )
|
2010-06-05 21:44:49 +02:00
|
|
|
return;
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
for(size_t a=0 ; a<cur->request->dir_tab.size()-1 ; ++a)
|
2010-06-05 21:44:49 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->dir_tab[a]->url;
|
2010-06-05 21:44:49 +02:00
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
if( cur->request->dir_tab.size()>=2 && a<cur->request->dir_tab.size()-2 )
|
2010-06-05 21:44:49 +02:00
|
|
|
i.out << '/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-05 22:29:06 +02:00
|
|
|
//!! moze wystarczy sprawdzac tylko ostatni katalog?
|
|
|
|
// bo inaczej i tak bylo by 'access denied'
|
2009-01-14 21:11:12 +01:00
|
|
|
void dir_can_read_exec(Info & i)
|
|
|
|
{
|
2011-08-18 01:09:47 +02:00
|
|
|
i.res = system->HasReadExecAccessToPath(cur->request->dir_tab);
|
2009-01-14 21:11:12 +01:00
|
|
|
}
|
|
|
|
|
2011-11-25 05:51:55 +01:00
|
|
|
// !! zamienic na dir_last_can_write ?
|
2009-06-05 22:29:06 +02:00
|
|
|
void dir_can_write(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = system->HasWriteAccess(*cur->request->dir_tab.back());
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_can_remove(Info & i)
|
|
|
|
{
|
|
|
|
bool result = true;
|
|
|
|
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
if( cur->request->dir_tab.size() == 1 )
|
2009-06-05 22:29:06 +02:00
|
|
|
{
|
|
|
|
// rm for the root dir
|
|
|
|
// only the superuser can do it
|
2021-06-27 23:31:50 +02:00
|
|
|
if( !cur->session->puser || !cur->session->puser->is_super_user )
|
2009-06-05 22:29:06 +02:00
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
Item * last_but_one_dir = *(--(--cur->request->dir_tab.end()));
|
2009-06-05 22:29:06 +02:00
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
if( !system->HasWriteAccess(*last_but_one_dir) )
|
2009-06-05 22:29:06 +02:00
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = result;
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_can_use_emacs(Info & i)
|
|
|
|
{
|
2010-08-10 18:12:50 +02:00
|
|
|
i.res = functions->fun_emacs.HasAccess();
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_can_use_mkdir(Info & i)
|
|
|
|
{
|
2010-08-10 18:12:50 +02:00
|
|
|
i.res = functions->fun_mkdir.HasAccess();
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
2009-01-14 21:11:12 +01:00
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
|
2011-08-27 05:12:33 +02:00
|
|
|
static std::wstring dir_parents_str;
|
|
|
|
|
|
|
|
|
2012-08-27 00:30:25 +02:00
|
|
|
|
|
|
|
bool dir_is(const std::wstring & par)
|
2011-11-25 05:51:55 +01:00
|
|
|
{
|
|
|
|
dir_parents_str.clear();
|
|
|
|
|
|
|
|
for(size_t a=0 ; a<cur->request->dir_tab.size() ; ++a)
|
|
|
|
{
|
|
|
|
dir_parents_str += cur->request->dir_tab[a]->url;
|
|
|
|
dir_parents_str += '/';
|
|
|
|
}
|
|
|
|
|
2012-08-27 00:30:25 +02:00
|
|
|
if( !par.empty() && par[par.size()-1] != '/' )
|
2011-11-25 05:51:55 +01:00
|
|
|
if( !dir_parents_str.empty() )
|
|
|
|
dir_parents_str.erase(dir_parents_str.size()-1);
|
|
|
|
|
2012-08-27 00:30:25 +02:00
|
|
|
return par == dir_parents_str;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_is(Info & i)
|
|
|
|
{
|
|
|
|
i.res = dir_is(i.par);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_is_no(Info & i)
|
|
|
|
{
|
|
|
|
i.res = !dir_is(i.par);
|
2011-11-25 05:51:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-27 05:12:33 +02:00
|
|
|
void dir_has_parents(Info & i)
|
|
|
|
{
|
|
|
|
dir_parents_str.clear();
|
|
|
|
|
|
|
|
for(size_t a=0 ; a<cur->request->dir_tab.size() ; ++a)
|
|
|
|
{
|
|
|
|
dir_parents_str += cur->request->dir_tab[a]->url;
|
|
|
|
dir_parents_str += '/';
|
|
|
|
}
|
|
|
|
|
2021-05-20 20:59:12 +02:00
|
|
|
i.res = pt::is_substr(i.par, dir_parents_str);
|
2011-08-27 05:12:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-27 00:30:25 +02:00
|
|
|
void dir_level_is(Info & i)
|
|
|
|
{
|
|
|
|
i.res = (cur->request->dir_tab.size() == size_t(Toi(i.par)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-27 05:12:33 +02:00
|
|
|
|
2021-06-17 21:44:29 +02:00
|
|
|
/*
|
2008-12-30 02:05:03 +01:00
|
|
|
static std::vector<Item*> dir_childs_table;
|
|
|
|
static size_t dir_childs_index;
|
2011-01-23 15:15:30 +01:00
|
|
|
// cur->request->id is never 0 and we can start dir_childs_reqid from 0
|
2008-12-30 02:05:03 +01:00
|
|
|
static size_t dir_childs_reqid = 0;
|
|
|
|
|
2010-06-05 21:44:49 +02:00
|
|
|
// is the first directory the parent ('..')
|
|
|
|
static bool dir_childs_has_parent;
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
void dir_childs_tab(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( dir_childs_reqid != cur->request->id )
|
2008-12-30 02:05:03 +01:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
dir_childs_reqid = cur->request->id;
|
2008-12-30 02:05:03 +01:00
|
|
|
dir_childs_table.clear();
|
2010-06-05 21:44:49 +02:00
|
|
|
dir_childs_has_parent = false;
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
if( !cur->request->dir_tab.empty() )
|
2010-06-05 21:44:49 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( cur->request->dir_tab.size() >= 2 && i.par == L"with_parent")
|
2010-06-05 21:44:49 +02:00
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
Item * dir_up = cur->request->dir_tab[cur->request->dir_tab.size()-2];
|
2010-06-05 21:44:49 +02:00
|
|
|
dir_childs_table.push_back(dir_up);
|
|
|
|
dir_childs_has_parent = true;
|
|
|
|
}
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
system->dirs.GetDirChilds(cur->request->dir_tab.back()->id, dir_childs_table);
|
2010-06-05 21:44:49 +02:00
|
|
|
}
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dir_childs_index = i.iter;
|
2010-05-30 23:07:46 +02:00
|
|
|
i.res = dir_childs_index < dir_childs_table.size();
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-05 21:44:49 +02:00
|
|
|
// is this child a parent ('..')
|
|
|
|
void dir_childs_is_parent(Info & i)
|
|
|
|
{
|
|
|
|
i.res = (dir_childs_has_parent && dir_childs_index == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
void dir_childs_tab_url(Info & i)
|
|
|
|
{
|
|
|
|
if( dir_childs_index < dir_childs_table.size() )
|
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 << dir_childs_table[dir_childs_index]->url;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-22 23:52:09 +01:00
|
|
|
void dir_childs_tab_privileges(Info & i)
|
|
|
|
{
|
|
|
|
if( dir_childs_index < dir_childs_table.size() )
|
2021-02-24 01:19:47 +01:00
|
|
|
i.out << "0" << Toa(dir_childs_table[dir_childs_index]->item_content.privileges, 8);
|
2010-02-22 23:52:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_childs_tab_user(Info & i)
|
|
|
|
{
|
|
|
|
if( dir_childs_index < dir_childs_table.size() )
|
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
long user_id = dir_childs_table[dir_childs_index]->item_content.user_id;
|
2010-08-10 18:12:50 +02:00
|
|
|
User * puser = system->users.GetUser(user_id);
|
2010-02-22 23:52:09 +01:00
|
|
|
|
|
|
|
if( puser )
|
2021-06-27 23:31:50 +02:00
|
|
|
i.out << puser->login;
|
2010-02-22 23:52:09 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
i.out << "~";
|
|
|
|
|
2021-02-24 01:19:47 +01:00
|
|
|
if( !dir_childs_table[dir_childs_index]->item_content.guest_name.empty() )
|
|
|
|
i.out << dir_childs_table[dir_childs_index]->item_content.guest_name;
|
2010-02-22 23:52:09 +01:00
|
|
|
else
|
|
|
|
i.out << "guest"; // !! dodac do konfiga
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void dir_childs_tab_group(Info & i)
|
|
|
|
{
|
|
|
|
if( dir_childs_index < dir_childs_table.size() )
|
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
long group_id = dir_childs_table[dir_childs_index]->item_content.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 )
|
2021-06-27 23:31:50 +02:00
|
|
|
i.out << pgroup->login;
|
2010-02-22 23:52:09 +01:00
|
|
|
else
|
|
|
|
i.out << group_id;
|
|
|
|
}
|
|
|
|
}
|
2021-06-17 21:44:29 +02:00
|
|
|
*/
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-17 21:44:29 +02:00
|
|
|
/*
|
2008-12-30 02:05:03 +01:00
|
|
|
static size_t dir_index;
|
|
|
|
|
|
|
|
|
|
|
|
void dir_tab(Info & i)
|
|
|
|
{
|
|
|
|
dir_index = i.iter;
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = dir_index < cur->request->dir_tab.size();
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_tab_url(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( dir_index < cur->request->dir_tab.size() )
|
|
|
|
i.out << cur->request->dir_tab[dir_index]->url;
|
2008-12-30 02:05:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_tab_link(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
for(size_t a = 0 ; a <= dir_index && a < cur->request->dir_tab.size() ; ++a)
|
2008-12-30 02:05:03 +01:00
|
|
|
{
|
2012-09-02 03:27:41 +02:00
|
|
|
// index zero is a root directory
|
|
|
|
if( a != 0 )
|
|
|
|
i.out << cur->request->dir_tab[a]->url;
|
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
i.out << '/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-02 03:27:41 +02:00
|
|
|
void dir_tab_is_root(Info & i)
|
|
|
|
{
|
|
|
|
i.res = (dir_index == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_tab_subject(Info & i)
|
|
|
|
{
|
|
|
|
if( dir_index < cur->request->dir_tab.size() )
|
|
|
|
i.out << cur->request->dir_tab[dir_index]->subject;
|
|
|
|
}
|
2021-06-17 21:44:29 +02:00
|
|
|
*/
|
2012-09-02 03:27:41 +02:00
|
|
|
|
2008-12-31 19:28:12 +01:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
void dir_last_link_to(Info & i)
|
2008-12-31 19:28:12 +01:00
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
i.out << cur->request->dir_tab.back()->item_content.link_to;
|
2008-12-31 19:28:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
void dir_last_is_link_redirect(Info & i)
|
2008-12-31 19:28:12 +01:00
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
i.res = cur->request->dir_tab.back()->item_content.link_redirect == 1;
|
2008-12-31 19:28:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-05 22:29:06 +02:00
|
|
|
void dir_last_subject(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->dir_tab.back()->subject;
|
2009-06-05 22:29:06 +02:00
|
|
|
}
|
|
|
|
|
2009-06-07 04:40:27 +02:00
|
|
|
|
|
|
|
void dir_last_user(Info & i)
|
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
User * puser = system->users.GetUser(cur->request->dir_tab.back()->item_content.user_id);
|
2009-06-07 04:40:27 +02:00
|
|
|
|
|
|
|
if( puser )
|
2021-06-27 23:31:50 +02:00
|
|
|
i.out << puser->login;
|
2009-06-07 04:40:27 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
i.out << "~";
|
|
|
|
|
2021-02-24 01:19:47 +01:00
|
|
|
if( !cur->request->dir_tab.back()->item_content.guest_name.empty() )
|
|
|
|
i.out << cur->request->dir_tab.back()->item_content.guest_name;
|
2009-06-07 04:40:27 +02:00
|
|
|
else
|
|
|
|
i.out << "guest"; // !! dodac do konfiga
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-08 21:02:16 +01:00
|
|
|
void dir_last_url(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->dir_tab.back()->url;
|
2010-08-02 20:36:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_last_url_is(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = cur->request->dir_tab.back()->url == i.par;
|
2010-02-08 21:02:16 +01:00
|
|
|
}
|
|
|
|
|
2012-08-27 00:30:25 +02:00
|
|
|
void dir_last_url_is_no(Info & i)
|
|
|
|
{
|
|
|
|
i.res = cur->request->dir_tab.back()->url != i.par;
|
|
|
|
}
|
|
|
|
|
2010-02-08 21:02:16 +01:00
|
|
|
|
2009-06-07 04:40:27 +02:00
|
|
|
void dir_last_date_creation(Info & i)
|
|
|
|
{
|
2021-05-20 20:59:12 +02:00
|
|
|
pt::Date date = system->ToLocal(cur->request->dir_tab.back()->item_content.date_creation);
|
2012-05-27 01:04:49 +02:00
|
|
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
2009-06-07 04:40:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_last_date_modification(Info & i)
|
|
|
|
{
|
2021-05-20 20:59:12 +02:00
|
|
|
pt::Date date = system->ToLocal(cur->request->dir_tab.back()->item_content.date_modification);
|
2012-05-27 01:04:49 +02:00
|
|
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
2009-06-07 04:40:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-19 02:31:20 +02:00
|
|
|
void dir_last_date_creation_nice(Info & i)
|
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
print_date_nice(i, cur->request->dir_tab.back()->item_content.date_creation);
|
2010-10-19 02:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_last_date_modification_nice(Info & i)
|
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
print_date_nice(i, cur->request->dir_tab.back()->item_content.date_modification);
|
2010-10-19 02:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-07 04:40:27 +02:00
|
|
|
void dir_last_dates_equal(Info & i)
|
|
|
|
{
|
2021-05-20 20:59:12 +02:00
|
|
|
pt::Date & date1 = cur->request->dir_tab.back()->item_content.date_creation;
|
|
|
|
pt::Date & date2 = cur->request->dir_tab.back()->item_content.date_modification;
|
2009-06-07 04:40:27 +02:00
|
|
|
|
2012-05-27 01:04:49 +02:00
|
|
|
i.res = date1 == date2;
|
2009-06-07 04:40:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-19 02:31:20 +02:00
|
|
|
void dir_last_users_different(Info & i)
|
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
i.res = (cur->request->dir_tab.back()->item_content.user_id != cur->request->dir_tab.back()->item_content.modification_user_id);
|
2010-10-19 02:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_last_modification_user(Info & i)
|
|
|
|
{
|
2021-02-24 01:19:47 +01:00
|
|
|
User * puser = system->users.GetUser(cur->request->dir_tab.back()->item_content.modification_user_id);
|
|
|
|
print_user_name(i, puser, cur->request->dir_tab.back()->item_content.guest_name);
|
2010-10-19 02:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-13 22:04:57 +02:00
|
|
|
void dir_last_html_template(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.out << cur->request->dir_tab.back()->html_template;
|
2010-08-13 22:04:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void dir_last_has_html_template(Info & i)
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
i.res = !cur->request->dir_tab.back()->html_template.empty();
|
2010-08-13 22:04:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-04 22:01:02 +01:00
|
|
|
|
2011-11-25 05:51:55 +01:00
|
|
|
void dir_last_meta_str(Info & i)
|
|
|
|
{
|
2021-04-09 17:50:58 +02:00
|
|
|
cur->request->dir_tab.back()->item_content.meta.serialize_to_space_stream(i.out, true);
|
2011-11-25 05:51:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-27 23:31:50 +02:00
|
|
|
//void dir_last_meta(Info & i)
|
|
|
|
//{
|
|
|
|
// space_value(i, cur->request->dir_tab.back()->item_content.meta);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//void dir_last_meta_tab(Info & i)
|
|
|
|
//{
|
|
|
|
// space_list_tab(i, cur->request->dir_tab.back()->item_content.meta);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//void dir_last_meta_tab_value(Info & i)
|
|
|
|
//{
|
|
|
|
// space_list_tab_value(i, cur->request->dir_tab.back()->item_content.meta, L"dir_last_meta_tab");
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//void dir_last_meta_tab_has_next(Info & i)
|
|
|
|
//{
|
|
|
|
// space_list_tab_has_next(i, cur->request->dir_tab.back()->item_content.meta, L"dir_last_meta_tab");
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//void dir_last_admin_meta_str(Info & i)
|
|
|
|
//{
|
|
|
|
// cur->request->dir_tab.back()->item_content.meta_admin.serialize_to_space_stream(i.out, true);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//void dir_last_admin_meta(Info & i)
|
|
|
|
//{
|
|
|
|
// space_value(i, cur->request->dir_tab.back()->item_content.meta_admin);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//void dir_last_admin_meta_tab(Info & i)
|
|
|
|
//{
|
|
|
|
// space_list_tab(i, cur->request->dir_tab.back()->item_content.meta_admin);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//void dir_last_admin_meta_tab_value(Info & i)
|
|
|
|
//{
|
|
|
|
// space_list_tab_value(i, cur->request->dir_tab.back()->item_content.meta_admin, L"dir_last_admin_meta_tab");
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//void dir_last_admin_meta_tab_has_next(Info & i)
|
|
|
|
//{
|
|
|
|
// space_list_tab_has_next(i, cur->request->dir_tab.back()->item_content.meta_admin, L"dir_last_admin_meta_tab");
|
|
|
|
//}
|
2012-11-04 22:01:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace TemplatesFunctions
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
} // namespace Winix
|
|
|
|
|