Example #1
0
 /**
  * Retourne la vue générée par le contrôleur
  * @return string Code HTML de la vue
  */
 public function getView()
 {
     return $this->oView->getCode();
 }
Example #2
0
 /**
  * Créer la Popup d'ajout d'un utilisateur
  * @param \Rank $p_aRanks Rangs possibles
  * @return string
  */
 private function createAddPopup($p_aRanks)
 {
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'adduser');
     $oPopupAdd->addData('buttonstyle', 'btn-success');
     $oPopupAdd->addData('buttonicon', 'fa-plus');
     $oPopupAdd->addData('buttontext', 'Ajouter');
     $oPopupAdd->addData('title', 'Ajouter un utilisateur');
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=adminusers');
     $oFormAdd->addInput('Identifiant', 'login', true, false, 'text', 'Identifiant ...');
     $oFormAdd->addInput('Password', 'password', true, false, 'password', 'Password ...');
     $oFormAdd->addInput('Confirmation', 'confirmation', true, false, 'password', 'Confirmation ...');
     $oFormAdd->addInput('Email', 'mail', true, false, 'text', 'Email ...');
     $oFormAdd->addSelect('Rang', 'rank', $p_aRanks, Rank::getDefaultRank()->getId());
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }
Example #3
0
 /**
  * Create Add Popup
  * @param array $p_aCategories
  * @return string Code HTML
  */
 private function createAddPopup($p_aCategories)
 {
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'addparser');
     $oPopupAdd->addData('buttonstyle', 'btn-success');
     $oPopupAdd->addData('buttonicon', 'fa-plus');
     $oPopupAdd->addData('buttontext', Language::translate('PARSER_ADMIN_ADD_ADD'));
     $oPopupAdd->addData('title', Language::translate('PARSER_ADMIN_ADD_TITLE'));
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=adminparser');
     $oFormAdd->addInput(Language::translate('PARSER_ADMIN_ADD_NAME'), 'name', true, false, 'text', 'Nom ...');
     $oFormAdd->addInput(Language::translate('PARSER_ADMIN_ADD_REGEX'), 'regex', true, false, 'text', 'expression1|expression2 ...');
     $oFormAdd->addSelect(Language::translate('PARSER_ADMIN_ADD_CATEGORIE'), 'categorie', $p_aCategories);
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }
Example #4
0
 private function createNewPasswordPopup()
 {
     //Création de la popup
     $oPopup = new View('popup');
     $oPopup->addData('id', 'resetpass');
     $oPopup->addData('buttonstyle', 'btn-default');
     $oPopup->addData('buttonicon', 'fa-edit');
     $oPopup->addData('buttontext', 'J\'ai perdu mes identifiants');
     $oPopup->addData('title', 'Demande de mot de passe');
     //Création du formulaire
     $oFormEdit = new FormGenerator();
     $oFormEdit->setAction('index.php?p=login');
     $oFormEdit->addInput('Email', 'email', true, false, 'text', 'Adresse email du compte');
     $oFormEdit->create();
     $oPopup->addData('content', $oFormEdit->getCode());
     $oPopup->create();
     return $oPopup->getCode();
 }
Example #5
0
 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() . ' ';
             //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() . ' ';
                 }
             }
             //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() . ' ';
                 }
                 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() . ' ';
                     $oRssButton = new View('miniajaxbutton');
                     $oRssButton->addData('tid', $aTorrent['torrentid']);
                     $oRssButton->addData('icon', 'fa-rss-square');
                     $oRssButton->addData('style', 'warning');
                     $oRssButton->create();
                     $sButtons .= $oRssButton->getCode() . ' ';
                 }
                 $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 :(');
     }
 }
Example #6
0
 /**
  * Créer la popup d'affichage du commentaire
  * @param array $p_aFiche
  * @return Code HTML
  */
 private function createCommentPopup($p_aFiche)
 {
     $oLinkPopup = new View('popup');
     $oLinkPopup->addData('id', $p_aFiche['id_fiche'] . $p_aFiche['id_user']);
     $oLinkPopup->addData('buttonstyle', 'btn-primary');
     $oLinkPopup->addData('buttonicon', 'fa-eye');
     $oLinkPopup->addData('buttontext', 'Voir');
     $oLinkPopup->addData('title', 'Commentaire de ' . $p_aFiche['login_user']);
     $oLinkPopup->addData('content', $p_aFiche['comment']);
     $oLinkPopup->create();
     return $oLinkPopup->getCode();
 }
