예제 #1
0
					"error":		"E01",
					"message":		"Please select a valid .torrent File!"
					}');
        }
        break;
    default:
        $file_ID = $requri;
        $gz = NULL;
        if ($CONFIG['torrent_gzip']) {
            $gz = ".gz";
        }
        if (!file_exists($torrent->setDataPath($file_ID . ".torrent") . $gz)) {
            die('.torrent file not found... ');
        }
        $file = $torrent->setDataPath($file_ID . ".torrent") . $gz;
        if (!$torrent->checkFileNoExpire($file)) {
            die('File has expired...');
        }
        touch($file);
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Cache-Control: private", false);
        if ($CONFIG['torrent_gzip']) {
            header('Content-Encoding: gzip');
        }
        header("Content-Type: application/x-bittorrent");
        header("Content-Disposition: attachment; filename=" . strtoupper(sha1(md5($file_ID . ".torrent"))) . ".torrent");
        header("Content-Transfer-Encoding: binary");
        if ($CONFIG['torrent_gzip']) {
            $output = $torrent->decompressFile(file_get_contents($file));