Esempio n. 1
0
<?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;
        }
        $outfilename = False;
        if (isset($_POST['outfilename']) && !empty($_POST['outfilename'])) {
            $outfilename = $_POST['outfilename'];
        }
        $vformat = False;
        if (isset($_POST['vformat']) && !empty($_POST['vformat'])) {
            $vformat = $_POST['vformat'];
        }
        $downloader = new Downloader($_POST['urls'], $audio_only, $outfilename, $vformat);
        if (!isset($_SESSION['errors'])) {
            header("Location: index.php");
        }