foreach ($ExtraTorrents as $ExtraTorrent) {
    $Name = $ExtraTorrent['Name'];
    $ExtraTorrentsInsert[$Name] = $ExtraTorrent;
    $ThisInsert =& $ExtraTorrentsInsert[$Name];
    $ExtraTor = new BencodeTorrent($Name, true);
    if (isset($ExtraTor->Dec['encrypted_files'])) {
        $Err = 'At least one of the torrents contain an encrypted file list which is not supported here';
        break;
    }
    if (!$ExtraTor->is_private()) {
        $ExtraTor->make_private();
        // The torrent is now private.
        $PublicTorrent = true;
    }
    // File list and size
    list($ExtraTotalSize, $ExtraFileList) = $ExtraTor->file_list();
    $ExtraDirName = isset($ExtraTor->Dec['info']['files']) ? Format::make_utf8($ExtraTor->get_name()) : '';
    $ExtraTmpFileList = array();
    foreach ($ExtraFileList as $ExtraFile) {
        list($ExtraSize, $ExtraName) = $ExtraFile;
        check_file($Type, $ExtraName);
        // Make sure the file name is not too long
        if (mb_strlen($ExtraName, 'UTF-8') + mb_strlen($ExtraDirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) {
            $Err = "The torrent contained one or more files with too long of a name: <br />{$ExtraDirName}/{$ExtraName}";
            break;
        }
        // Add file and size to array
        $ExtraTmpFileList[] = Torrents::filelist_format_file($ExtraFile);
    }
    // To be stored in the database
    $ThisInsert['FilePath'] = db_string($ExtraDirName);
Exemple #2
0
if ($DB->has_results()) {
    list($ID) = $DB->next_record();
    $DB->query("\n\t\tSELECT TorrentID\n\t\tFROM torrents_files\n\t\tWHERE TorrentID = {$ID}");
    if ($DB->has_results()) {
        $Err = '<a href="torrents.php?torrentid=' . $ID . '">The exact same torrent file already exists on the site!</a>';
    } else {
        // A lost torrent
        $DB->query("\n\t\t\tINSERT INTO torrents_files (TorrentID, File)\n\t\t\tVALUES ({$ID}, '{$TorEnc}')");
        $Err = '<a href="torrents.php?torrentid=' . $ID . '">Thank you for fixing this torrent</a>';
    }
}
if (isset($Tor->Dec['encrypted_files'])) {
    $Err = 'This torrent contains an encrypted file list which is not supported here.';
}
// File list and size
list($TotalSize, $FileList) = $Tor->file_list();
$NumFiles = count($FileList);
$HasLog = 0;
$HasCue = 0;
$TmpFileList = array();
$TooLongPaths = array();
$DirName = isset($Tor->Dec['info']['files']) ? Format::make_utf8($Tor->get_name()) : '';
$IgnoredLogFileNames = array('audiochecker.log', 'sox.log');
check_name($DirName);
// check the folder name against the blacklist
foreach ($FileList as $File) {
    list($Size, $Name) = $File;
    // add +log to encoding
    if ($T['Encoding'] == "'Lossless'" && !in_array($Name, $IgnoredLogFileNames) && substr($Name, -4, 4) === '.log') {
        $HasLog = 1;
    }