Example #7
0
 /**
  * Créer la popup d'importation de config
  * @return string Code HTML
  */
 private function createImportPopup()
 {
     $aDir = scandir('./trackers/');
     $aSelect = array();
     foreach ($aDir as $sFile) {
         $iEnd = strpos($sFile, '.xml');
         if ($iEnd != false) {
             $sTracker = substr($sFile, 0, $iEnd);
             $aSelect[$sTracker] = $sTracker;
         }
     }
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'importtracker');
     $oPopupAdd->addData('buttonstyle', 'btn-warning');
     $oPopupAdd->addData('buttonicon', 'fa-code');
     $oPopupAdd->addData('buttontext', 'Importer');
     $oPopupAdd->addData('title', 'Importer un Tracker');
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=admintrackers');
     $oFormAdd->addSelect('Tracker', 'import', $aSelect);
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }
Example #8
0
 /**
  * Create ADD popup
  * @return string Code HTML
  */
 private function createAddPopup()
 {
     //Popup d'ajout
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'addkey');
     $oPopupAdd->addData('buttonstyle', 'btn-success');
     $oPopupAdd->addData('buttonicon', 'fa-plus');
     $oPopupAdd->addData('buttontext', Language::translate('API_ADMIN_ADD_ADD'));
     $oPopupAdd->addData('title', Language::translate('API_ADMIN_ADD_TITLE'));
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=adminapi');
     $aOptions = User::getUsersSelect();
     $oFormAdd->addSelect(Language::translate('API_ADMIN_ADD_USER'), 'user', $aOptions);
     $oFormAdd->addCheckbox(Language::translate('API_ADMIN_ADD_READ'), 'read', true);
     $oFormAdd->addCheckbox(Language::translate('API_ADMIN_ADD_WRITE'), 'write', false);
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }
Example #9
0
 /**
  * Create add popup
  * @return string HTML Code
  */
 private function createAddPopup()
 {
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'addrank');
     $oPopupAdd->addData('buttonstyle', 'btn-success');
     $oPopupAdd->addData('buttonicon', 'fa-plus');
     $oPopupAdd->addData('buttontext', Language::translate('RANKS_ADMIN_ADD_ADD'));
     $oPopupAdd->addData('title', Language::translate('RANKS_ADMIN_ADD_TITLE'));
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=adminranks');
     $oFormAdd->addInput(Language::translate('RANKS_ADMIN_ADD_NAME'), 'name', true, false, 'text', 'Nom ...');
     $oFormAdd->addCheckbox(Language::translate('RANKS_ADMIN_ADD_DEFAULT'), 'default', false);
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }
Example #10
0
 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');
                 $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);
         }
         //Affichage du lien vers la fiche
         $sFicheLink = '';
         if ($aRelease['fiche'] != null) {
             switch ($aRelease['categorie']) {
                 case 1:
                     $sCat = 'film';
                     break;
                 case 2:
                     $sCat = 'serie';
                     break;
                 case 3:
                     $sCat = 'music';
                     break;
             }
             $sFicheLink = '<a href="index.php?p=fichedetail&type=' . $sCat . '&id=' . $aRelease['fiche'] . '" style="color: black;">' . $aRelease['release'] . '</a>';
         } elseif ($aRelease['categorie'] == 9) {
             if ($this->oCurrentUser->checkAccess('modrelease')) {
                 $sFicheLink = '<a href="index.php?p=modrelease&id=' . $aRelease['release_id'] . '" style="color: red;">' . $aRelease['release'] . '</a>';
             } else {
                 $sFicheLink = $aRelease['release'];
             }
         } else {
             $sFicheLink = $aRelease['release'];
         }
         $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();
         $row = array();
         $row["release"] = $sFicheLink;
         $row["link"] = $oPopup->getCode();
         $row["tags"] = $sTags;
         $aJson["data"][] = $row;
     }
     echo json_encode($aJson);
 }
Example #11
0
 /**
  * Display HTML result
  */
 public function showView()
 {
     echo $this->oMainView->getCode();
 }
