aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
blob: ff1be947edb7bcbb828f764af26a896cd69e38c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
require_once('smarty/Smarty.class.php');
$titulo="YTLibre";
$template= new Smarty();

/* ---- ---- Variables ---- ---- */
$template->assign("titulo", $titulo);

/* ---- ---- CSS ---- ---- */

$template->assign('styles', array('frond' => 'templates/css/frond.min.css',
                                  'normalize' => 'templates/css/normalize.css')
);

/* ---- ---- ---- Generated ---- ---- ---- ---- */
if (empty($_GET['link'])){
    $template->display('templates/index.tpl');
} else {
    /* ---- ---- video-generated ---- ---- */
    require_once "tools/processor.php";
    $video_decode = new Smarty();

    /* ---- ---- Variables ---- ---- */
    $video_decode->assign("titulo", $titulo);
    $video_decode->assign("videoTitle", $videoTitle);
    $video_decode->assign("videoThumbURL", $videoThumbURL);
    $video_decode->assign("videoAuthor", $videoAuthor);
    $video_decode->assign("videoChannel", $videoChannel);
    $video_decode->assign("videoDuration", $videoDuration);
    $video_decode->assign("videoViews", $videoViews);
    $video_decode->assign("librethumb", $librethumb);

    $video_decode->assign("downloads", $downloads);
    $video_decode->assign("breakdownload", $breakdownload);
    $video_decode->assign("streamFormats", $streamFormats);

    $video_decode->assign("breaklink", $breaklink);
    $video_decode->assign("baselink", $baselink);

    /* ---- ---- CSS ---- ----  */
    $video_decode->assign('styles', array('frond' => 'templates/css/frond.min.css',
                                          'normalize' => 'templates/css/normalize.css',
                                          'plyr' => 'templates/libs/plyr/plyr.css',
                                          'salida' => 'templates/css/salida.min.css')
    );

    /* ---- ---- JS ---- ---- */
    $video_decode->assign('javascript', array('plyr' => 'templates/libs/plyr/plyr.min.js')
    );

    /* ---- ---- Embed ---- ---- */
    if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
        $pro = 'https';
    } else {
        $pro = 'http';
    }

    $subject =  $pro."://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];

    $pattern = array();
    $pattern[0] = '/index.php/';
    $substitution = array();
    $substitution[0] = 'embed?link=';

    $embed_url = preg_replace($pattern, $substitution, $subject);

    $decode_url_embed = "<iframe width='560' height='315' src='".$embed_url.$baselink."' frameborder='0' scrolling='no'></iframe>";

    $current_url = htmlentities($decode_url_embed);

    $video_decode->assign("current_url", $current_url);
    /* ---- ---- END ---- --- */

    $video_decode->display('templates/video.tpl');
}