Beispiel #1
0
 public function procede()
 {
     try {
         if ($this->oRequest->existParam('sitename')) {
             if (!$this->oRequest->existParam('lastfm')) {
                 throw new Error('Une clé Last.FM est nécessaire au bon fonctionnement du script.', 4004);
             }
             if (!$this->oRequest->existParam('tvdb')) {
                 throw new Error('Une clé TVDB est nécessaire au bon fonctionnement du script.', 4004);
             }
             $_SESSION['sitename'] = $this->oRequest->getParam('sitename', 'string');
             $_SESSION['lastfm'] = $this->oRequest->getParam('lastfm', 'string');
             $_SESSION['tvdb'] = $this->oRequest->getParam('tvdb', 'string');
             $this->oView->addAlert('Application configurée. <b><a href="install.php?step=5">Poursuivre</a></b>', 'success');
         }
     } catch (Exception $ex) {
         $this->oView->addAlert($ex, 'danger');
     } finally {
         $this->oView->addData('titre', 'Etape 4 : Configuration');
         //Création du formulaire
         $oForm = new FormGenerator();
         $oForm->setAction('install.php?step=4');
         $oForm->addInput('Nom du site', 'sitename', true, false, 'text', '', 'TKSearch');
         $oForm->addInput('Clé API Last.FM', 'lastfm', true, false, 'text', 'Last.FM');
         $oForm->addInput('Clé API TVDB', 'tvdb', true, false, 'text', 'TheTVDB.com');
         $oForm->create();
         $this->oView->addData('content', $oForm->getCode());
         $this->oView->create();
     }
 }
Beispiel #2
0
 public function procede()
 {
     try {
         if ($this->oRequest->existParam('login')) {
             //Connection à la base de donnée
             $oMysqli = new mysqli($_SESSION['hostname'], $_SESSION['username'], $_SESSION['password'], $_SESSION['name']);
             if ($oMysqli->connect_error) {
                 throw new Error('Impossible de se connecter à la base de donnée.', 4033);
             }
             $oMysqli->set_charset("utf8");
             //Création de l'utilisateur
             if (!$this->oRequest->existParam('password')) {
                 throw new Error('Vous devez renseigner un password.', 4033);
             }
             if (!$this->oRequest->existParam('email')) {
                 throw new Error('Vous devez renseigner une adresse email.', 4033);
             }
             $sPassword = $this->oRequest->getParam('password', 'string');
             $sConfirmation = $this->oRequest->getParam('confirmation', 'string');
             if ($sPassword != $sConfirmation) {
                 throw new Error("Le password et la confirmation ne correspondent pas.", 4033);
             }
             $sPassword = User::cryptPassword($sPassword);
             $oResult = $oMysqli->query("INSERT INTO `tks_users` (`id` ,`login` ,`pass` ,`mail` ,`passkey` ,`id_rank`)\r\n                                           VALUES ('',\r\n                                                   '" . $this->oRequest->getParam('login', 'string') . "',\r\n                                                   '{$sPassword}',\r\n                                                   '" . $this->oRequest->getParam('email', 'string') . "', \r\n                                                   '" . md5($sPassword * rand()) . "',\r\n                                                   '1');  ");
             if ($oResult == false) {
                 throw new Error('Impossible de créer l\'utilisateur.', 4034);
             }
             $this->oView->addAlert('Utilisateur créé. <b><a href="install.php?step=4">Poursuivre</a></b>', 'success');
         }
     } catch (Exception $ex) {
         $this->oView->addAlert($ex, 'danger');
     } finally {
         $this->oView->addData('titre', 'Etape 3 : Création du premier utilisateur');
         //Création du formulaire
         $oForm = new FormGenerator();
         $oForm->setAction('install.php?step=3');
         $oForm->addInput('Identifiant', 'login', true, false, 'text', 'Username');
         $oForm->addInput('Password', 'password', true, false, 'password', 'Password');
         $oForm->addInput('Confirmation', 'confirmation', true, false, 'password', 'Password');
         $oForm->addInput('Email', 'email', true, false, 'mail', '*****@*****.**');
         $oForm->create();
         $this->oView->addData('content', $oForm->getCode());
         $this->oView->create();
     }
 }
Beispiel #3
0
 public function procede()
 {
     try {
         if ($this->oRequest->existParam('hostname')) {
             if (!$this->oRequest->existParam('username')) {
                 throw new Error('Vous devez renseigner un Utilisateur.', 4013);
             }
             if (!$this->oRequest->existParam('password')) {
                 throw new Error('Vous devez renseigner un Password.', 4013);
             }
             if (!$this->oRequest->existParam('name')) {
                 throw new Error('Vous devez renseigner un Nom pour la base de donnée.', 4013);
             }
             //Connection à MySQL
             $_SESSION['hostname'] = $this->oRequest->getParam('hostname', 'string');
             $_SESSION['username'] = $this->oRequest->getParam('username', 'string');
             $_SESSION['password'] = $this->oRequest->getParam('password', 'string');
             $_SESSION['name'] = $this->oRequest->getParam('name', 'string');
             $oMysqli = new mysqli($_SESSION['hostname'], $_SESSION['username'], $_SESSION['password']);
             if ($oMysqli->connect_error) {
                 throw new Error('Impossible de se connecter à la base de donnée.', 4013);
             }
             $oMysqli->set_charset("utf8");
             //Création de la table
             $oMysqli->query("CREATE DATABASE IF NOT EXISTS " . $_SESSION['name']);
             $this->oView->addAlert('Base de donnée configurée. <b><a href="install.php?step=2">Poursuivre</a></b>', 'success');
         }
     } catch (Exception $ex) {
         $this->oView->addAlert($ex, 'danger');
     } finally {
         $this->oView->addData('titre', 'Etape 1 : Création de la BDD');
         //Création du formulaire
         $oForm = new FormGenerator();
         $oForm->setAction('install.php');
         $oForm->addInput('Hostname', 'hostname', true, false, 'text', '', 'localhost');
         $oForm->addInput('Utilisateur', 'username', true, false, 'text', 'Username');
         $oForm->addInput('Password', 'password', true, false, 'text', 'Password');
         $oForm->addInput('Nom de la base', 'name', true, false, 'text', 'Name');
         $oForm->create();
         $this->oView->addData('content', $oForm->getCode());
         $this->oView->create();
     }
 }
Beispiel #4
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();
 }
Beispiel #5
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);
 }
Beispiel #6
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();
 }
Beispiel #7
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();
 }
Beispiel #8
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();
 }
Beispiel #9
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();
 }
Beispiel #10
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();
 }
Beispiel #11
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();
 }
Beispiel #12
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();
 }
Beispiel #13
0
 /**
  * Créer la popup de signalisation
  * @return string Code HTML
  */
 private function createSignalPopup($p_sType, $p_iId)
 {
     $oPopupAdd = new View('popup');
     $oPopupAdd->addData('id', 'signal');
     $oPopupAdd->addData('buttonstyle', 'btn-warning');
     $oPopupAdd->addData('buttonicon', 'fa-exclamation-triangle');
     $oPopupAdd->addData('buttontext', 'Signaler la fiche');
     $oPopupAdd->addData('title', 'Signaler la fiche');
     $oFormAdd = new FormGenerator();
     $oFormAdd->setAction('index.php?p=fiche' . $p_sType . '&id=' . $p_iId);
     $oFormAdd->addTextArea('Commentaire', 'comment');
     $oFormAdd->create();
     $oPopupAdd->addData('content', $oFormAdd->getCode());
     $oPopupAdd->create();
     return $oPopupAdd->getCode();
 }
Beispiel #14
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();
 }