예제 #1
0
 static function authentificationPourRtorrent($keyconnexion)
 {
     if (!is_null($keyconnexion)) {
         $u = \core\Memcached::value($keyconnexion, "user");
         if (is_null($u)) {
             $u = \model\mysql\Utilisateur::authentifierUtilisateurParKeyConnexion($keyconnexion);
             if ($u) {
                 \core\Memcached::value($u->keyconnexion, "user", $u, 60 * 2);
             }
         } else {
             $u = $u->keyconnexion === $keyconnexion ? $u : false;
             if (is_bool($u)) {
                 $u = \model\mysql\Utilisateur::authentifierUtilisateurParKeyConnexion($keyconnexion);
                 if ($u) {
                     \core\Memcached::value($u->keyconnexion, "user", $u, 60 * 2);
                 }
             } else {
                 \core\Memcached::value($u->keyconnexion, "user", $u, 60 * 2);
             }
         }
         \config\Conf::$user["user"] = $u;
         if ($u && !is_null($u)) {
             setcookie("keyconnexion", $u->keyconnexion, strtotime('+1 days'), "/");
             $userscgi = \model\mysql\Rtorrent::getUserscgiDeUtilisateur($u->login);
             if (!$userscgi) {
                 throw new \Exception("Aucun ports scgi sur " . HOST);
             }
             \config\Conf::$userscgi = $userscgi[0]->userscgi;
         }
     }
 }
예제 #2
0
 function modifierMdp($login, $mdp)
 {
     if (isset($login) && isset($mdp)) {
         $res = \model\mysql\Utilisateur::modifierMotDePasse($login, $mdp);
         $this->set("modifiermdp", $res);
         $this->render("index");
         return $res;
     } else {
         header("Location: " . BASE_URL);
         exit;
     }
 }
예제 #3
0
 function create()
 {
     if (!(isset($_REQUEST["login"]) && isset($_REQUEST["mail"]) && isset($_REQUEST["role"]))) {
         throw new \Exception("Manque les variables post");
     }
     $mdp = \model\simple\Utilisateur::getRandomMdp();
     $options = null;
     if (isset($_REQUEST["vlc"])) {
         $options["vlc"] = true;
     }
     if (!\model\mysql\Utilisateur::insertUtilisateur($_REQUEST["login"], $mdp, $_REQUEST["role"], $_REQUEST["mail"], $options)) {
         throw new \Exception("Impossible d'enregistrer cet utilisateur");
     }
     Mail::creationCompte($_REQUEST["mail"], $_REQUEST["login"], $mdp);
 }
예제 #4
0
 function mysqlinit()
 {
     $this->layout = "install";
     /*if (isset($_REQUEST["hostmysql"]) && isset($_REQUEST["loginmysql"]) && isset($_REQUEST["passmysql"])) {
                 $querys = file_get_contents(ROOT . DS . "mysql" . DS . "mediastorrent.sql");
                 \core\Mysqli::initmultiquery($_REQUEST["hostmysql"], $_REQUEST["loginmysql"], $_REQUEST["passmysql"], $querys);
                 \model\simple\MakerConf::makerConfSavBDD($_REQUEST["hostmysql"], $_REQUEST["loginmysql"], $_REQUEST["passmysql"]);
     
             } else*/
     if (isset($_REQUEST["login"]) && isset($_REQUEST["pass"]) && isset($_REQUEST["mail"])) {
         $res = \model\mysql\Utilisateur::insertUtilisateurSysop($_REQUEST["login"], $_REQUEST["pass"], $_REQUEST["mail"]);
         \model\simple\MakerConf::makerConfEnd();
         $this->set("res", $res);
     }
 }
예제 #5
0
 function delRtorrent($login)
 {
     $res = null;
     $err = false;
     try {
         \model\bash\Utilisateur::delRtorrent($login);
     } catch (\Exception $e) {
         \model\simple\Console::println($e->getMessage());
         $err = true;
     }
     $res["system"] = \model\simple\Console::$query;
     if ($err) {
         $us = \model\mysql\Utilisateur::getAllUtilisateurSysop();
         foreach ($us as $u) {
             Mail::infosSysopErreurAdjRtorrent($u->mail, $res);
         }
     }
     return $res;
 }
예제 #6
0
 function mdpoublier()
 {
     if (isset($_POST["mail"])) {
         $u = \model\mysql\Utilisateur::getUtilisateurParMail($_POST["mail"]);
         if ($u) {
             $mdp = \model\simple\Utilisateur::getRandomMdp();
             $args["login"] = $u->login;
             $args["mdp"] = $mdp;
             $t = \model\mysql\Ticket::savTicket("controller\\horsligne\\Utilisateur", "modifierMdp", $args);
             $f = false;
             if (!is_bool($t)) {
                 $f = \model\simple\Mail::activationMotDePasse($u->mail, $u->login, $mdp, $t);
             }
             $this->set(array("succereinitialmdp" => $f));
             $this->render("index");
         } else {
             $this->set(array("erreur" => true));
         }
     }
 }
