escape strings that could break the formspecs

This commit is contained in:
Dirk Sohler
2019-02-22 13:06:03 +01:00
parent 1817f4b046
commit ef34c5d392
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,7 @@
local m = mtimer local m = mtimer
local S = m.translator local S = m.translator
local build_frame = m.build_frame local build_frame = m.build_frame
local fe = minetest.formspec_escape
mtimer.show_formspec.main_menu = function (player_name) mtimer.show_formspec.main_menu = function (player_name)
@ -105,7 +106,7 @@ mtimer.show_formspec.ingame_time_format = function (player_name)
minetest.show_formspec(player_name, 'mtimer:ingame_time_format', minetest.show_formspec(player_name, 'mtimer:ingame_time_format',
build_frame(7, 4.9, S('Ingame Time Format'))..[[ build_frame(7, 4.9, S('Ingame Time Format'))..[[
field_close_on_enter[format;false] field_close_on_enter[format;false]
field[0.25,0.75;7,1;format;;]]..time_data.format..[[] field[0.25,0.75;7,1;format;;]]..fe(time_data.format)..[[]
container[0,1.425] container[0,1.425]
label[2.8,0;]]..S('Variable')..[[] label[2.8,0;]]..S('Variable')..[[]
@ -132,7 +133,7 @@ mtimer.show_formspec.ingame_time_format = function (player_name)
box[0,2.2;6.75,0.02;#ffffff] box[0,2.2;6.75,0.02;#ffffff]
label[0,2.25;]]..S('Current Result')..[[] label[0,2.25;]]..S('Current Result')..[[]
label[2.8,2.25;]]..time_data.formatted..[[] label[2.8,2.25;]]..fe(time_data.formatted)..[[]
container_end[] container_end[]
]]) ]])
end end
@ -162,7 +163,7 @@ mtimer.show_formspec.session_duration_format = function (player_name)
minetest.show_formspec(player_name, 'mtimer:session_duration_format', minetest.show_formspec(player_name, 'mtimer:session_duration_format',
build_frame(7, 5, S('Session Duration Format'))..[[ build_frame(7, 5, S('Session Duration Format'))..[[
field_close_on_enter[format;false] field_close_on_enter[format;false]
field[0.25,0.75;7,1;format;;]]..time_data.format..[[] field[0.25,0.75;7,1;format;;]]..fe(time_data.format)..[[]
container[0,1.425] container[0,1.425]
@ -190,7 +191,7 @@ mtimer.show_formspec.session_duration_format = function (player_name)
box[0,2.2;6.75,0.02;#ffffff] box[0,2.2;6.75,0.02;#ffffff]
label[0,2.25;]]..S('Current Result')..[[] label[0,2.25;]]..S('Current Result')..[[]
label[2.5,2.25;]]..time_data.formatted..[[] label[2.5,2.25;]]..fe(time_data.formatted)..[[]
container_end[] container_end[]
]]) ]])

View File

@ -1,6 +1,7 @@
local m = mtimer local m = mtimer
local S = m.translator local S = m.translator
local build_frame = m.build_frame local build_frame = m.build_frame
local fe = minetest.formspec_escape
mtimer.show_formspec.real_time_universal = function (player_name, config) mtimer.show_formspec.real_time_universal = function (player_name, config)
@ -9,7 +10,7 @@ mtimer.show_formspec.real_time_universal = function (player_name, config)
minetest.show_formspec(player_name, config.formspec_name, minetest.show_formspec(player_name, config.formspec_name,
build_frame(7, 8.5, config.title)..[[ build_frame(7, 8.5, config.title)..[[
field_close_on_enter[format;false] field_close_on_enter[format;false]
field[0.25,0.75;7,1;format;;]]..time_data.format..[[] field[0.25,0.75;7,1;format;;]]..fe(time_data.format)..[[]
container[0,1.425] container[0,1.425]
label[2.8,0;]]..S('Variable')..[[] label[2.8,0;]]..S('Variable')..[[]
@ -74,7 +75,7 @@ mtimer.show_formspec.real_time_universal = function (player_name, config)
box[0,5.75;6.75,0.02;#ffffff] box[0,5.75;6.75,0.02;#ffffff]
label[0,5.8;]]..S('Current Result')..[[] label[0,5.8;]]..S('Current Result')..[[]
label[2.8,5.8;]]..time_data.formatted..[[] label[2.8,5.8;]]..fe(time_data.formatted)..[[]
container_end[] container_end[]
]]) ]])