Gestion download au travers de premiumizeme
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

60 lines
1.6 KiB

<?php
function getStatus()
{
$listAdded = Download::listByState('added');
$listDownloading = Download::listByState('downloading');
$listDownloaded = Download::listByState('downloaded');
$listDupp = Download::listByState('dupp');
$streamFinished = Stream::listByState('finished');
$streamBegin = Stream::listByState('begin');
$infos = PremiumizeMe::getStatus();
$tmpRestant = $infos['premium_until']->diff(new DateTime());
$restant = '';
if (0 !== $tmpRestant->m) {
$restant .= $tmpRestant->m.' mois ';
}
if (0 !== $tmpRestant->d) {
$restant .= $tmpRestant->d.' jours';
}
include __DIR__.'/../templates/status.php';
}
function cleanList()
{
header('Content-type: application/json');
if (!isset($_GET['type']) || empty($_GET['type'])) {
echo json_encode('pas de type, exit');
exit();
}
if (!isset($_GET['state']) || empty($_GET['state'])) {
echo json_encode('pas de state, exit');
exit();
}
if ($_GET['type'] === 'download') {
if (!in_array($_GET['state'], Download::$validStates)) {
echo json_encode('mauvais state, exit');
exit();
}
Download::clear($_GET['state']);
echo json_encode('ok');
} elseif ($_GET['type'] === 'stream') {
if (!in_array($_GET['state'], Stream::$validStates)) {
echo json_encode('mauvais state, exit');
exit();
}
Stream::clear($_GET['state']);
echo json_encode('ok');
} else {
echo json_encode('mauvais type, exit');
exit();
}
}