Skip to content

Commit ee755bd

Browse files
committed
LP: embed.php add Security::removeXss
1 parent ba8cafc commit ee755bd

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

main/lp/embed.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
api_protect_course_script(true);
99

10-
$type = $_REQUEST['type'];
11-
$src = Security::remove_XSS($_REQUEST['source']);
10+
$type = $_REQUEST['type'] ?? '';
11+
$src = $_REQUEST['source'] ?? '';
1212
if (empty($type) || empty($src)) {
1313
api_not_allowed();
1414
}
@@ -37,24 +37,27 @@
3737
);
3838
break;
3939
case 'youtube':
40-
$src = '//www.youtube.com/embed/'.$src;
40+
$src = "src ='//www.youtube.com/embed/$src'";
41+
$src = Security::remove_XSS($src);
42+
4143
$iframe .= '<div id="content" style="width: 700px ;margin-left:auto; margin-right:auto;"><br />';
42-
$iframe .= '<iframe class="youtube-player" type="text/html" width="640" height="385" src="'.$src.'" frameborder="0"></iframe>';
44+
$iframe .= '<iframe class="youtube-player" type="text/html" width="640" height="385" '.$src.' frameborder="0"></iframe>';
4345
$iframe .= '</div>';
4446
break;
4547
case 'vimeo':
46-
$src = '//player.vimeo.com/video/'.$src;
48+
$src = "src ='//player.vimeo.com/video/$src'";
49+
$src = Security::remove_XSS($src);
4750
$iframe .= '<div id="content" style="width: 700px ;margin-left:auto; margin-right:auto;"><br />';
48-
$iframe .= '<iframe src="'.$src.'" width="640" height="385" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
51+
$iframe .= '<iframe '.$src.' width="640" height="385" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
4952
$iframe .= '</div>';
5053
break;
5154
case 'nonhttps':
5255
$icon = '&nbsp;<em class="icon-external-link icon-2x"></em>';
53-
$iframe = Display::return_message(
56+
$iframe = Security::remove_XSS(Display::return_message(
5457
Display::url($src.$icon, $src, ['class' => 'btn', 'target' => '_blank']),
5558
'normal',
5659
false
57-
);
60+
));
5861
break;
5962
}
6063

0 commit comments

Comments
 (0)