860 lines
19 KiB
C++
860 lines
19 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-2021, 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 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->last_item->id;
|
|
//}
|
|
|
|
|
|
|
|
//void item_subject(Info & i)
|
|
//{
|
|
// i.out << cur->request->last_item->subject;
|
|
//}
|
|
|
|
|
|
//void item_subject_noescape(Info & i)
|
|
//{
|
|
// i.out << R(cur->request->last_item->subject);
|
|
//}
|
|
|
|
|
|
|
|
//void item_content(Info & i)
|
|
//{
|
|
// i.out << cur->request->last_item->item_content.content_raw;
|
|
//}
|
|
|
|
|
|
|
|
//void item_content_noescape(Info & i)
|
|
//{
|
|
// i.out << R(cur->request->last_item->item_content.content_raw);
|
|
//}
|
|
|
|
|
|
//void item_content_type_is(Item & item, Info & i)
|
|
//{
|
|
// i.res = false;
|
|
//
|
|
// if( item.item_content.content_raw_type == ItemContent::ct_text && i.par == L"text" )
|
|
// i.res = true;
|
|
// else
|
|
// if( item.item_content.content_raw_type == ItemContent::ct_formatted_text && i.par == L"formatted text" )
|
|
// i.res = true;
|
|
// else
|
|
// if( item.item_content.content_raw_type == ItemContent::ct_html && i.par == L"html" )
|
|
// i.res = true;
|
|
// else
|
|
// if( item.item_content.content_raw_type == ItemContent::ct_bbcode && i.par == L"bbcode" )
|
|
// i.res = true;
|
|
// else
|
|
// if( item.item_content.content_raw_type == ItemContent::ct_other && i.par == L"other" )
|
|
// i.res = true;
|
|
//}
|
|
//
|
|
//
|
|
//void item_content_type_is(Info & i)
|
|
//{
|
|
// item_content_type_is(*cur->request->last_item, i);
|
|
//}
|
|
|
|
|
|
//void item_content_is_empty(Info & i)
|
|
//{
|
|
// i.res = cur->request->last_item->item_content.content_raw.empty();
|
|
//}
|
|
|
|
|
|
//void item_privileges(Info & i)
|
|
//{
|
|
// i.out << Toa(cur->request->last_item->item_content.privileges, 8);
|
|
//}
|
|
|
|
|
|
// RENAMED TO item.dir_link
|
|
//void item_dir(Info & i)
|
|
//{
|
|
// dir(i);
|
|
//}
|
|
|
|
|
|
//void item_url(Info & i)
|
|
//{
|
|
// i.out << cur->request->last_item->url;
|
|
//}
|
|
|
|
|
|
//void item_url_is(Info & i)
|
|
//{
|
|
// i.res = (cur->request->last_item->url == i.par);
|
|
//}
|
|
|
|
|
|
//void item_url_is_no(Info & i)
|
|
//{
|
|
// i.res = (cur->request->last_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->last_item->item_content.file_type == WINIX_ITEM_FILETYPE_NONE;
|
|
//}
|
|
//
|
|
//
|
|
//void item_filetype_is_image(Info & i)
|
|
//{
|
|
// i.res = cur->request->last_item->item_content.file_type == WINIX_ITEM_FILETYPE_IMAGE;
|
|
//}
|
|
|
|
|
|
//void item_has_static_file(Info & i)
|
|
//{
|
|
// i.res = cur->request->last_item->item_content.file_type != WINIX_ITEM_FILETYPE_NONE && !cur->request->last_item->item_content.file_path.empty();
|
|
//}
|
|
|
|
|
|
//void item_has_thumb(Info & i)
|
|
//{
|
|
// i.res = cur->request->last_item->item_content.file_has_thumb;
|
|
//}
|
|
|
|
|
|
// changed to item.has_read_access
|
|
//void item_can_read(Info & i)
|
|
//{
|
|
// i.res = system->HasReadAccess(*cur->request->last_item);
|
|
//}
|
|
|
|
|
|
// changed to item.has_write_access
|
|
//void item_can_write(Info & i)
|
|
//{
|
|
// i.res = system->HasWriteAccess(*cur->request->last_item);
|
|
//}
|
|
|
|
// changed to item.can_be_removed
|
|
//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->last_item->item_content.user_id);
|
|
// print_user_name(i, puser, cur->request->last_item->item_content.guest_name);
|
|
//}
|
|
|
|
|
|
|
|
void item_modification_user(Info & i)
|
|
{
|
|
User * puser = system->users.GetUser(cur->request->last_item->item_content.modification_user_id);
|
|
print_user_name(i, puser, cur->request->last_item->item_content.guest_name);
|
|
}
|
|
|
|
|
|
void item_users_different(Info & i)
|
|
{
|
|
i.res = (cur->request->last_item->item_content.user_id != cur->request->last_item->item_content.modification_user_id);
|
|
}
|
|
|
|
|
|
void item_date_creation(Info & i)
|
|
{
|
|
pt::Date date = system->ToLocal(cur->request->last_item->item_content.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->last_item->item_content.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->last_item->item_content.date_creation);
|
|
}
|
|
|
|
|
|
void item_date_modification_nice(Info & i)
|
|
{
|
|
print_date_nice(i, cur->request->last_item->item_content.date_modification);
|
|
}
|
|
|
|
|
|
void item_dates_equal(Info & i)
|
|
{
|
|
pt::Date & date1 = cur->request->last_item->item_content.date_creation;
|
|
pt::Date & date2 = cur->request->last_item->item_content.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->last_item) )
|
|
// {
|
|
// Ezc::Pattern * p = pattern_cacher.GetPattern(*cur->request->last_item);
|
|
//
|
|
// item_run_content.Clear();
|
|
// InitGenerator(ezc_generator, cur->request->models);
|
|
// ezc_generator.SetPattern(*p);
|
|
//
|
|
// if( config->allow_ezc_frames_in_executable_items )
|
|
// ezc_generator.Generate(item_run_content, cur->request->out_streams);
|
|
// else
|
|
// ezc_generator.Generate(item_run_content);
|
|
//
|
|
// ItemContent::print_content(i.out, item_run_content.Str(), cur->request->last_item->item_content.content_raw_type, config->html_filter);
|
|
// }
|
|
// else
|
|
// {
|
|
// i.out << "<!-- run: permission denied -->";
|
|
// }
|
|
//}
|
|
|
|
|
|
//void item_guest_name(Info & i)
|
|
//{
|
|
// i.out << cur->request->last_item->item_content.guest_name;
|
|
//}
|
|
|
|
|
|
//void item_html_template(Info & i)
|
|
//{
|
|
// i.out << cur->request->last_item->html_template;
|
|
//}
|
|
|
|
|
|
void item_has_html_template(Info & i)
|
|
{
|
|
i.res = !cur->request->last_item->html_template.empty();
|
|
}
|
|
|
|
|
|
//void item_type_is_dir(Info & i)
|
|
//{
|
|
// i.res = cur->request->last_item->type == Item::dir;
|
|
//}
|
|
//
|
|
//
|
|
//void item_type_is_file(Info & i)
|
|
//{
|
|
// i.res = cur->request->last_item->type == Item::file;
|
|
//}
|
|
//
|
|
//
|
|
//void item_type_is_symlink(Info & i)
|
|
//{
|
|
// i.res = cur->request->last_item->type == Item::symlink;
|
|
//}
|
|
|
|
|
|
void item_is_link_to(Info & i)
|
|
{
|
|
i.res = !cur->request->last_item->item_content.link_to.empty();
|
|
}
|
|
|
|
|
|
void item_link_to(Info & i)
|
|
{
|
|
i.out << cur->request->last_item->item_content.link_to;
|
|
}
|
|
|
|
|
|
void item_is_link_redirect(Info & i)
|
|
{
|
|
i.res = cur->request->last_item->item_content.link_redirect == 1;
|
|
}
|
|
|
|
void item_file_size(Info & i)
|
|
{
|
|
i.res = cur->request->last_item->item_content.file_size;
|
|
}
|
|
|
|
void item_sort(Info & i)
|
|
{
|
|
i.out << cur->request->last_item->sort_index;
|
|
}
|
|
|
|
|
|
|
|
void item_meta_str(Info & i)
|
|
{
|
|
cur->request->last_item->item_content.meta.serialize_to_space_stream(i.out, true);
|
|
}
|
|
|
|
|
|
void item_meta(Info & i)
|
|
{
|
|
space_value(i, cur->request->last_item->item_content.meta);
|
|
}
|
|
|
|
|
|
void item_meta_noescape(Info & i)
|
|
{
|
|
space_value(i, cur->request->last_item->item_content.meta, false);
|
|
}
|
|
|
|
|
|
|
|
void item_meta_tab(Info & i)
|
|
{
|
|
space_list_tab(i, cur->request->last_item->item_content.meta);
|
|
}
|
|
|
|
|
|
void item_meta_tab_value(Info & i)
|
|
{
|
|
space_list_tab_value(i, cur->request->last_item->item_content.meta, L"item_meta_tab");
|
|
}
|
|
|
|
|
|
|
|
void item_meta_tab_has_next(Info & i)
|
|
{
|
|
space_list_tab_has_next(i, cur->request->last_item->item_content.meta, L"item_meta_tab");
|
|
}
|
|
|
|
|
|
|
|
|
|
void item_admin_meta_str(Info & i)
|
|
{
|
|
cur->request->last_item->item_content.meta_admin.serialize_to_space_stream(i.out, true);
|
|
}
|
|
|
|
|
|
void item_admin_meta(Info & i)
|
|
{
|
|
space_value(i, cur->request->last_item->item_content.meta_admin);
|
|
}
|
|
|
|
|
|
void item_admin_meta_tab(Info & i)
|
|
{
|
|
space_list_tab(i, cur->request->last_item->item_content.meta_admin);
|
|
}
|
|
|
|
|
|
void item_admin_meta_tab_value(Info & i)
|
|
{
|
|
space_list_tab_value(i, cur->request->last_item->item_content.meta_admin, L"item_admin_meta_tab");
|
|
}
|
|
|
|
|
|
void item_admin_meta_tab_has_next(Info & i)
|
|
{
|
|
space_list_tab_has_next(i, cur->request->last_item->item_content.meta_admin, L"item_admin_meta_tab");
|
|
}
|
|
|
|
|
|
void item_can_content_be_html_filtered(Info & i)
|
|
{
|
|
i.res = cur->request->last_item->item_content.CanContentBeHtmlFiltered();
|
|
}
|
|
|
|
|
|
/*
|
|
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].item_content.content_raw;
|
|
}
|
|
|
|
|
|
void item_tab_content_noescape(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
i.out << R(cur->request->item_tab[item_index].item_content.content_raw);
|
|
}
|
|
|
|
|
|
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].item_content.content_raw;
|
|
ItemContent::ContentType type = cur->request->item_tab[item_index].item_content.content_raw_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].item_content.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/"; // !! IMPROVEME move me to locales and put some info to log
|
|
}
|
|
}
|
|
|
|
|
|
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].item_content.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].item_content.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].item_content.user_id);
|
|
print_user_name(i, puser, cur->request->item_tab[item_index].item_content.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].item_content.modification_user_id);
|
|
print_user_name(i, puser, cur->request->item_tab[item_index].item_content.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].item_content.user_id != cur->request->item_tab[item_index].item_content.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].item_content.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].item_content.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].item_content.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].item_content.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].item_content.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].item_content.date_creation;
|
|
pt::Date & date2 = cur->request->item_tab[item_index].item_content.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, cur->request->models);
|
|
ezc_generator.SetPattern(*p);
|
|
|
|
if( config->allow_ezc_frames_in_executable_items )
|
|
ezc_generator.Generate(item_run_content, cur->request->out_streams);
|
|
else
|
|
ezc_generator.Generate(item_run_content);
|
|
|
|
item_print_content(i.out, item_run_content.Str(), cur->request->item_tab[item_index].item_content.content_raw_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].item_content.file_type != WINIX_ITEM_FILETYPE_NONE &&
|
|
!cur->request->item_tab[item_index].item_content.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].item_content.file_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].item_content.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].item_content.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].item_content.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].item_content.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].item_content.meta.serialize_to_space_stream(i.out, true);
|
|
}
|
|
|
|
|
|
void item_tab_meta(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
space_value(i, cur->request->item_tab[item_index].item_content.meta);
|
|
}
|
|
|
|
void item_tab_meta_noescape(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
space_value(i, cur->request->item_tab[item_index].item_content.meta, false);
|
|
}
|
|
|
|
void item_tab_meta_tab(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
space_list_tab(i, cur->request->item_tab[item_index].item_content.meta);
|
|
}
|
|
|
|
|
|
void item_tab_meta_tab_value(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
space_list_tab_value(i, cur->request->item_tab[item_index].item_content.meta, L"item_tab_meta_tab");
|
|
}
|
|
|
|
|
|
|
|
void item_tab_meta_tab_has_next(Info & i)
|
|
{
|
|
if( item_index < cur->request->item_tab.size() )
|
|
space_list_tab_has_next(i, cur->request->item_tab[item_index].item_content.meta, L"item_tab_meta_tab");
|
|
}
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace TemplatesFunctions
|
|
|
|
} // namespace Winix
|
|
|
|
|
|
|