embed.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../inc/global.inc.php';
  4. $type = $_REQUEST['type'];
  5. $src = Security::remove_XSS($_REQUEST['source']);
  6. if (empty($type) || empty($src)) {
  7. api_not_allowed();
  8. }
  9. $iframe = '';
  10. switch ($type) {
  11. case 'youtube':
  12. $src = '//www.youtube.com/embed/'.$src;
  13. $iframe .= '<div id="content" style="width: 700px ;margin-left:auto; margin-right:auto;"><br />';
  14. $iframe .= '<iframe class="youtube-player" type="text/html" width="640" height="385" src="'.$src.'" frameborder="0"></iframe>';
  15. $iframe .= '</div>';
  16. break;
  17. case 'vimeo':
  18. $src = '//player.vimeo.com/video/'.$src;
  19. $iframe .= '<div id="content" style="width: 700px ;margin-left:auto; margin-right:auto;"><br />';
  20. $iframe .= '<iframe src="'.$src.'" width="640" height="385" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  21. $iframe .= '</div>';
  22. break;
  23. case 'nonhttps':
  24. $icon = '&nbsp;<em class="icon-external-link icon-2x"></em>';
  25. $iframe = Display::return_message(
  26. Display::url($src.$icon, $src, ['class' => 'btn', 'target' => '_blank']),
  27. 'normal',
  28. false
  29. );
  30. break;
  31. }
  32. $htmlHeadXtra[] = "
  33. <style>
  34. body { background: none;}
  35. </style>
  36. ";
  37. Display::display_reduced_header();
  38. echo $iframe;
  39. Display::display_footer();