index.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. require_once('smarty/Smarty.class.php');
  3. $titulo="YTLibre";
  4. $template= new Smarty();
  5. /* ---- ---- Variables ---- ---- */
  6. $template->assign("titulo", $titulo);
  7. /* ---- ---- CSS ---- ---- */
  8. $template->assign('styles', array('frond' => 'templates/css/frond.min.css',
  9. 'normalize' => 'templates/css/normalize.css')
  10. );
  11. /* ---- ---- ---- Generated ---- ---- ---- ---- */
  12. if (empty($_GET['link'])){
  13. $template->display('templates/index.tpl');
  14. } else {
  15. /* ---- ---- video-generated ---- ---- */
  16. require_once "tools/processor.php";
  17. $video_decode = new Smarty();
  18. /* ---- ---- Variables ---- ---- */
  19. $video_decode->assign("titulo", $titulo);
  20. $video_decode->assign("videoTitle", $videoTitle);
  21. $video_decode->assign("videoThumbURL", $videoThumbURL);
  22. $video_decode->assign("videoAuthor", $videoAuthor);
  23. $video_decode->assign("videoChannel", $videoChannel);
  24. $video_decode->assign("videoDuration", $videoDuration);
  25. $video_decode->assign("videoViews", $videoViews);
  26. $video_decode->assign("librethumb", $librethumb);
  27. $video_decode->assign("cStreams", $cStreams);
  28. $video_decode->assign("baselink", $baselink);
  29. $video_decode->assign("videosStream", $videosStream);
  30. /* ---- ---- CSS ---- ---- */
  31. $video_decode->assign('styles', array('frond' => 'templates/css/frond.min.css',
  32. 'normalize' => 'templates/css/normalize.css',
  33. 'plyr' => 'templates/libs/plyr/plyr.css',
  34. 'salida' => 'templates/css/salida.min.css')
  35. );
  36. /* ---- ---- JS ---- ---- */
  37. $video_decode->assign('javascript', array('plyr' => 'templates/libs/plyr/plyr.min.js')
  38. );
  39. /* ---- ---- Embed ---- ---- */
  40. if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
  41. $pro = 'https';
  42. } else {
  43. $pro = 'http';
  44. }
  45. $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
  46. $subject = $pro."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['SCRIPT_NAME'];
  47. $pattern = array();
  48. $pattern[0] = '/index.php/';
  49. $substitution = array();
  50. $substitution[0] = 'embed?link=';
  51. $embed_url = preg_replace($pattern, $substitution, $subject);
  52. $decode_url_embed = "<iframe width='560' height='315' src='".$embed_url.$baselink."' frameborder='0' scrolling='no'></iframe>";
  53. $current_url = htmlentities($decode_url_embed);
  54. $video_decode->assign("current_url", $current_url);
  55. /* ---- ---- END ---- --- */
  56. $video_decode->display('templates/video.tpl');
  57. }