function download($hashtorrentselectionne, $nofile, $keyconnexion = null) { \model\simple\Utilisateur::authentificationPourRtorrent($keyconnexion); if (!\config\Conf::$user["user"]) { throw new \Exception("Non User"); } $req = new \model\xmlrpc\rXMLRPCRequest(\config\Conf::$userscgi, new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "f.frozen_path", array($hashtorrentselectionne . ":f" . $nofile))); 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", $hashtorrentselectionne), new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "f.frozen_path", array($hashtorrentselectionne . ":f" . $nofile)), new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, "d.close", $hashtorrentselectionne))); if ($req->success()) { $filename = $req->val[1]; } } \model\simple\Download::sendFile($filename); } throw new \Exception("FILE NOT FOUND"); }
function download($id, $keyconnexion = null) { \model\simple\Utilisateur::authentificationDistante($keyconnexion); if (!\config\Conf::$user["user"]) { throw new \Exception("Non User"); } if ($torrentf = \model\mysql\Torrentserie::getSerieUserDuServeur($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] . "]"; } $compfile .= "]"; $tmp = \model\simple\Download::sendFileName($mediainfo["filename"], $torrentf->titre . " Saison " . $torrentf->saison . " Épisode " . $torrentf->episode . " " . $compfile); //} } else { if ($torrentf = \model\mysql\Torrentserie::getAdresseServeurSerieUser($id)) { //echo ('Location: http'.($_SERVER["SERVER_PORT"] == 80 ? "" : "s") . "://" . $torrentf->hostname."/film/download/".$id."/".\config\Conf::$user["user"]->login."/".\config\Conf::$user["user"]->keyconnexion); //die(); header('Location: http' . ($_SERVER["SERVER_PORT"] == 80 ? "" : "s") . "://" . $torrentf->hostname . "/film/download/" . $id . "/" . \config\Conf::$user["user"]->login . "/" . \config\Conf::$user["user"]->keyconnexion); exit; } else { throw new \Exception("FILE NOT FOUND"); } } }