Esempio n. 1
0
 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");
 }