Example #12
0
 private function createPagination($iActual, $iNbRecord, $iNbPerPage, $sType, $sLetter)
 {
     $iNbPage = ceil($iNbRecord / $iNbPerPage);
     if ($iNbPage > 1) {
         $oPagination = new View('pagination');
         $aButtons = array();
         if ($iActual == 1) {
             $oPagination->addData('previous', 'disabled');
             $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=1', 'disabled' => false, 'active' => true, 'text' => 1);
             $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=2', 'disabled' => false, 'active' => false, 'text' => 2);
             if ($iNbPage > 2) {
                 $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=3', 'disabled' => false, 'active' => false, 'text' => 3);
             }
             if ($iNbPage > 4) {
                 $aButtons[] = array('link' => '#', 'disabled' => true, 'active' => false, 'text' => '...');
             }
             if ($iNbPage > 3) {
                 $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . $iNbPage, 'disabled' => false, 'active' => false, 'text' => $iNbPage);
             }
             $oPagination->addData('next', 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=2');
         } elseif ($iActual == $iNbPage) {
             $oPagination->addData('next', 'disabled');
             if ($iNbPage > 3) {
                 $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=1', 'disabled' => false, 'active' => false, 'text' => 1);
             }
             if ($iNbPage > 4) {
                 $aButtons[] = array('link' => '#', 'disabled' => true, 'active' => false, 'text' => '...');
             }
             if ($iNbPage > 2) {
                 $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . ($iNbPage - 2), 'disabled' => false, 'active' => false, 'text' => $iNbPage - 2);
             }
             $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . ($iNbPage - 1), 'disabled' => false, 'active' => false, 'text' => $iNbPage - 1);
             $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . $iActual, 'disabled' => false, 'active' => true, 'text' => $iActual);
             $oPagination->addData('previous', 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . ($iNbPage - 1));
         } else {
             $oPagination->addData('previous', 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . ($iActual - 1));
             $oPagination->addData('next', 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . ($iActual + 1));
             if ($iActual >= 3) {
                 $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=1', 'disabled' => false, 'active' => false, 'text' => 1);
                 if ($iActual != 3) {
                     $aButtons[] = array('link' => '#', 'disabled' => true, 'active' => false, 'text' => '...');
                 }
             }
             $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . ($iActual - 1), 'disabled' => false, 'active' => false, 'text' => $iActual - 1);
             $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . $iActual, 'disabled' => false, 'active' => true, 'text' => $iActual);
             $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . ($iActual + 1), 'disabled' => false, 'active' => false, 'text' => $iActual + 1);
             if ($iActual <= $iNbPage - 2) {
                 if ($iActual != $iNbPage - 2) {
                     $aButtons[] = array('link' => '#', 'disabled' => true, 'active' => false, 'text' => '...');
                 }
                 $aButtons[] = array('link' => 'index.php?p=fiches&type=' . $sType . '&letter=' . $sLetter . '&pagination=' . $iNbPage, 'disabled' => false, 'active' => false, 'text' => $iNbPage);
             }
         }
         $oPagination->addData('buttons', $aButtons);
         $oPagination->create();
         $this->oView->addData('pagination', $oPagination->getCode());
     } else {
         $this->oView->addData('pagination', '');
     }
 }
Example #13
0
    $oMainView = new View('gabarit');
    $oMainView->addData('titre', Config::get('sitetitle'));
    $oMainView->addData('login', 'Visiteur');
    $oMainView->addData('script', '');
    $oMainView->addData('menuItems', array());
    $sBuffer = '';
    try {
        //DB dump
        require './func/dumpSQL.func.php';
        dumpSQL(Database::getInstance());
        require './install/update/config.inc.php';
        require './install/update/update.class.php';
        while (Config::get('version') != $sLastVersion) {
            $sClassName = 'Update' . str_replace('.', '', Config::get('version'));
            $sClassFile = "./install/update/" . Config::get('version') . ".update.php";
            require $sClassFile;
            $oUpdate = new $sClassName();
            $oUpdate->setRequest($oRequest);
            $oUpdate->procede();
            $sBuffer .= $oUpdate->getView();
        }
        $oMainView->addAlert('Remplacez la variable suivant dans "./include/config.inc.php" : $sVersion = "' . $sLastVersion . '";', 'warning');
        $oMainView->addAlert('Votre script est maintenant en ' . $sLastVersion . '.', 'success');
    } catch (Error $e) {
        $oMainView->addAlert($e, 'danger');
    } finally {
        $oMainView->addData('body', $sBuffer);
        $oMainView->create();
        echo $oMainView->getCode();
    }
}
Example #14
0
 /**
  * Create ADD Popup
  * @param array $aTrackersSelect
  * @param array $aCategoriesSelect
  * @return string Code HTML
  */
 private function createAddPopup($aTrackersSelect, $aCategoriesSelect)
 {
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'addrss');
     $oPopupAdd->addData('buttonstyle', 'btn-success');
     $oPopupAdd->addData('buttonicon', 'fa-plus');
     $oPopupAdd->addData('buttontext', Language::translate('RSS_ADMIN_ADD_ADD'));
     $oPopupAdd->addData('title', Language::translate('RSS_ADMIN_ADD_TITLE'));
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=adminrss');
     $oFormAdd->addSelect(Language::translate('RSS_ADMIN_ADD_TRACKER'), 'tracker', $aTrackersSelect);
     $oFormAdd->addSelect(Language::translate('RSS_ADMIN_ADD_ENCODE'), 'encoding', Config::getEncodes());
     $oFormAdd->addInput(Language::translate('RSS_ADMIN_ADD_URL'), 'url', true, false, 'text', 'URL ...');
     $oFormAdd->addInput(Language::translate('RSS_ADMIN_ADD_MASK'), 'mask', true, false, 'text', 'http://montracker.fr/download/{PASSKEY}/{IDTORRENT}');
     $oFormAdd->addCheckbox(Language::translate('RSS_ADMIN_ADD_DATE'), 'forcedate');
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }
Example #15
0
 /**
  * Create view
  */
 private function createView()
 {
     $this->oView->addData('titre', Language::translate('PERMISSIONS_ADMIN_TABLE_TITLE'));
     $oTable = new TableGenerator();
     $oTable->setId(md5('Access'));
     $aRanks = Rank::getRanks();
     $oTable->addColumn('');
     foreach ($aRanks as $oRank) {
         $oTable->addColumn($oRank->getName());
     }
     $aModules = Permission::getModules();
     foreach ($aModules as $iId => $sName) {
         $aBuffer = array();
         $aBuffer[] = $sName;
         foreach ($aRanks as $oRank) {
             if ($oRank->checkAccess($sName)) {
                 $sIcon = 'fa-check';
                 $sStyle = 'success';
                 $sNewValue = 'false';
             } else {
                 $sIcon = 'fa-times';
                 $sStyle = 'danger';
                 $sNewValue = 'true';
             }
             $oLabel = new View('minibutton');
             $oLabel->addData('icon', $sIcon);
             $oLabel->addData('style', $sStyle);
             $oLabel->addData('link', 'index.php?p=adminpermissions&m=' . $iId . '&r=' . $oRank->getId() . '&v=' . $sNewValue);
             $oLabel->create();
             $aBuffer[] = $oLabel->getCode();
         }
         $oTable->addLine($aBuffer);
     }
     $oTable->setBottom('');
     $oTable->create();
     $this->oView->addData('content', $oTable->getCode());
     $this->oView->Create();
 }
