2026-11-24 22:04:11 +01:00
|
|
|
{#
|
|
|
|
|
LimeSurvey
|
|
|
|
|
Copyright (C) 2007-2026 The LimeSurvey Project Team
|
|
|
|
|
All rights reserved.
|
|
|
|
|
License: GNU/GPL License v2 or later, see LICENSE.php
|
|
|
|
|
LimeSurvey is free software. This version may have been modified pursuant
|
|
|
|
|
to the GNU General Public License, and as distributed it includes or
|
|
|
|
|
is derivative of works licensed under the GNU General Public License or
|
|
|
|
|
other free or open source software licenses.
|
|
|
|
|
See COPYRIGHT.php for copyright notices and details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(¯`·._.·(¯`·._.· Navigator ·._.·´¯)·._.·´¯)
|
|
|
|
|
|
|
|
|
|
Render the navigator: Previous, Next, Submit, Load, Save
|
|
|
|
|
All needed datas are inside aSurveyInfo.aNavigator
|
|
|
|
|
If you want to see what is available in aNavigator, turn debug mode on in application/config.php, and move out of comments the following line:
|
|
|
|
|
{{ dump(aSurveyInfo.aNavigator) }}
|
|
|
|
|
#}
|
|
|
|
|
|
|
|
|
|
{# create a shortcut for aSurveyInfo.aNavigator #}
|
|
|
|
|
{% set aNavigator = aSurveyInfo.aNavigator %}
|
|
|
|
|
|
|
|
|
|
{# THEME ADDITION: font for the navigator buttons (Previous/Next/Submit) — config.xml
|
|
|
|
|
option "buttonsfont", type fontselect. The class goes on the navigator container,
|
|
|
|
|
the buttons inherit it. "base" = same as the base font: no extra class. #}
|
fix(security): sanitize theme option values at emission (S1) and escape imagefile option HTML (S2)
S1 (HIGH, SECURITY_REVIEW_20261129.md): LimeSurvey renders theme twig with
autoescape OFF, so stored option values are untrusted on the public survey
pages. New views/subviews/security_macros.twig provides validators (color,
length, keyword, fontslug, pxnum, iconcode) applied at every emission point:
the <style> block in custom_header.twig (incl. the resolved values of the
cm()/cmbg() chooser macros), the inline style="color:..." and font-<slug>
class attributes in all survey subviews, and the <body> font class +
data-thememode in the newly overridden layout_global.twig and
layout_survey_list.twig. Crafted values fall back to the configured
defaults; legitimate picker/enum/slug values pass unchanged.
S2 (MEDIUM): options/options.twig escapes group/preview/filepath/filename
with |e('html_attr')/|e('html') when building the imagefile <option> HTML.
Verified: twig compile of all changed templates, malicious-value renders
neutralized + legit renders unchanged, live surveys 216664/282267 render
correct colors with no twig errors, jsdom custom_js tests pass (options_*
tests still need /tmp fixtures, pre-existing), export_public.sh exit 0.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-30 11:27:38 +01:00
|
|
|
{# S1: sanitize option values at emission (autoescape is OFF) — see security_macros.twig #}
|
|
|
|
|
{% import './subviews/security_macros.twig' as sec %}
|
2026-11-24 22:04:11 +01:00
|
|
|
{% set sButtonsFont = aSurveyInfo.options.buttonsfont|default('base') %}
|
2026-11-29 15:48:26 +01:00
|
|
|
{# Row 191 / row 178 plan P6: per-button colors. Each button gets a theme class
|
|
|
|
|
(respondage-btn-prev / -next / -submit); custom_header.twig emits the per-button
|
|
|
|
|
background/text color rules for these classes from the previousbutton*/nextbutton*/
|
|
|
|
|
submitbutton* chooser options. The old global buttonstextcolor inline style on the
|
|
|
|
|
container is gone. #}
|
2026-11-24 22:04:11 +01:00
|
|
|
|
|
|
|
|
<!-- PRESENT THE NAVIGATOR -->
|
fix(security): sanitize theme option values at emission (S1) and escape imagefile option HTML (S2)
S1 (HIGH, SECURITY_REVIEW_20261129.md): LimeSurvey renders theme twig with
autoescape OFF, so stored option values are untrusted on the public survey
pages. New views/subviews/security_macros.twig provides validators (color,
length, keyword, fontslug, pxnum, iconcode) applied at every emission point:
the <style> block in custom_header.twig (incl. the resolved values of the
cm()/cmbg() chooser macros), the inline style="color:..." and font-<slug>
class attributes in all survey subviews, and the <body> font class +
data-thememode in the newly overridden layout_global.twig and
layout_survey_list.twig. Crafted values fall back to the configured
defaults; legitimate picker/enum/slug values pass unchanged.
S2 (MEDIUM): options/options.twig escapes group/preview/filepath/filename
with |e('html_attr')/|e('html') when building the imagefile <option> HTML.
Verified: twig compile of all changed templates, malicious-value renders
neutralized + legit renders unchanged, live surveys 216664/282267 render
correct colors with no twig errors, jsdom custom_js tests pass (options_*
tests still need /tmp fixtures, pre-existing), export_public.sh exit 0.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-30 11:27:38 +01:00
|
|
|
<div class="{{ aSurveyInfo.class.navigatorcontainer }} row navigator space-col {% if sButtonsFont != 'base' %}font-{{ sec.fontslug(sButtonsFont) }}{% endif %}" id="{{ aSurveyInfo.id.navigatorcontainer }}" {{ aSurveyInfo.attr.navigatorcontainer }}>
|
2026-11-24 22:04:11 +01:00
|
|
|
|
|
|
|
|
<!-- Previous button container -->
|
|
|
|
|
<div class="{{ aSurveyInfo.class.navigatorbuttonl }} col-6 text-start" {{ aSurveyInfo.attr.navigatorbuttonl }}>
|
|
|
|
|
|
|
|
|
|
{# Previous button must be set to ON in survey settings (and it's not shown in first page, in All in One survey mode, etc) #}
|
|
|
|
|
{% if (not aSurveyInfo.popupPreview) and aNavigator.aMovePrev.show %}
|
|
|
|
|
<!-- Button previous -->
|
2026-11-29 15:48:26 +01:00
|
|
|
<button {{ aSurveyInfo.attr.navigatorbuttonprev }} accesskey="p" class=" {{ aNavigator.disabled }} {{ aSurveyInfo.class.navigatorbuttonprev }} btn btn-lg btn-outline-secondary respondage-btn-prev" >
|
2026-11-24 22:04:11 +01:00
|
|
|
{{ gT("Previous") }}
|
|
|
|
|
</button>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="{{ aSurveyInfo.class.navigatorbuttonr }} col-6 text-end">
|
|
|
|
|
|
|
|
|
|
{# Next button is not always shown (last page, all in one mode, etc) #}
|
|
|
|
|
{% if (not aSurveyInfo.popupPreview) and aNavigator.aMoveNext.show %}
|
|
|
|
|
|
|
|
|
|
{# On last page, Next button become submit button. #}
|
|
|
|
|
{% if aNavigator.aMoveNext.value == "movesubmit" %}
|
|
|
|
|
<!-- Button submit -->
|
2026-11-29 15:48:26 +01:00
|
|
|
<button {{ aSurveyInfo.attr.navigatorbuttonsubmit }} accesskey="n" class=" {{ aNavigator.disabled }} {{ aSurveyInfo.class.navigatorbuttonsubmit }} btn btn-lg btn-primary respondage-btn-submit">
|
2026-11-24 22:04:11 +01:00
|
|
|
{{ gT("Submit") }}
|
|
|
|
|
</button>
|
|
|
|
|
{% else %}
|
|
|
|
|
<!-- Button Next -->
|
2026-11-29 15:48:26 +01:00
|
|
|
<button {{ aSurveyInfo.attr.navigatorbuttonnext }} accesskey="n" class=" {{ aNavigator.disabled }} {{ aSurveyInfo.class.navigatorbuttonnext }} btn btn-lg btn-primary respondage-btn-next" >
|
2026-11-24 22:04:11 +01:00
|
|
|
{{ gT("Next") }}
|
|
|
|
|
</button>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- Extra navigator part -->
|
|
|
|
|
{{ include('./subviews/navigation/navigator_complement.twig') }}
|