Exemple #1
0
 function traite($id)
 {
     $t = \model\mysql\Ticket::traiteTicket($id);
     if ($t) {
         $data = json_decode($t->donnee, true);
         $cname = $data["classe"];
         $controller = new $cname($this->request, $this->debug);
         if (!in_array($data["fonction"], get_class_methods($controller))) {
             trigger_error("Le controller " . $cname . " n'a pas de méthode " . $data["fonction"]);
             $this->error("Le controller " . $cname . " n'a pas de méthode " . $data["fonction"]);
         }
         $cn = explode("\\", $cname);
         $cn = $cn[count($cn) - 1];
         $this->request->controller = strtolower($cn);
         $this->request->action = $data["fonction"];
         \config\Conf::$user["user"] = "******";
         if (call_user_func_array(array($controller, $data["fonction"]), $data["args"])) {
             $t->delete();
         }
         $controller->render($this->request->action);
         exit;
     } else {
         $this->set("url", BASE_URL);
     }
 }
Exemple #2
0
 function streaming($id)
 {
     $this->layout = "streaming";
     if ($torrentf = \model\mysql\Torrentfilm::getTorrentFilmParIdForStreaming($id)) {
         \config\Conf::$userscgi = $torrentf->userscgi;
         $req = new \model\xmlrpc\rXMLRPCRequest(\config\Conf::$userscgi, new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "f.frozen_path", array($torrentf->hash . ":f" . $torrentf->numfile)));
         if ($req->success()) {
             $filename = $req->val[0];
             if ($filename == '') {
                 $req = new \model\xmlrpc\rXMLRPCRequest(\config\Conf::$userscgi, array(new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "d.open", $torrentf->hash), new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "f.frozen_path", array($torrentf->hash . ":f" . $torrentf->numfile)), new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "d.close", $torrentf->hash)));
                 if ($req->success()) {
                     $filename = $req->val[1];
                 }
             }
             $mediainfo = json_decode($torrentf->mediainfo, true);
             $compfile = "[";
             $compfile .= strlen($torrentf->complementfichier) > 0 ? $torrentf->complementfichier . "." : "";
             switch ($mediainfo["typequalite"]) {
                 case "SD":
                     $compfile .= $mediainfo["codec"];
                     break;
                 case "HD":
                     $compfile .= $mediainfo["qualite"] . "." . $mediainfo["codec"];
                     break;
             }
             $audios = array();
             foreach ($mediainfo["audios"] as $v) {
                 $res = "";
                 if ($v["type"] !== "MP3") {
                     $res .= $v["type"] . " " . $v["cannal"];
                     if (isset($v["lang"])) {
                         $res .= " " . $v["lang"];
                     }
                 }
                 $audios[] = $res;
             }
             if (count($audios) > 1) {
                 $au = implode(".", $audios);
                 $compfile .= "." . $au . "]";
             } else {
                 $compfile .= "." . $audios[0] . "]";
             }
             $str = str_replace("'", "\\'", str_replace("&lt;", "<", $torrentf->titre . " " . $compfile . "." . pathinfo($filename, PATHINFO_EXTENSION)));
             $str = htmlentities($str, ENT_NOQUOTES, "UTF-8");
             // remplacer les entités HTML pour avoir juste le premier caractères non accentués
             // Exemple : "&ecute;" => "e", "&Ecute;" => "E", "Ã " => "a" ...
             $str = preg_replace('#&([A-za-z])(?:acute|grave|cedil|circ|orn|ring|slash|th|tilde|uml);#', '\\1', $str);
             // Remplacer les ligatures tel que : Œ, Æ ...
             // Exemple "Å“" => "oe"
             $str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\\1', $str);
             // Supprimer tout le reste
             $str = preg_replace('#&[^;]+;#', '', $str);
             $idticket = \model\mysql\Ticket::savTicket("controller\\horsligne\\Film", "download", [$id], 60 * 60 * 6);
             $this->set(array("titre" => $torrentf->titre . " " . $compfile, "src" => "http://" . $torrentf->hostname . "/ticket/traite/" . $idticket . "/" . $str));
         }
     }
     //return true;
 }
 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));
         }
     }
 }