Example #1
0
 function view($nom)
 {
     $this->set("nom", $nom);
     $test = new \model\mysql\Utilisateur();
     $test->find(array("conditions" => array(array(array("colums" => "login", "table" => new \model\mysql\Utilisateur()), "=", array("colums" => "login", "table" => new \model\mysql\Rtorrents())))));
     \core\Mysqli::query("select * from tr");
 }
Example #2
0
 static function getAllRtorrentUtilisateur($login)
 {
     $query = "select nomrtorrent ";
     $query .= "from rtorrents ";
     $query .= "where ";
     $query .= "login =" . \core\Mysqli::real_escape_string_html($login);
     \core\Mysqli::query($query);
     return \core\Mysqli::getObjectAndClose(true);
 }
Example #3
0
 public static function isRtorrentServeur()
 {
     $query = "select count(*) as nb from rtorrent";
     $query .= " where hostname=" . \core\Mysqli::real_escape_string_html(HOST);
     \core\Mysqli::query($query);
     $objet = \core\Mysqli::getObjectAndClose();
     return $objet->nb == 1;
     //die();
 }
Example #4
0
 public static function traiteTicket($id)
 {
     $query = "select id, donnee, UNIX_TIMESTAMP(expire) as expire from ticket ";
     $query .= " where id=" . \core\Mysqli::real_escape_string_html($id);
     \core\Mysqli::query($query);
     $ticket = \core\Mysqli::getObjectAndClose(false, __CLASS__);
     if ($ticket != null) {
         if ($ticket->expire <= time()) {
             $ticket->delete();
             $ticket = null;
         }
     }
     return $ticket;
 }
Example #5
0
 public static function getAllGenre()
 {
     $query = "select distinct g.label as label ";
     $query .= "from torrentfilm tf, film f, genrefilm g ";
     $query .= "where ( ";
     $query .= "tf.idfilm = f.id ";
     $query .= "and g.id = f.id ";
     $query .= "and tf.login = "******"user"]->login);
     //$query .= " and rs.nomrtorrent = r.nom ";
     $query .= " ) or ( ";
     //$query .= "tf.fini = true ";
     $query .= "tf.partageamis = true ";
     $query .= "and tf.idfilm = f.id ";
     $query .= "and g.id = f.id ";
     //$query .= "and rs.nomrtorrent = r.nom ";
     $query .= "and tf.login in (select login from amis a1 where a1.demandeur = " . \core\Mysqli::real_escape_string_html(\config\Conf::$user["user"]->login) . " and a1.ok = true union select demandeur from amis a2 where a2.login = "******"user"]->login) . " and a2.ok = true)";
     $query .= ") ORDER BY label ASC";
     \core\Mysqli::query($query);
     return \core\Mysqli::getObjectAndClose(true);
 }
Example #6
0
    throw new Exception("Impossible de trouver la distribution");
}
\config\Conf::$distribution = $c[1];
$c = \model\simple\Console::execute("ls -l /proc/1/exe | awk '{ print \$11 }'");
if ($c[0] === 1) {
    throw new Exception("Impossible de trouver l'init..");
}
\config\Conf::$init = basename($c[1]);
\model\simple\MakerRtorrentLancer::create();
//\model\simple\MakerRtorrent::create();
\model\simple\Console::println("Configuration de mysql");
$host = \model\simple\Console::saisieString("Entré host de mysql");
$login = \model\simple\Console::saisieString("Entré le login de mysql");
$mdp = \model\simple\Console::saisieString("Entré le mot de passe de mysql");
$querys = file_get_contents(ROOT . DS . "mysql" . DS . "mediastorrent.sql");
\core\Mysqli::initmultiquery($host, $login, $mdp, $querys);
$lvm = \model\simple\Console::saisieBoolean("Est ce que vous utiliserez lvm2 ?");
$volumegroup = "";
if ($lvm) {
    $volumegroup = \model\simple\Console::saisieString("Entré le nom du volume group que vous utiliserez");
    $sortie = \model\simple\Console::execute('vgdisplay -c ' . $volumegroup);
    if ($sortie[0] === 1) {
        $lvm = false;
        \model\simple\Console::println($volumegroup . " non disponible => désactivation du support de lvm2");
    }
}
\model\simple\MakerConf::make($host, $login, $mdp, $lvm, $volumegroup);
exec("crontab -l > mycron");
exec('echo "*/1 * * * * ' . ROOT . DS . "script" . DS . 'cronroot.sh"  >> mycron');
exec("crontab mycron");
exec("rm mycron");
Example #7
0
 public static function getDescription($id)
 {
     $query = "SELECT * FROM torrents WHERE id = " . \core\Mysqli::real_escape_string($id);
     \core\Mysqli::query($query);
     return \core\Mysqli::getObjectAndClose(true, __CLASS__);
 }