예제 #7
0
 function roleUser()
 {
     foreach (Conf::$numerorole as $k => $v) {
         if (is_array($v)) {
             foreach ($v as $kk => $vv) {
                 Conf::$rolenumero[$vv] = $k;
             }
         } else {
             Conf::$rolenumero[$v] = $k;
         }
     }
     /*$a["zzz"]="sssd";
       $a["zdz"]= new \model\xmlrpc\rTorrent();
       //Memcached::value("deb","ddd",$a);
       Memcached::value("deb","ddd");
       Memcached::value("deb1","ddd");*/
     $u = null;
     if (isset($_COOKIE["keyconnexion"])) {
         if (extension_loaded("memcached")) {
             $u = Memcached::value($_COOKIE["keyconnexion"], "user");
         }
         if (is_null($u)) {
             $u = \model\mysql\Utilisateur::authentifierUtilisateurParKeyConnexion($_COOKIE["keyconnexion"]);
             if ($u) {
                 \core\Memcached::value($_COOKIE["keyconnexion"], "user", $u, 60 * 5);
             }
         } else {
             $u = $u->keyconnexion === $_COOKIE["keyconnexion"] ? $u : false;
         }
     }
     $role = 1;
     $roletext = "Visiteur";
     if ($u && !is_null($u)) {
         $role = Conf::$rolenumero[$u->role];
         $roletext = $u->role;
         \core\Memcached::value($_COOKIE["keyconnexion"], "user", $u, 60 * 5);
         setcookie("keyconnexion", $u->keyconnexion, strtotime('+1 days'), "/");
     }
     Conf::$user["user"] = $u;
     Conf::$user["role"] = $role;
     Conf::$user["roletxt"] = $roletext;
     if ($u) {
         LoaderJavascript::add("base", "controller.setUtilisateur", array(Conf::$user["user"]->login, Conf::$user["user"]->keyconnexion, Conf::$user["user"]->role));
     }
 }
예제 #8
0
 static function make($host, $login, $password, $vgok, $vgname)
 {
     \config\Conf::$databases["default"]["host"] = $host;
     \config\Conf::$databases["default"]["database"] = "mediastorrent";
     \config\Conf::$databases["default"]["login"] = $login;
     \config\Conf::$databases["default"]["password"] = $password;
     $u = \model\mysql\Utilisateur::getAllUtilisateur();
     \config\Conf::$install = count($u) === 0 ? true : false;
     \config\Conf::$nomvg = $vgok ? $vgname : NULL;
     $content = MakerConf::maker();
     file_put_contents(ROOT . DS . "config" . DS . "Conf.php", $content);
 }
예제 #9
0
    if (file_exists($filename)) {
        require_once $filename;
    } else {
    }
}
//Retour visuel
\config\Conf::$debuglocalfile = false;
if ($argc == 7) {
    $login = $argv[1];
    $pass = $argv[2];
    $mail = $argv[3];
    $url = $argv[4];
    $nomrtorrent = $argv[5];
    $scgi = $argv[6];
    \model\simple\Console::println("Insertion de l'utilisateur");
    \model\simple\Console::println("Login :[" . $login . "]");
    \model\simple\Console::println("Password :[" . $pass . "]");
    \model\simple\Console::println("Mail :[" . $mail . "]");
    $res = \model\mysql\Utilisateur::insertUtilisateurSysop($login, $pass, $mail);
    \model\simple\Console::println($res);
    $res = \model\mysql\Rtorrent::addRtorrentServeur1($nomrtorrent, $url);
    \model\simple\Console::println("Initialisation du rtorrent");
    \model\simple\Console::println($res);
    $res = \model\mysql\Rtorrents::addRtorrentUtilisateurScgi($login, $nomrtorrent, $scgi);
    \model\simple\Console::println("Ajout de la seedbox " . $nomrtorrent . " à " . $login . " scgi " . $scgi);
    \model\simple\Console::println($res);
    \model\simple\Console::println("Log des requête sql :");
    \model\simple\Console::println(\core\Mysqli::$query);
} else {
    \model\simple\Console::println(basename(__FILE__) . " <login> <pass> <mail> <url accé a mediastorrent pour ce serveur sans le http exemple pour http://localhost/Mediastorrent il faut mettre localhost/Mediastorrent > <nomrtorrent> <portscgi le même qui est dans ~/.rtorrent.rc>");
}
예제 #10
0
 function trackerUptorrent($user)
 {
     \core\Mysqli::$default = "gazelle";
     $u = Utilisateur::getUtilisteur($user);
     if ($u) {
         \config\Conf::$torrentpass = $u->torrentpass;
         if (isset($_FILES["torrent"])) {
             if ($_FILES["torrent"]["error"] > 0) {
             } else {
                 $torrent = new Torrent(file_get_contents($_FILES["torrent"]["tmp_name"]));
                 if (!$torrent->errors()) {
                     $torrent->is_private(true);
                     $torrent->announce("");
                     $hash = pack("H*", $torrent->hash_info());
                     $a = \model\mysql\Torrents::insertTorrent($hash, $torrent->__toString());
                     if (!is_bool($a)) {
                         $az = \model\ocelot\Requete::addTorrent($a, $hash, "0");
                     }
                 }
             }
         }
     } else {
         throw new \Exception("Pas d'utilisateur");
     }
 }