Exemplo n.º 1
0
 /**
  * Create View
  */
 private function createView()
 {
     $this->oView->addData('titre', Language::translate('PARSER_ADMIN_TABLE_TITLE'));
     $oTable = new TableGenerator();
     $oTable->setId(md5('Parser'));
     $oTable->addColumn(Language::translate('PARSER_ADMIN_TABLE_TAG'));
     $oTable->addColumn(Language::translate('PARSER_ADMIN_TABLE_REGEX'));
     $oTable->addColumn(Language::translate('PARSER_ADMIN_TABLE_CATEGORIE'));
     $oTable->addColumn('');
     $aRegex = Regex::getAllRegex();
     $aCategories = Categorie::getCategoriesSelect();
     $aCategories[0] = Language::translate('PARSER_ADMIN_TABLE_NONE');
     foreach ($aRegex as $oRegex) {
         $oTable->addLine(array($oRegex->getName(), $oRegex->getRegex(), $aCategories[$oRegex->getCategorie()], $this->createEditPopup($oRegex, $aCategories)));
     }
     $oTable->setBottom($this->createAddPopup($aCategories));
     $oTable->create();
     $this->oView->addData('content', $oTable->getCode());
     $this->oView->create();
 }
Exemplo n.º 2
0
 /**
  * Retourne un tableau contenant les informations des releases
  * @return array
  */
 public function getReleaseTable()
 {
     //Création du tableau
     $aResponse = array();
     $aRegex = Regex::getAllRegex();
     $aTrackers = Tracker::getTrackers();
     while ($aResult = $this->oResults->fetch_assoc()) {
         $row = array();
         if ($aResult['id_links'] != NULL) {
             $aTags = explode(';', $aResult['tags']);
             $row['tags'] = array();
             foreach ($aTags as $iTagId) {
                 if ($iTagId != NULL) {
                     $row['tags'][$iTagId] = $aRegex[$iTagId]->getName();
                 }
             }
             $row['categorie'] = $aResult['id_categorie'];
             $row['fiche'] = $aResult['id_fiche'];
             $row["release"] = $aResult['name'];
             $row["release_id"] = $aResult['id'];
             //Récupération des éléments
             $aTrackersId = explode(';', $aResult['trackers']);
             $aLinks = explode(';', $aResult['id_links']);
             $aDates = explode(';', $aResult['dates']);
             $aTorrentsId = explode(';', $aResult['id_torrents']);
             //Récupération du premier up
             $iFirstPost = 0;
             $iKeyFirst = 0;
             foreach ($aDates as $iKey => $sDate) {
                 if ($iFirstPost == 0 || strtotime($sDate) < $iFirstPost) {
                     $iFirstPost = strtotime($sDate);
                     $iKeyFirst = $iKey;
                 }
             }
             $row["first_tracker"] = $aTrackersId[$iKeyFirst];
             //Affichage des liens
             $sBottom = '';
             foreach ($aTrackersId as $iKey => $iTrackerId) {
                 $aTorrent = array();
                 $aTorrent['tracker'] = $iTrackerId;
                 //Calcul du pretime
                 $sDate = $aDates[$iKey];
                 if ($aResult['pretime'] != "0000-00-00 00:00:00") {
                     $iDelay = strtotime($sDate) - strtotime($aResult['pretime']);
                     $sBottom = 'PRE Time : ' . $aResult['pretime'];
                     $row['origin'] = 'Scene';
                 } else {
                     $iDelay = strtotime($sDate) - $iFirstPost;
                     $sBottom = 'Premier torrent : ' . date("Y-m-j G:i:s", $iFirstPost);
                     $row['origin'] = 'P2P';
                 }
                 if ($iDelay == 0) {
                     $sDelay = "-";
                 } else {
                     // Traitement pour affichage
                     $iDelayJ = floor($iDelay / 86400);
                     $iDelayH = floor(($iDelay - $iDelayJ * 86400) / 3600);
                     $iDelayM = floor(($iDelay - $iDelayJ * 86400 - $iDelayH * 3600) / 60);
                     $iDelayS = ($iDelay - $iDelayJ * 86400 - $iDelayH * 3600) % 60;
                     $sDelay = ($iDelayJ != 0 ? $iDelayJ . 'j ' : '') . ($iDelayH != 0 ? $iDelayH . 'h ' : '') . ($iDelayM != 0 ? $iDelayM . 'm ' : '') . ($iDelayS != 0 ? $iDelayS . 's ' : '');
                 }
                 $aTorrent['delay'] = $sDelay;
                 //Affichage des liens
                 $sFicheLink = $this->oCurrentUser->getLinkWithPasskey($iTrackerId, $aTrackers[$iTrackerId]->getLink());
                 if ($sFicheLink != false) {
                     $sFicheLink = str_replace('{IDTORRENT}', $aLinks[$iKey], $sFicheLink);
                     $aTorrent['fichelink'] = $sFicheLink;
                 }
                 $sDirectLink = $this->oCurrentUser->getLinkWithPasskey($iTrackerId, $aTrackers[$iTrackerId]->getDirectLink());
                 if ($sDirectLink != false) {
                     $sDirectLink = str_replace('{IDTORRENT}', $aLinks[$iKey], $sDirectLink);
                     $aTorrent['directlink'] = $sDirectLink;
                     $aTorrent['torrentid'] = $aTorrentsId[$iKey];
                 }
                 $row["torrents"][] = $aTorrent;
             }
             $row['first'] = $sBottom;
             $aResponse[$aResult['id']] = $row;
         }
     }
     return $aResponse;
 }
Exemplo n.º 3
0
 /**
  * Charge les informations d'une release à partir de son ID
  */
 public function loadFromId()
 {
     $oMysqli = Database::getInstance();
     $oResult = $oMysqli->query("SELECT r.*,f.id_fiche, \r\n                                    (SELECT GROUP_CONCAT(t.id_regex ORDER BY t.id_regex SEPARATOR ';') FROM tks_tags t WHERE t.id_release = r.id) AS tags \r\n                                    FROM tks_releases as r \r\n                                    LEFT OUTER JOIN tks_fiches as f \r\n                                    ON f.id_release = r.id \r\n                                    WHERE r.id='" . $this->iId . "'");
     if ($oResult->num_rows == 0) {
         throw new Error('Aucune release ne correspond à cette identifiant.', 1120);
     }
     $aResult = $oResult->fetch_assoc();
     $this->sName = $aResult['name'];
     $this->sPreTime = $aResult['pretime'];
     $this->iCat = $aResult['id_categorie'];
     $this->sFicheId = $aResult['id_fiche'];
     $aRegex = Regex::getAllRegex();
     $aTags = explode(';', $aResult['tags']);
     $row['tags'] = array();
     foreach ($aTags as $iTagId) {
         if ($iTagId != NULL) {
             $this->aTags[$iTagId] = $aRegex[$iTagId];
         }
     }
 }