当前位置: 首页>>代码示例>>PHP>>正文


PHP Tracker::getTrackers方法代码示例

本文整理汇总了PHP中Tracker::getTrackers方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker::getTrackers方法的具体用法?PHP Tracker::getTrackers怎么用?PHP Tracker::getTrackers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tracker的用法示例。


在下文中一共展示了Tracker::getTrackers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: procede

 public function procede()
 {
     if (!$this->oRequest->existParam('key')) {
         throw new Error('Vous devez renseigner la clé.', 3003);
     }
     if ($this->oRequest->getParam('key', 'string') != Config::get('ingestkey')) {
         throw new Error('La clé est invalide.', 3003);
     }
     //Ajoute du titre
     $this->oView->addData('titre', 'Analyse des flux RSS');
     //On récupère les éléments pour les statistiques
     $iNbReleases = Release::getCount();
     $iNbTorrents = Torrent::getCount();
     $iStartTime = time();
     //Traitement des Trackers
     $aTrackers = Tracker::getTrackers();
     //Ajout des flux
     $aRssList = Rss::getFlux();
     foreach ($aRssList as $oRss) {
         $aTrackers[$oRss->getTrackerId()]->addFlux($oRss);
     }
     //Parsage des flux
     $aResults = array();
     foreach ($aTrackers as $oTracker) {
         $aResults = array_merge($aResults, $oTracker->parseRss());
     }
     //Traitement des résultats
     $oTable = new TableGenerator();
     $oTable->setId(md5('Ingest'));
     $oTable->addColumn('Tags');
     $oTable->addColumn('Tracker');
     $oTable->addColumn('Release');
     foreach ($aResults as $oResult) {
         if (is_string($oResult)) {
             Logger::log('ingest', $oResult);
             $this->oView->addAlert($oResult, 'danger');
         } else {
             $oResult->store();
             $sTags = '';
             foreach ($oResult->getTags() as $oTag) {
                 $oTagView = new View('label');
                 $oTagView->addData('type', 'info');
                 $oTagView->addData('text', $oTag->getName());
                 $oTagView->create();
                 $sTags .= $oTagView->getCode() . ' ';
             }
             $oTable->addLine(array($sTags, $aTrackers[$oResult->getTracker()]->getName(), $oResult->getReleaseName()));
         }
     }
     //Statistiques
     $iNewReleases = Release::getCount() - $iNbReleases;
     $iNewTorrents = Torrent::getCount() - $iNbTorrents;
     Stats::storeIngestStats($iNewReleases, $iNewTorrents, date("Y-m-j G:i:s", $iStartTime));
     //Enregistrement de la dernière date de vérification
     Rss::updateLastCheck(date("Y-m-j G:i:s", $iStartTime));
     Logger::log('ingest', $iNewReleases . ' nouvelles releases et ' . $iNewTorrents . ' nouveaux torrents.');
     $oTable->setBottom($iNewReleases . ' nouvelles releases et ' . $iNewTorrents . ' nouveaux torrents.');
     $oTable->create();
     $this->oView->addData('content', $oTable->getCode());
     $this->oView->Create();
 }
开发者ID:Jatax,项目名称:TKS,代码行数:61,代码来源:ingest.controller.php