Example #8
0
 public static function estFini($id)
 {
     $query = "select count(*) as nb from cronroot ";
     $query .= " where fini=" . \core\Mysqli::real_escape_string_html(true) . " and encour=" . \core\Mysqli::real_escape_string_html(true) . " and id=" . \core\Mysqli::real_escape_string_html($id);
     \core\Mysqli::query($query);
     $res = \core\Mysqli::getObjectAndClose();
     if (!is_bool($res)) {
         return $res->nb == 1;
     }
     return false;
 }
Example #9
0
 public static function supprimeUtilisateur($login)
 {
     $query = "delete from utilisateur ";
     $query .= " where login=" . \core\Mysqli::real_escape_string_html($login);
     \core\Mysqli::query($query);
     $res = \core\Mysqli::nombreDeLigneAffecte() == 1;
     \core\Mysqli::close();
     return $res;
 }
Example #10
0
 public static function getUtilisteur($login)
 {
     $query = "select * from utilisateur";
     $query .= " where login=" . \core\Mysqli::real_escape_string_html($login);
     \core\Mysqli::query($query);
     return \core\Mysqli::getObjectAndClose(false, __CLASS__);
 }
Example #11
0
 static function getAllFilmUserTitreAsc($genre)
 {
     $query = "select distinct * from ( select f.titre as titre, f.id as id, f.urlposter as poster, f.urlbackdrop as backdrop , f.infos as infos ";
     $query .= "from torrentfilm tf, film f , genrefilm g ";
     $query .= "where ( ";
     $query .= "tf.idfilm = f.id ";
     $query .= "and f.id = g.id ";
     if (!is_null($genre)) {
         $query .= "and g.label = " . \core\Mysqli::real_escape_string_html($genre);
     }
     //$query .= "and r.nom = tf.nomrtorrent ";
     $query .= " and tf.login = "******"user"]->login);
     //$query .= " and rs.nomrtorrent = r.nom ";
     $query .= " ) or ( ";
     //$query .= "tf.fini = true ";
     $query .= "tf.partageamis = true ";
     $query .= "and tf.idfilm = f.id ";
     $query .= "and f.id = g.id ";
     if (!is_null($genre)) {
         $query .= "and g.label = " . \core\Mysqli::real_escape_string_html($genre);
     }
     //$query .= "and r.nom = tf.nomrtorrent ";
     //$query .= "and rs.nomrtorrent = r.nom ";
     $query .= " and tf.login in (select login from amis a1 where a1.demandeur = " . \core\Mysqli::real_escape_string_html(\config\Conf::$user["user"]->login) . " and a1.ok = true union select demandeur from amis a2 where a2.login = "******"user"]->login) . " and a2.ok = true)";
     $query .= ") ) t ORDER BY titre ASC";
     \core\Mysqli::query($query);
     return \core\Mysqli::getObjectAndClose(true);
 }
Example #12
0
 public function updateMediainfo($mediainfo)
 {
     $this->mediainfo = json_encode($mediainfo);
     $query = "update torrentserie set ";
     $query .= "mediainfo=" . \core\Mysqli::real_escape_string_html($this->mediainfo);
     $query .= " where id=" . \core\Mysqli::real_escape_string_html($this->id);
     \core\Mysqli::query($query);
     //echo $query;
     $res = \core\Mysqli::nombreDeLigneAffecte() == 1;
     \core\Mysqli::close();
     return $res;
 }
Example #13
0
 function isql()
 {
     $querys = file_get_contents(ROOT . DS . "mysql" . DS . "mediastorrent.sql");
     $t = \core\Mysqli::multiquery($querys);
     \core\Mysqli::getObjectAndClose(false);
 }