877 lines
17 KiB
C++
877 lines
17 KiB
C++
/*
|
|
* This file is a part of Winix
|
|
* and is distributed under the 2-Clause BSD licence.
|
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
*/
|
|
|
|
/*
|
|
* Copyright (c) 2008-2014, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
* 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.
|
|
*
|
|
*/
|
|
|
|
#include "templates.h"
|
|
#include "misc.h"
|
|
#include "core/request.h"
|
|
#include "core/misc.h"
|
|
#include "core/bbcodeparser.h"
|
|
#include "core/textstream.h"
|
|
#include "miscspace.h"
|
|
|
|
namespace Winix
|
|
{
|
|
|
|
|
|
namespace TemplatesFunctions
|
|
{
|
|
static BBCODEParser bbcode_parser;
|
|
static HtmlTextStream item_run_content;
|
|
static EzcGen ezc_generator;
|
|
|
|
|
|
|
|
|
|
|
|
void item_is(Info & i)
|
|
{
|
|
i.res = cur->request->is_item;
|
|
}
|
|
|
|
|
|
void item_no_is(Info & i)
|
|
{
|
|
i.res = !cur->request->is_item;
|
|
}
|
|
|
|
|
|
void item_id(Info & i)
|
|
{
|
|
i.out << cur->request->item.id;
|
|
}
|
|
|
|
|
|
|
|
void item_subject(Info & i)
|
|
{
|
|
i.out << cur->request->item.subject;
|
|
}
|
|
|
|
|
|
void item_subject_noescape(Info & i)
|
|
{
|
|
i.out << R(cur->request->item.subject);
|
|
}
|
|
|
|
|
|
|
|
void item_content(Info & i)
|
|
{
|
|
i.out << cur->request->item.content;
|
|
}
|
|
|
|
|
|
|
|
void item_content_noescape(Info & i)
|
|
{
|
|
i.out << R(cur->request->item.content);
|
|
}
|
|
|
|
|
|
void item_content_type_is(Item & item, Info & i)
|
|
{
|
|
i.res = false;
|
|
|
|
if( item.content_type == Item::ct_text && i.par == L"text" )
|
|
i.res = true;
|
|
else
|
|
if( item.content_type == Item::ct_formatted_text && i.par == L"formatted text" )
|
|
i.res = true;
|
|
else
|
|
if( item.content_type == Item::ct_html && i.par == L"html" )
|
|
i.res = true;
|
|
else
|
|
if( item.content_type == Item::ct_bbcode && i.par == L"bbcode" )
|
|
i.res = true;
|
|
else
|
|
if( item.content_type == Item::ct_raw && i.par == L"raw" )
|
|
i.res = true;
|
|
}
|
|
|
|
|
|
void item_content_type_is(Info & i)
|
|
{
|
|
item_content_type_is(cur->request->item, i);
|
|
}
|
|
|
|
|
|
void item_print_content(HtmlTextStream & out, const std::wstring & content, Item::ContentType content_type)
|
|
{
|
|
if( content_type == Item::ct_text )
|
|
{
|
|
out << content;
|
|
}
|
|
else
|
|
if( content_type == Item::ct_formatted_text )
|
|
{
|
|
HtmlEscapeFormTxt(out, content);
|
|
}
|
|
else
|
|
if( content_type == Item::ct_html || content_type == Item::ct_raw )
|
|
{
|
|
out << R(content);
|
|
}
|
|
else
|
|
if( content_type == Item::ct_bbcode )
|
|
{
|
|
static std::wstring out_temp;
|
|
out_temp.clear();
|
|
out_temp.reserve(content.size()*2);
|
|
|
|
bbcode_parser.Filter(content.c_str(), out_temp);
|
|
out << R(out_temp);
|
|
}
|
|
}
|
|
|
|
|
|
void item_content_is_empty(Info & i)
|
|
{
|
|
i.res = cur->request->item.content.empty();
|
|
}
|
|
|
|
void item_print_content(Info & i)
|
|
{
|
|
item_print_content(i.out, cur->request->item.content, cur->request->item.content_type);
|
|
}
|
|
|
|
|
|
|
|
void item_privileges(Info & i)
|
|
{
|
|
i.out << Toa(cur->request->item.privileges, 8);
|
|
}
|
|
|
|
|
|
void item_dir(Info & i)
|
|
{
|
|
dir(i);
|
|
}
|
|
|
|
|
|
void item_url(Info & i)
|
|
{
|
|
i.out << cur->request->item.url;
|
|
}
|
|
|
|
|
|
void item_url_is(Info & i)
|
|
{
|
|
if( !cur->request->is_item )
|
|
return; // default false
|
|
|
|
i.res = (cur->request->item.url == i.par);
|
|
}
|
|
|
|
|
|
void item_url_is_no(Info & i)
|
|
{
|
|
if( !cur->request->is_item )
|
|
i.res = true;
|
|
else
|
|
i.res = (cur->request->item.url != i.par);
|
|
}
|
|
|
|
|
|
void item_link(Info & i)
|
|
{
|
|
doc_proto(i);
|
|
|
|
if( !cur->request->subdomain.empty() )
|
|
i.out << cur->request->subdomain << '.';
|
|
|
|
i.out << config->base_url;
|
|
item_dir(i);
|
|
item_url(i);
|
|
}
|
|
|
|
|
|
|
|
|
|
void item_filetype_is_none(Info & i)
|
|
{
|
|
i.res = cur->request->item.file_type == WINIX_ITEM_FILETYPE_NONE;
|
|
}
|
|
|
|
|
|
void item_filetype_is_image(Info & i)
|
|
{
|
|
i.res = cur->request->item.file_type == WINIX_ITEM_FILETYPE_IMAGE;
|
|
}
|
|
|
|
|
|
void item_has_static_file(Info & i)
|
|
{
|
|
i.res = cur->request->item.file_type != WINIX_ITEM_FILETYPE_NONE && !cur->request->item.file_path.empty();
|
|
}
|
|
|
|
|
|
void item_has_thumb(Info & i)
|
|
{
|
|
i.res = cur->request->item.has_thumb;
|
|
}
|
|
|
|
|
|
void item_can_read(Info & i)
|
|
{
|
|
i.res = system->HasReadAccess(cur->request->item);
|
|
}
|
|
|
|
|
|
void item_can_write(Info & i)
|
|
{
|
|
i.res = system->HasWriteAccess(cur->request->item);
|
|
}
|
|
|
|
|
|
void item_can_remove(Info & i)
|
|
{
|
|
// !! tutaj trzeba bedzie cos innego zrobic
|
|
// zwlaszcza jak dojdzie sticky bit
|
|
i.res = system->HasWriteAccess(*cur->request->dir_tab.back());
|
|
}
|
|
|
|
|
|
void item_user(Info & i)
|
|
{
|
|
User * puser = system->users.GetUser(cur->request->item.user_id);
|
|
print_user_name(i, puser, cur->request->item.guest_name);
|
|
}
|
|
|
|
|
|
|
|
void item_modification_user(Info & i)
|
|
{
|
|
User * puser = system->users.GetUser(cur->request->item.modification_user_id);
|
|
print_user_name(i, puser, cur->request->item.guest_name);
|
|
}
|
|
|
|
|
|
void item_users_different(Info & i)
|
|
{
|
|
i.res = (cur->request->item.user_id != cur->request->item.modification_user_id);
|
|
}
|
|
|
|
|
|
void item_date_creation(Info & i)
|
|
{
|
|
PT::Date date = system->ToLocal(cur->request->item.date_creation);
|
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
|
}
|
|
|
|
|
|
void item_date_modification(Info & i)
|
|
{
|
|
PT::Date date = system->ToLocal(cur->request->item.date_modification);
|
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
|
}
|
|
|
|
|
|
void item_date_creation_nice(Info & i)
|
|
{
|
|
print_date_nice(i, cur->request->item.date_creation);
|
|
}
|
|
|
|
|
|
void item_date_modification_nice(Info & i)
|
|
{
|
|
print_date_nice(i, cur->request->item.date_modification);
|
|
}
|
|
|
|
|
|
void item_dates_equal(Info & i)
|
|
{
|
|
PT::Date & date1 = cur->request->item.date_creation;
|
|
PT::Date & date2 = cur->request->item.date_modification;
|
|
|
|
i.res = date1 == date2;
|
|
}
|
|
|
|
|
|
|
|
void item_run(Info & i)
|
|
{
|
|
if( !cur->request->is_item )
|
|
{
|
|
i.out << "<!-- there is no an item to run -->";
|
|
return;
|
|
}
|
|
|
|
if( system->HasReadExecAccess(cur->request->item) )
|
|
{
|
|
Ezc::Pattern * p = pattern_cacher.GetPattern(cur->request->item);
|
|
|
|
item_run_content.Clear();
|
|
InitGenerator(ezc_generator);
|
|
ezc_generator.SetPattern(*p);
|
|
ezc_generator.Generate(item_run_content);
|
|
|
|
item_print_content(i.out, item_run_content.Str(), cur->request->item.content_type);
|
|
}
|
|
else
|
|
{
|
|
i.out << "<!-- run: permission denied -->";
|
|
}
|
|
}
|
|
|
|
|
|
void item_guest_name(Info & i)
|
|
{
|
|
i.out << cur->request->item.guest_name;
|
|
}
|
|
|
|
|
|
void item_html_template(Info & i)
|
|
{
|
|
i.out << cur->request->item.html_template;
|
|
}
|
|
|
|
|
|
void item_has_html_template(Info & i)
|
|
{
|
|
i.res = !cur->request->item.html_template.empty();
|
|
}
|
|
|
|
|
|
void item_type_is_dir(Info & i)
|
|
{
|
|
i.res = cur->request->item.type == Item::dir;
|
|
}
|
|
|
|
|
|
void item_type_is_file(Info & i)
|
|
{
|
|
i.res = cur->request->item.type == Item::file;
|
|
}
|
|
|
|
|
|
void item_type_is_symlink(Info & i)
|
|
{
|
|
i.res = cur->request->item.type == Item::symlink;
|
|
}
|
|
|
|
|
|
void item_is_link_to(Info & i)
|
|
{
|
|
i.res = !cur->request->item.link_to.empty();
|
|
}
|
|
|
|
|
|
void item_link_to(Info & i)
|
|
{
|
|
i.out << cur->request->item.link_to;
|
|
}
|
|
|
|
|
|
void item_is_link_redirect(Info & i)
|
|
{
|
|
i.res = cur->request->item.link_redirect == 1;
|
|
}
|
|
|
|
void item_file_size(Info & i)
|
|
{
|
|
i.res = cur->request->item.file_size;
|
|
}
|
|
|
|
void item_sort(Info & i)
|
|
{
|
|
i.out << cur->request->item.sort_index;
|
|
}
|
|
|
|
|
|
|
|
void item_meta_str(Info & i)
|
|
{
|
|
cur->request->item.meta.Serialize(i.out, true, false);
|
|
}
|
|
|
|
|
|
void item_meta(Info & i)
|
|
{
|
|
space(i, cur->request->last_item->meta); // !! a new interface (last_item instead of item)
|
|
}
|
|
|
|
|
|
|
|
|
|
void item_meta_tab(Info & i)
|
|
{
|
|
spaces_tab(i, cur->request->last_item->meta);
|
|
}
|
|
|
|
|
|
void item_meta_tab_value(Info & i)
|
|
{
|
|
spaces_tab_value(i, cur->request->last_item->meta);
|
|
}
|
|
|
|
|
|
|
|
void item_meta_tab_has_next(Info & i)
|
|
{
|
|
spaces_tab_has_next(i, cur->request->last_item->meta);
|
|
}
|
|
|
|
|
|
|
|
|
|
void item_admin_meta_str(Info & i)
|
|
{
|
|
cur->request->item.ameta.Serialize(i.out, true, false);
|
|
}
|
|
|
|
|
|
void item_admin_meta(Info & i)
|
|
{
|
|
space(i, cur->request->last_item->ameta);
|
|
}
|
|
|
|
|
|
void item_admin_meta_tab(Info & i)
|
|
{
|
|
spaces_tab(i, cur->request->last_item->ameta);
|
|
}
|
|
|
|
|
|
void item_admin_meta_tab_value(Info & i)
|
|
{
|
|
spaces_tab_value(i, cur->request->last_item->ameta);
|
|
}
|
|
|
|
|
|
void item_admin_meta_tab_has_next(Info & i)
|
|
{
|
|
spaces_tab_has_next(i, cur->request->last_item->ameta);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static size_t item_index;
|
|
|
|
|
|
void item_tab(Info & i)
|
|
{
|
|
item_index = i.iter;
|
|
i.res = item_index < cur->request->item_tab.size();
|
|
}
|
|
|
|
|
|
void item_tab_index(Info & i)
|
|
{
|
|
i.out << item_index;
|
|
}
|
|
|
|
|
|
void item_tab_id(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << cur->request->item_tab[item_index].id;
|
|
}
|
|
|
|
|
|
void item_tab_subject(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << cur->request->item_tab[item_index].subject;
|
|
}
|
|
|
|
void item_tab_subject_noescape(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << R(cur->request->item_tab[item_index].subject);
|
|
}
|
|
|
|
|
|
void item_tab_content(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << cur->request->item_tab[item_index].content;
|
|
}
|
|
|
|
|
|
void item_tab_content_noescape(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << R(cur->request->item_tab[item_index].content);
|
|
}
|
|
|
|
|
|
void item_tab_print_content(Info & i)
|
|
{
|
|
if( item_index >= cur->request->item_tab.size() )
|
|
return;
|
|
|
|
std::wstring & content = cur->request->item_tab[item_index].content;
|
|
Item::ContentType type = cur->request->item_tab[item_index].content_type;
|
|
|
|
item_print_content(i.out, content, type);
|
|
}
|
|
|
|
|
|
void item_tab_privileges(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << "0" << Toa(cur->request->item_tab[item_index].privileges, 8);
|
|
}
|
|
|
|
|
|
|
|
void item_tab_dir(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
std::wstring path;
|
|
|
|
if( system->dirs.MakePath(cur->request->item_tab[item_index].parent_id, path) )
|
|
i.out << path;
|
|
else
|
|
i.out << "/the path does not exist/"; // !! do konfiga
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_url(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << cur->request->item_tab[item_index].url;
|
|
}
|
|
|
|
|
|
void item_tab_link(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
doc_proto(i);
|
|
|
|
if( !cur->request->subdomain.empty() )
|
|
i.out << cur->request->subdomain << '.';
|
|
|
|
i.out << config->base_url;
|
|
item_tab_dir(i);
|
|
item_tab_url(i);
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_filetype_is_none(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.res = cur->request->item_tab[item_index].file_type == WINIX_ITEM_FILETYPE_NONE;
|
|
}
|
|
|
|
|
|
void item_tab_filetype_is_image(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.res = cur->request->item_tab[item_index].file_type == WINIX_ITEM_FILETYPE_IMAGE;
|
|
}
|
|
|
|
|
|
|
|
void item_tab_can_read(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
if( system->HasReadAccess(cur->request->item_tab[item_index]) )
|
|
i.res = true;
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_can_write(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
if( system->HasWriteAccess(cur->request->item_tab[item_index]) )
|
|
i.res = true;
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_user(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void item_tab_modification_user(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void item_tab_users_different(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
i.res = (cur->request->item_tab[item_index].user_id != cur->request->item_tab[item_index].modification_user_id);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void item_tab_group(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
long group_id = cur->request->item_tab[item_index].group_id;
|
|
Group * pgroup = system->groups.GetGroup(group_id);
|
|
|
|
if( pgroup )
|
|
i.out << pgroup->name;
|
|
else
|
|
i.out << group_id;
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_date_creation(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
PT::Date date = system->ToLocal(cur->request->item_tab[item_index].date_creation);
|
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_date_modification(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
PT::Date date = system->ToLocal(cur->request->item_tab[item_index].date_modification);
|
|
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_date_creation_nice(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
print_date_nice(i, cur->request->item_tab[item_index].date_creation);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void item_tab_date_modification_nice(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
print_date_nice(i, cur->request->item_tab[item_index].date_modification);
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_dates_equal(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
PT::Date & date1 = cur->request->item_tab[item_index].date_creation;
|
|
PT::Date & date2 = cur->request->item_tab[item_index].date_modification;
|
|
|
|
i.res = date1 == date2;
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_run(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
if( system->HasReadExecAccess(cur->request->item_tab[item_index]) )
|
|
{
|
|
Ezc::Pattern * p = pattern_cacher.GetPattern(cur->request->item_tab[item_index]);
|
|
item_run_content.Clear();
|
|
InitGenerator(ezc_generator);
|
|
ezc_generator.SetPattern(*p);
|
|
ezc_generator.Generate(item_run_content);
|
|
item_print_content(i.out, item_run_content.Str(), cur->request->item_tab[item_index].content_type);
|
|
}
|
|
else
|
|
{
|
|
i.out << "<!-- run: permission denied -->";
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_can_use_emacs(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
// !!
|
|
//i.res = cur->request->CanUseEmacs(cur->request->item_tab[item_index], true);
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_has_static_file(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
{
|
|
i.res = cur->request->item_tab[item_index].file_type != WINIX_ITEM_FILETYPE_NONE &&
|
|
!cur->request->item_tab[item_index].file_path.empty();
|
|
}
|
|
}
|
|
|
|
|
|
void item_tab_has_thumb(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.res = cur->request->item_tab[item_index].has_thumb;
|
|
}
|
|
|
|
|
|
void item_tab_type_is_dir(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.res = cur->request->item_tab[item_index].type == Item::dir;
|
|
}
|
|
|
|
|
|
void item_tab_type_is_file(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.res = cur->request->item_tab[item_index].type == Item::file;
|
|
}
|
|
|
|
|
|
void item_tab_type_is_symlink(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.res = cur->request->item_tab[item_index].type == Item::symlink;
|
|
}
|
|
|
|
|
|
void item_tab_is_link_to(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.res = !cur->request->item_tab[item_index].link_to.empty();
|
|
}
|
|
|
|
|
|
void item_tab_link_to(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << cur->request->item_tab[item_index].link_to;
|
|
}
|
|
|
|
|
|
void item_tab_is_link_redirect(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.res = cur->request->item_tab[item_index].link_redirect == 1;
|
|
}
|
|
|
|
|
|
void item_tab_file_size(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << cur->request->item_tab[item_index].file_size;
|
|
}
|
|
|
|
void item_tab_sort(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << cur->request->item_tab[item_index].sort_index;
|
|
}
|
|
|
|
void item_tab_has_next(Info & i)
|
|
{
|
|
i.res = item_index + 1 < cur->request->item_tab.size();
|
|
}
|
|
|
|
|
|
|
|
void item_tab_meta_str(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
cur->request->item_tab[item_index].meta.Serialize(i.out, true, false);
|
|
}
|
|
|
|
|
|
void item_tab_meta(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
space(i, cur->request->item_tab[item_index].meta);
|
|
}
|
|
|
|
|
|
void item_tab_meta_tab(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
spaces_tab(i, cur->request->item_tab[item_index].meta);
|
|
}
|
|
|
|
|
|
void item_tab_meta_tab_value(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
spaces_tab_value(i, cur->request->item_tab[item_index].meta);
|
|
}
|
|
|
|
|
|
|
|
void item_tab_meta_tab_has_next(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
spaces_tab_has_next(i, cur->request->item_tab[item_index].meta);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace TemplatesFunctions
|
|
|
|
} // namespace Winix
|
|
|
|
|
|
|