示例2: getReleaseTable

 /**
  * 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;
 }
开发者ID:Jatax,项目名称:TKS,代码行数:86,代码来源:search.model.php

示例3: procede

 public function procede()
 {
     //Récupère la catégorie
     if ($this->oRequest->existParam('type')) {
         $this->iType = $this->oRequest->getParam('type', 'int');
     } else {
         $this->iType = 0;
     }
     //Récupère le contenu de la recherche
     if ($this->oRequest->existParam('research')) {
         $sSearch = $this->oRequest->getParam('research', 'string');
         $sSearch = strtr($sSearch, ".", "%");
         $sSearch = strtr($sSearch, " ", "%");
     } else {
         $sSearch = "";
     }
     //Récupère le nombre d'éléments par page
     if ($this->oRequest->existParam('length')) {
         $iLenght = $this->oRequest->getParam('length', 'int');
     } else {
         $iLenght = 10;
     }
     //Récupère la page affichée
     if ($this->oRequest->existParam('draw')) {
         $iDraw = $this->oRequest->getParam('draw', 'int');
     } else {
         $iDraw = 1;
     }
     //Récupère l'OffSet
     if ($this->oRequest->existParam('start')) {
         $iStart = $this->oRequest->getParam('start', 'int');
     } else {
         $iStart = 0;
     }
     //Récupération du nombre de réponses
     $oMysqli = Database::getInstance();
     if ($this->iType != 0) {
         $sWhere = "AND id_categorie = '{$this->iType}' ";
     } else {
         $sWhere = '';
     }
     $oResult = $oMysqli->query("SELECT COUNT(*) as total FROM tks_releases \r\n                                   WHERE name LIKE '%" . $sSearch . "%' {$sWhere} ");
     $iNbResponses = $oResult->fetch_assoc()['total'];
     $oSearch = new Search($this->oCurrentUser);
     $oSearch->searchWithWords($sSearch, $this->iType, $iStart, $iLenght);
     $aResults = $oSearch->getReleaseTable();
     //Création du Tableau JSON
     $aJson = array();
     $aJson["draw"] = $iDraw;
     $aJson["recordsTotal"] = $iNbResponses;
     $aJson["recordsFiltered"] = $iNbResponses;
     $aJson["data"] = array();
     $aTrackers = Tracker::getTrackers();
     $aCategories = Categorie::getCategories();
     foreach ($aResults as $aRelease) {
         //Affichage de la catégorie
         $oCatView = new View('label');
         $oCatView->addData('type', 'primary');
         if ($aRelease['categorie'] != 0) {
             $oCatView->addData('text', $aCategories[$aRelease['categorie']]->getName());
         } else {
             $oCatView->addData('text', 'Non scrappé');
         }
         $oCatView->create();
         $sTags = $oCatView->getCode() . '&nbsp;';
         //Affichage des TAGS :
         foreach ($aRelease['tags'] as $iTagId => $sTagName) {
             if ($iTagId != NULL) {
                 $oTagView = new View('label');
                 $oTagView->addData('type', 'info');
                 $oTagView->addData('text', $sTagName);
                 $oTagView->create();
                 $sTags .= $oTagView->getCode() . '&nbsp;';
             }
         }
         //Affichage de la source :
         $oOriginView = new View('label');
         $oOriginView->addData('text', $aRelease['origin']);
         if ($aRelease['origin'] == 'Scene') {
             $oOriginView->addData('type', 'success');
         } else {
             $oOriginView->addData('type', 'danger');
         }
         $oOriginView->create();
         $sTags .= $oOriginView->getCode();
         //Création de la popup Tracker
         $oPopup = new View('releasepopup');
         $oPopup->addData('id', md5($aRelease['release']));
         $oPopup->addData('tracker', $aTrackers[$aRelease["first_tracker"]]->getName());
         $oPopup->addData('nbtracker', count($aRelease['torrents']));
         $oPopup->addData('title', $aRelease['release']);
         //Affichage des liens
         $aTableLinks = array();
         foreach ($aRelease['torrents'] as $aTorrent) {
             $sButtons = '';
             if (isset($aTorrent['fichelink'])) {
                 $oFicheButton = new View('minibutton');
                 $oFicheButton->addData('link', $aTorrent['fichelink']);
                 $oFicheButton->addData('icon', 'fa-search-plus');
                 $oFicheButton->addData('style', 'primary');
//.........这里部分代码省略.........
开发者ID:Jatax,项目名称:TKS,代码行数:101,代码来源:search.script.php

示例4: createView

 private function createView()
 {
     //Affichage des Trackers
     $this->oView->addData('titre', 'Administration des Trackers');
     //Construction du tableau
     $oTable = new TableGenerator();
     $oTable->setId(md5('Administration des Trackers'));
     $oTable->addColumn('Nom');
     $oTable->addColumn('Passkey');
     $oTable->addColumn('Lien de la fiche');
     $oTable->addColumn('Lien de téléchargement');
     $oTable->addColumn('');
     $aTrackers = Tracker::getTrackers();
     foreach ($aTrackers as $oTracker) {
         $oTable->addLine(array($oTracker->getName(), $oTracker->getNbPasskeys() == 0 ? 'Aucun' : $oTracker->getNbPasskeys() . ' passkeys', $this->createLinkPopup($oTracker), $this->createDirectLinkPopup($oTracker), $this->createEditPopup($oTracker)));
     }
     //Popup d'ajout
     $oTable->setBottom($this->createAddPopup() . '&nbsp;' . $this->createImportPopup());
     $oTable->create();
     $this->oView->addData('content', $oTable->getCode());
     $this->oView->create();
 }
开发者ID:Jatax,项目名称:TKS,代码行数:22,代码来源:admintrackers.controller.php

示例5: createReleasesTable

 private function createReleasesTable($sType)
 {
     $oSearch = new Search($this->oCurrentUser);
     $oSearch->searchWithIdFiche($this->oFiche->getId(), $sType);
     $aReleases = $oSearch->getReleaseTable();
     if (count($aReleases) != 0) {
         $oFinalTable = new TableGenerator();
         $oFinalTable->setId('releases');
         $oFinalTable->addColumn('Tags');
         $oFinalTable->addColumn('Release');
         $oFinalTable->addColumn('Lien');
         $aTrackers = Tracker::getTrackers();
         $aCategories = Categorie::getCategories();
         foreach ($aReleases as $iIdRelease => $aRelease) {
             //Affichage de la catégorie
             $oCatView = new View('label');
             $oCatView->addData('type', 'primary');
             if ($aRelease['categorie'] != 0) {
                 $oCatView->addData('text', $aCategories[$aRelease['categorie']]->getName());
             } else {
                 $oCatView->addData('text', 'Non scrappé');
             }
             $oCatView->create();
             $sTags = $oCatView->getCode() . '&nbsp;';
             //Affichage des TAGS :
             foreach ($aRelease['tags'] as $iTagId => $sTagName) {
                 if ($iTagId != NULL) {
                     $oTagView = new View('label');
                     $oTagView->addData('type', 'info');
                     $oTagView->addData('text', $sTagName);
                     $oTagView->create();
                     $sTags .= $oTagView->getCode() . '&nbsp;';
                 }
             }
             //Affichage de la source :
             $oOriginView = new View('label');
             $oOriginView->addData('text', $aRelease['origin']);
             if ($aRelease['origin'] == 'Scene') {
                 $oOriginView->addData('type', 'success');
             } else {
                 $oOriginView->addData('type', 'danger');
             }
             $oOriginView->create();
             $sTags .= $oOriginView->getCode();
             //Création de la popup Tracker
             $oPopup = new View('releasepopup');
             $oPopup->addData('id', $iIdRelease);
             $oPopup->addData('tracker', $aTrackers[$aRelease["first_tracker"]]->getName());
             $oPopup->addData('nbtracker', count($aRelease['torrents']));
             $oPopup->addData('title', $aRelease['release']);
             //Affichage des liens
             $aTableLinks = array();
             foreach ($aRelease['torrents'] as $aTorrent) {
                 $sButtons = '';
                 if (isset($aTorrent['fichelink'])) {
                     $oFicheButton = new View('minibutton');
                     $oFicheButton->addData('link', $aTorrent['fichelink']);
                     $oFicheButton->addData('icon', 'fa-search-plus');
                     $oFicheButton->addData('style', 'primary');
                     $oFicheButton->create();
                     $sButtons .= $oFicheButton->getCode() . '&nbsp;';
                 }
                 if (isset($aTorrent['directlink'])) {
                     $oDirectButton = new View('minibutton');
                     $oDirectButton->addData('link', $aTorrent['directlink']);
                     $oDirectButton->addData('icon', 'fa-download');
                     $oDirectButton->addData('style', 'success');
                     $oDirectButton->create();
                     $sButtons .= $oDirectButton->getCode() . '&nbsp;';
                     $oRssButton = new View('miniajaxbutton');
                     $oRssButton->addData('tid', $aTorrent['torrentid']);
                     $oRssButton->addData('icon', 'fa-rss-square');
                     $oRssButton->addData('style', 'warning');
                     $oRssButton->create();
                     $sButtons .= $oRssButton->getCode() . '&nbsp;';
                 }
                 $aTableLinks[] = array($aTrackers[$aTorrent['tracker']]->getName(), $aTorrent['delay'], $sButtons);
             }
             $oTable = new View('torrentlist');
             $oTable->addData('titre', $aRelease['release']);
             $oTable->addData('tabledatas', $aTableLinks);
             $oTable->addData('bottom', $aRelease['first']);
             $oTable->create();
             $oPopup->addData('content', $oTable->getCode());
             $oPopup->create();
             //Affichage du lien de modération
             if ($this->oCurrentUser->checkAccess('modrelease')) {
                 $sFicheLink = '<a href="index.php?p=modrelease&id=' . $aRelease['release_id'] . '" style="color: black;">' . $aRelease['release'] . '</a>';
             } else {
                 $sFicheLink = $aRelease['release'];
             }
             $oFinalTable->addLine(array($sTags, $sFicheLink, $oPopup->getCode()));
         }
         $oFinalTable->create();
         $this->oView->addData('releases', $oFinalTable->getCode());
     } else {
         $this->oView->addData('releases', 'Aucune release trouvée :(');
     }
 }
开发者ID:Jatax,项目名称:TKS,代码行数:99,代码来源:fichedetail.controller.php


注:本文中的Tracker::getTrackers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。