예제 #1
0
파일: rss.model.php 프로젝트: Jatax/TKS
 /**
  * Extrait l'ID du Torrent à partir du lien RSS et du masque du Flux
  * @param string $p_sLink Lien issu du flux RSS
  * @param Passkey $p_oPasskey Passkey pour le flux
  * @return string ID du Torrent sur le Tracker
  */
 private function getIdLink($p_sLink, $p_oPasskey)
 {
     //Suppression du Passkey si il y en a un
     if ($this->isPasskey()) {
         $this->sMask = $p_oPasskey->getLinkWithPasskey($this->sMask);
     }
     $aParts = explode('{IDTORRENT}', $this->sMask);
     foreach ($aParts as $sPart) {
         $p_sLink = str_replace($sPart, '', $p_sLink);
     }
     return $p_sLink;
 }
예제 #2
0
파일: tracker.model.php 프로젝트: Jatax/TKS
 /**
  * Parse les flux RSS associés au Tracker
  * @return array Tableau contenant les erreurs.
  */
 public function parseRss()
 {
     $aResults = array();
     foreach ($this->aFlux as $oFlux) {
         //On vérifie si le flux a besoin d'un passkey
         if ($oFlux->isPasskey()) {
             if (!isset($this->oPasskey)) {
                 $this->oPasskey = Passkey::getTrackerPasskey($this->iId);
                 if ($this->oPasskey == false) {
                     return array('error' => 'Aucun passkey défini pour ' . $this->sName);
                 }
             }
         }
         //On parse le Flux
         $aResults = array_merge($aResults, $oFlux->parse($this->oPasskey));
     }
     return $aResults;
 }
예제 #3
0
 /**
  * Créer la popup d'édition du Passkey
  * @param Passkey $oPasskey
  * @return string Code HTML
  */
 private function createPkEditPopup($oPasskey)
 {
     //Création de la popup d'édition
     $oPopup = new View('popup');
     $oPopup->addData('id', md5($oPasskey->getPasskey()));
     $oPopup->addData('buttonstyle', 'btn-primary');
     $oPopup->addData('buttonicon', 'fa-edit');
     $oPopup->addData('buttontext', 'Editer');
     $oPopup->addData('title', 'Edition du passkey');
     //Création du formulaire
     $oFormEdit = new FormGenerator();
     $oFormEdit->setAction('index.php?p=profil&edit=' . $oPasskey->getTrackerId());
     $oFormEdit->addInput('Tracker', 'tracker', false, true, 'text', '', $oPasskey->getTrackerName());
     $oFormEdit->addInput('Passkey', 'passkey', true, false, 'text', '', $oPasskey->getPasskey());
     $oFormEdit->addCheckbox('Supprimer', 'delete');
     $oFormEdit->create();
     $oPopup->addData('content', $oFormEdit->getCode());
     $oPopup->create();
     return $oPopup->getCode();
 }
예제 #4
0
파일: user.model.php 프로젝트: Jatax/TKS
 /**
  * Charge tous les passkeys d'un utilisateur
  * @return array
  */
 private function loadPasskeys()
 {
     return Passkey::getUserPasskeys($this->iId);
 }
예제 #5
0
파일: passkey.model.php 프로젝트: Jatax/TKS
 /**
  * Retourne tous les passkeys d'un utilisateur
  * @param int $p_iUser
  * @return /Passkey
  */
 public static function getUserPasskeys($p_iUser)
 {
     $oMysqli = Database::getInstance();
     $oResults = $oMysqli->query("SELECT p.passkey,p.id_tracker,t.name FROM tks_passkey as p JOIN tks_trackers as t ON t.id = p.id_tracker WHERE id_user='******'");
     $aResults = array();
     while ($aResult = $oResults->fetch_assoc()) {
         $oPasskey = new Passkey($p_iUser, $aResult['id_tracker'], $aResult['passkey']);
         $oPasskey->setTrackerName($aResult['name']);
         $aResults[$aResult['id_tracker']] = $oPasskey;
     }
     return $aResults;
 }