{# LimeSurvey Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac 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. (¯`·._.·(¯`·._.· Custom Header ·._.·´¯)·._.·´¯) If you extend a template, and want to add custom headers (js, css, scripts, meta etc), you'd rather do it here. #} {# Custom logo option #} {# Custom backgroud option #} {# Row 135/149: resolve a color-chooser MODE value to the effective color — used for headerbackgroundcolor, the progress bar colors and bodybackgroundcolor below (navbarfontcolor keeps its own inline expression further down). Modes: default|defaultbackgroundcolor| color1|color2|color3|other, or a raw hex (legacy stored value) which passes through directly. Row 180 / plan P2: legacy modes "primary"/"secondary" of the old 4-way textcolor dropdowns map to color1/color2 as well. #} {% macro cm(mode, custom, opts) -%} {%- set m = mode|default('') -%} {%- set r = m matches '/^#[0-9a-fA-F]{3,8}$/' ? m : (m == 'color1' or m == 'primary' ? opts.primarycolor|default('') : (m == 'color2' or m == 'secondary' ? opts.secondarycolor|default('') : (m == 'color3' ? opts.tertiarycolor|default('') : (m == 'defaultbackgroundcolor' ? opts.defaultbackgroundcolor|default('') : (m == 'other' ? custom|default('') : opts.fontcolor|default('')))))) -%} {#- S1 (SECURITY_REVIEW_20261129.md): validate the RESOLVED value as well — it can come from another raw option (primarycolor, *custom, legacy stored value). Hex or plain color keyword only; anything else resolves to '' (the CSS declaration is then dropped and the stylesheet default applies). Same validation as sec.color() in security_macros.twig (twig macros cannot call imported macros, so it is inlined here). -#} {{- (r matches '/^#[0-9a-fA-F]{3,8}$/' or r matches '/^[a-zA-Z]{3,20}$/') ? r : '' -}} {%- endmacro %} {# Row 191 / row 178 plan P6: like cm(), but for BACKGROUND choosers — mode "default" means "no override" (empty string), so the Bootstrap button default (btn-primary / btn-outline-secondary) stays; all other modes resolve the same way as cm(). Used for the per-button background colors of the navigator. #} {% macro cmbg(mode, custom, opts) -%} {%- set m = mode|default('') -%} {%- set r = m matches '/^#[0-9a-fA-F]{3,8}$/' ? m : (m == 'color1' or m == 'primary' ? opts.primarycolor|default('') : (m == 'color2' or m == 'secondary' ? opts.secondarycolor|default('') : (m == 'color3' ? opts.tertiarycolor|default('') : (m == 'defaultbackgroundcolor' ? opts.defaultbackgroundcolor|default('') : (m == 'other' ? custom|default('') : ''))))) -%} {#- S1: same resolved-value validation as cm() above. -#} {{- (r matches '/^#[0-9a-fA-F]{3,8}$/' or r matches '/^[a-zA-Z]{3,20}$/') ? r : '' -}} {%- endmacro %} {% import _self as cmm %} {# S1 (SECURITY_REVIEW_20261129.md): sanitizers for option values emitted raw below (autoescape is OFF in LimeSurvey theme twig). #} {% import './subviews/security_macros.twig' as sec %}