embed.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once '../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 = 'http://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 = 'http://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. $iframe = '<a href="' . $src . '" target="_blank" style="font-family: arial; color: #666;">' . $src . '</a>';
  25. break;
  26. }
  27. ?>
  28. <!doctype html>
  29. <html>
  30. <head>
  31. <meta charset="utf-8">
  32. <title></title>
  33. </head>
  34. <body>
  35. <?php echo $iframe; ?>
  36. </body>
  37. </html>