Example #16
0
 private function createTagsEdit()
 {
     //Suppression d'un tag
     $sTags = '';
     foreach ($this->oRelease->getTags() as $iTagId => $oRegex) {
         $oButton = new View('button');
         $oButton->addData('link', 'index.php?p=modrelease&a=deletetag&id=' . $this->oRelease->getId() . '&tag=' . $iTagId);
         $oButton->addData('icon', 'fa-times');
         $oButton->addData('style', 'info');
         $oButton->addData('text', $oRegex->getName());
         $oButton->create();
         $sTags .= $oButton->getCode() . '&nbsp;';
     }
     //Ajout d'un tag
     $aRegex = Regex::getSelectRegex();
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'addtag');
     $oPopupAdd->addData('buttonstyle', 'btn-success');
     $oPopupAdd->addData('buttonicon', 'fa-plus');
     $oPopupAdd->addData('buttontext', 'Ajouter');
     $oPopupAdd->addData('title', 'Ajouter un tag');
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=modrelease&a=addtag&id=' . $this->oRelease->getId());
     $oFormAdd->addSelect('Tag', 'tag', $aRegex);
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     $sTags .= $oPopupAdd->getCode();
     $this->oView->addData('tagsdelete', $sTags);
 }
Example #17
0
 /**
  * Créer la popup d'ajout d'un passkey
  * @param array $aTrackers
  */
 private function createPkAddPopup($aTrackers)
 {
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'addpk');
     $oPopupAdd->addData('buttonstyle', 'btn-success');
     $oPopupAdd->addData('buttonicon', 'fa-plus');
     $oPopupAdd->addData('buttontext', 'Ajouter');
     $oPopupAdd->addData('title', 'Ajouter un passkey');
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=profil');
     $oFormAdd->addSelect('Tracker', 'tracker', $aTrackers);
     $oFormAdd->addInput('Passkey', 'passkey', true, false, 'text', 'Mon passkey ...');
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }
Example #18
0
 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() . '&nbsp;';
             }
             $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();
 }
Example #19
0
 /**
  * Créer la Popup d'ajout
  * @return string Code HTML
  */
 private function createAddPopup()
 {
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'addinvites');
     $oPopupAdd->addData('buttonstyle', 'btn-success');
     $oPopupAdd->addData('buttonicon', 'fa-plus');
     $oPopupAdd->addData('buttontext', 'Ajouter');
     $oPopupAdd->addData('title', 'Créer une invitation');
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=invites');
     $oFormAdd->addInput('Code', 'code', true, false, 'text', '', md5(time() * rand()));
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }