Browse Source

homepage ok

master
Julien Cabillot 1 year ago
parent
commit
9e1942ffab
3 changed files with 12 additions and 13 deletions
  1. 2
      controller/status.php
  2. 17
      lib/PremiumizeMe.php
  3. 6
      templates/status.php

2
controller/status.php

@ -10,7 +10,7 @@ function getStatus()
$streamBegin = Stream::listByState('begin');
$infos = PremiumizeMe::getStatus();
$tmpRestant = $infos['expires']->diff(new DateTime());
$tmpRestant = $infos['premium_until']->diff(new DateTime());
$restant = '';
if (0 !== $tmpRestant->m) {

17
lib/PremiumizeMe.php

@ -55,8 +55,8 @@ class PremiumizeMe {
$fields = [
'customer_id' => getenv('PREM_CID'),
'pin' => getenv('PREM_PIN')
];
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.premiumize.me/api/account/info');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@ -66,15 +66,12 @@ class PremiumizeMe {
$curlResult = curl_exec($ch);
curl_close($ch);
$data = json_decode($curlResult);
$retour = get_object_vars($data);
var_dump($data);
$retour = get_object_vars($data->result);
$tmpDT = new DateTime();
$tmpDT->setTimestamp($retour['expires']);
$retour['expires'] = $tmpDT;
var_dump($retour);
exit();
$tmpDT->setTimestamp($retour['premium_until']);
$retour['premium_until'] = $tmpDT;
return $retour;
}
@ -116,6 +113,8 @@ class PremiumizeMe {
// On le creer tout de suite pour eviter des conflits de process
touch(DOWNLOADINGDIR.DIRECTORY_SEPARATOR.$element->filename);
var_dump($premInfos);
exit();
$premInfos = PremiumizeMe::getLink($element->url);
if (file_exists(DOWNLOADINGDIR.DIRECTORY_SEPARATOR.$premInfos['filename']) || file_exists(DOWNLOADEDDIR.DIRECTORY_SEPARATOR.$premInfos['filename'])) {

6
templates/status.php

@ -11,8 +11,8 @@
</head>
<body>
<div class="account">
Expiration : <span class="info"><?= $infos['expires']->format('d/m/Y') ?> (<span class="important"><?= $restant ?></span>)</span><br>
Traffic Restant : <span class="info"><?= intval($infos['trafficleft_gigabytes']) ?>Go (<span class="important"><?= intval($infos['fairuse_left'] * 100) ?>%</span>)</span><br>
Expiration : <span class="info"><?= $infos['premium_until']->format('d/m/Y') ?> (<span class="important"><?= $restant ?></span>)</span><br>
Fair Use Status : <span class="info"><span class="important"><?= intval($infos['limit_used'] * 100) ?>%</span></span><br>
</div>
<div class="nomenclature">
<span class="added">Ajouté</span>
@ -56,7 +56,7 @@ foreach([ $listAdded, $listDownloading, $listDownloaded, $listDupp ] as $cat) {
<tr class="<?= $element['cstate']; ?>">
<td><?= $nameLink; ?></td>
<td>
<img src="/img/ip.png" height=16 width=16 title="<?= $element['event'][0]['ip']; ?>" alt="<?= $element['event'][0]['ip']; ?>">
<img src="/img/ip.png" height=16 width=16 title="<?= $element['from']; ?>" alt="<?= $element['from']; ?>">
<a href="<?= $element['url']; ?>"><img src="/img/link.png" height=16 width=16></a>
</td>
<td><?= $element['time']->format('d/m/Y'); ?></td>

Loading…
Cancel
Save