Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
Vips
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan-Hendrik Willms
Vips
Commits
0f343644
Commit
0f343644
authored
2 years ago
by
Elmar Ludwig
Browse files
Options
Downloads
Patches
Plain Diff
check format in `purifyFlexibleInput()`, fixes #180
parent
932d46be
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
exercises/Exercise.php
+4
-2
4 additions, 2 deletions
exercises/Exercise.php
js/vips.js
+7
-9
7 additions, 9 deletions
js/vips.js
lib/vips_common.inc.php
+1
-5
1 addition, 5 deletions
lib/vips_common.inc.php
views/exercises/rh_exercise/edit.php
+1
-1
1 addition, 1 deletion
views/exercises/rh_exercise/edit.php
with
13 additions
and
17 deletions
exercises/Exercise.php
+
4
−
2
View file @
0f343644
...
...
@@ -126,10 +126,12 @@ abstract class Exercise extends SimpleORMap
public
static
function
purifyFlexibleInput
(
$html
)
{
if
(
Studip\Markup
::
isHtml
(
$html
))
{
if
(
preg_match
(
'/<.*</s'
,
$html
))
{
$text
=
Studip\Markup
::
removeHtml
(
$html
);
if
(
preg_match
(
'/<.*</s'
,
$html
)
||
kill_format
(
$text
)
!==
$text
)
{
$html
=
Studip\Markup
::
purifyHtml
(
$html
);
}
else
{
$html
=
Studip\Markup
::
removeHtml
(
$html
)
;
$html
=
$text
;
}
}
...
...
This diff is collapsed.
Click to expand it.
js/vips.js
+
7
−
9
View file @
0f343644
...
...
@@ -167,15 +167,13 @@ $(function() {
var
toggle
=
$
(
this
).
closest
(
'
.size_toggle
'
);
var
items
=
toggle
.
find
(
'
.character_input
'
);
for
(
var
i
=
0
;
i
<
items
.
length
;
i
+=
2
)
{
var
name
=
items
[
i
].
name
;
items
[
i
].
name
=
items
[
i
+
1
].
name
;
items
[
i
+
1
].
name
=
name
;
var
name
=
items
[
0
].
name
;
items
[
0
].
name
=
items
[
1
].
name
;
items
[
1
].
name
=
name
;
var
value
=
items
[
i
].
value
;
items
[
i
].
value
=
items
[
i
+
1
].
value
;
items
[
i
+
1
].
value
=
value
;
}
var
value
=
items
[
0
].
value
;
items
[
0
].
value
=
items
[
1
].
value
;
items
[
1
].
value
=
value
;
toggle
.
toggleClass
(
'
size_large
'
).
toggleClass
(
'
size_small
'
);
event
.
preventDefault
();
...
...
This diff is collapsed.
Click to expand it.
lib/vips_common.inc.php
+
1
−
5
View file @
0f343644
...
...
@@ -426,11 +426,7 @@ function check_exercise_access($exercise_id, $assignment_id)
*/
function
vips_flexible_input_size
(
$text
)
{
if
(
strpos
(
$text
,
"
\n
"
)
!==
false
||
Studip\Markup
::
isHtml
(
$text
)
||
kill_format
(
$text
)
!==
$text
)
{
return
'large'
;
}
return
'small'
;
return
strpos
(
$text
,
"
\n
"
)
===
false
?
'small'
:
'large'
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
views/exercises/rh_exercise/edit.php
+
1
−
1
View file @
0f343644
...
...
@@ -15,7 +15,7 @@
</tr>
</thead>
<tbody
class=
"dynamic_list"
>
<tbody
class=
"dynamic_list"
style=
"vertical-align: top;"
>
<?
foreach
(
$exercise
->
task
[
'groups'
]
as
$i
=>
$group
)
:
?>
<?
$size
=
vips_flexible_input_size
(
$group
)
?>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment