forked from MTco/Youtube-dl-WebUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
97 lines (88 loc) · 2.63 KB
/
index.php
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
require_once 'class/Session.php';
require_once 'class/Downloader.php';
require_once 'class/FileHandler.php';
$session = Session::getInstance();
$file = new FileHandler;
require 'views/header.php';
if(!$session->is_logged_in())
{
header("Location: login.php");
}
else
{
if(isset($_GET['kill']) && !empty($_GET['kill']) && $_GET['kill'] === "all")
{
Downloader::kill_them_all();
}
if(isset($_POST['urls']) && !empty($_POST['urls']))
{
$audio_only = false;
if(isset($_POST['audio']) && !empty($_POST['audio']))
{
$audio_only = true;
}
$downloader = new Downloader($_POST['urls'], $audio_only);
if(!isset($_SESSION['errors']))
{
header("Location: index.php");
}
}
}
?>
<div class="container">
<h1>Download</h1>
<?php
if(isset($_SESSION['errors']) && $_SESSION['errors'] > 0)
{
foreach ($_SESSION['errors'] as $e)
{
echo "<div class=\"alert alert-warning\" role=\"alert\">$e</div>";
}
}
?>
<form id="download-form" class="form-horizontal" action="index.php" method="post">
<div class="form-group">
<div class="col-md-10">
<input class="form-control" id="url" name="urls" placeholder="Link(s) separated by a comma" type="text">
</div>
<div class="col-md-2">
<div class="checkbox">
<label>
<input type="checkbox" name="audio"> Audio Only
</label>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">Download</button>
</form>
<br>
<div class="row">
<div class="col-lg-6">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Info</h3></div>
<div class="panel-body">
<p>Free space : <?php echo $file->free_space(); ?></b></p>
<p>Download folder : <?php echo $file->get_downloads_folder(); ?></p>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Help</h3></div>
<div class="panel-body">
<p><b>How does it work ?</b></p>
<p>Simply paste your video link in the field and click "Download"</p>
<p><b>With which sites does it work?</b></p>
<p><a href="http://rg3.github.io/youtube-dl/supportedsites.html">Here's</a> a list of the supported sites</p>
<p><b>How can I download the video on my computer?</b></p>
<p>Go to <a href="./list.php?type=v">List of videos</a> -> choose one -> right click on the link -> "Save target as ..." </p>
</div>
</div>
</div>
</div>
</div>
<?php
unset($_SESSION['errors']);
require 'views/footer.php';
?>