diff --git a/controller/status.php b/controller/status.php index 96a37b4..5a95e73 100644 --- a/controller/status.php +++ b/controller/status.php @@ -2,24 +2,25 @@ function getStatus() { - $listAdded = Download::listByState('added'); + $listAdded = Download::listByState('added'); $listDownloading = Download::listByState('downloading'); - $listDownloaded = Download::listByState('downloaded'); - $listDupp = Download::listByState('dupp'); - $streamFinished = Stream::listByState('finished'); - $streamBegin = Stream::listByState('begin'); + $listDownloaded = Download::listByState('downloaded'); + $listDupp = Download::listByState('dupp'); + $streamFinished = Stream::listByState('finished'); + $streamBegin = Stream::listByState('begin'); - $infos = PremiumizeMe::getStatus(); - + $infos = PremiumizeMe::getStatus(); $tmpRestant = $infos['expires']->diff(new DateTime()); - $restant = ''; - if ($tmpRestant->m !== 0) { - $restant .= $tmpRestant->m.'mois '; + $restant = ''; + + if (0 !== $tmpRestant->m) { + $restant .= $tmpRestant->m.' mois '; } - if ($tmpRestant->d !== 0) { - $restant .= $tmpRestant->d.'jours '; + if (0 !== $tmpRestant->d) { + $restant .= $tmpRestant->d.' jours'; } - include dirname(__FILE__).'/../templates/status.php'; + + include __DIR__.'/../templates/status.php'; } function cleanList() diff --git a/include/config.php b/include/config.php index cf68a04..6ee18aa 100644 --- a/include/config.php +++ b/include/config.php @@ -19,7 +19,7 @@ define('DOWNLOADEDDIR', __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'ro */ define('DOWNLOADLOCK', DOWNLOADINGDIR.DIRECTORY_SEPARATOR.'lock'); -include dirname(__FILE__).'/../lib/DbMongo.php'; -include dirname(__FILE__).'/../lib/Download.php'; -include dirname(__FILE__).'/../lib/PremiumizeMe.php'; -include dirname(__FILE__).'/../lib/Stream.php'; +include __DIR__.'/../lib/DbMongo.php'; +include __DIR__.'/../lib/Download.php'; +include __DIR__.'/../lib/PremiumizeMe.php'; +include __DIR__.'/../lib/Stream.php'; diff --git a/lib/Download.php b/lib/Download.php index a5edf39..37abd1c 100644 --- a/lib/Download.php +++ b/lib/Download.php @@ -176,22 +176,22 @@ class Download { static function listByState($state) { - $db = DbMongo::get(); - $coll = $db->download; + $db = DbMongo::get(); + $coll = $db->download; $retour = []; - - foreach ($coll->find(['cstate' => $state]) as $element) { + + foreach ($coll->find(['cstate' => $state])->sort(['timestamp' => -1]) as $element) { $element['time'] = DateTime::createFromFormat('U', $element['timestamp']); - + if (file_exists(DOWNLOADEDDIR.DIRECTORY_SEPARATOR.$element['filename'])) { $element['href'] = true; } else { $element['href'] = false; } - + $retour[] = $element; } - + return $retour; } diff --git a/lib/Stream.php b/lib/Stream.php index 0c92e34..d6b0845 100644 --- a/lib/Stream.php +++ b/lib/Stream.php @@ -8,6 +8,7 @@ class Stream { public $cstate; public $url; public $ip; + public $hide; static public $validStates = ['begin', 'finished']; function __construct($url, $premURL, $filename, $ip) @@ -16,9 +17,10 @@ class Stream { $this->timestamp = time(); $this->premURL = $premURL; $this->filename = $filename; - $this->cstate = 'begin'; + $this->cstate = 'getlink'; $this->url = $url; $this->ip = $ip; + $this->hide = false; $db = DbMongo::get(); $coll = $db->stream; @@ -28,7 +30,8 @@ class Stream { 'ip' => $this->ip, 'url' => $this->url, 'cstate' => $this->cstate, - 'filename' => $this->filename + 'filename' => $this->filename, + 'hide' => $this->hide ]); } @@ -121,6 +124,10 @@ class Stream { $db = DbMongo::get(); $coll = $db->stream; - $coll->remove(['cstate' => $state]); + $coll->update( + [], + [ '$set' => [ 'hide' => true ]], + [ 'multiple' => true ] + ); } } diff --git a/root/admin/index.php b/root/admin/index.php index 1771ea3..7bea6b4 100644 --- a/root/admin/index.php +++ b/root/admin/index.php @@ -1,6 +1,7 @@ Comment Télécharger - + diff --git a/templates/status.php b/templates/status.php index 7227b86..fb950fb 100644 --- a/templates/status.php +++ b/templates/status.php @@ -4,158 +4,63 @@ Admin - + -
- Expiration : format('d/m/Y') ?> ()
- Traffic Restant : Go (%)
-
+
+ Expiration : format('d/m/Y') ?> ()
+ Traffic Restant : Go (%)
+


-
- -
- Liste des fichiers a traiter :
- - - - - - - - - - - - - - - -
DateFilename
format('d/m/Y'); ?> - <?= $result['event'][0]['ip']; ?> - - -
- -
- -
- Liste des fichiers en cours :
- - - - - - - - - - - - - - - - - -
DateFilenameIP
format('d/m/Y'); ?> - <?= $result['event'][0]['ip']; ?> - - -
-
- -
- Liste des fichiers terminés :
- - - - - - - - +
+
+
DateFilename
+ + + + + + +
AjoutéEn coursFiniDuppliqué
+
+ + + + + + + + '.$result['filename'].''; +foreach([ 'added' => $listAdded, 'downlading' => $listDownloading, 'downloaded' => $listDownloaded, 'dupp' => $listDupp ] as $catName => $cat) { + foreach($cat as $element) { + if ($element['href']) { + $nameLink = ''.$element['filename'].''; } else { - $nameLink = $result['filename']; + $nameLink = $element['filename']; } ?> - - - - + + + + + - -
DateFilename
format('d/m/Y'); ?> - <?= $result['event'][0]['ip']; ?> - - -
format('d/m/Y'); ?> + <?= $element['event'][0]['ip']; ?> + +
- -
- -
- Liste des fichiers duppliqués :
- - - - - - - - - - - - - - - - - -
DateFilenameIP
format('d/m/Y'); ?>
- -
+ +