<?php if (!is_writable($torrent->thisDir())) { echo "<span class=\"error\">Directory is not writable!</span> - CHMOD to 0777"; } else { echo "<span class=\"success\">Directory is writable!</span>"; $stage[] = 1; } if (count($stage) > 0) { ?> </li> <li>Setting up file structure... <?php if (!is_dir($CONFIG['torrent_folder'])) { mkdir($CONFIG['torrent_folder']); chmod($CONFIG['torrent_folder'], 0777); $torrent->write("FORBIDDEN", $CONFIG['torrent_folder'] . "/index.html"); chmod($CONFIG['torrent_folder'] . "/index.html", 0666); if (!is_numeric($CONFIG['torrent_id_length']) || (int) $CONFIG['torrent_id_length'] < 0) { $CONFIG['torrent_id_length'] = 1; } if ($CONFIG['torrent_id_length'] > 32) { $CONFIG['torrent_id_length'] = 32; } $token = $torrent->token(TRUE, TRUE); $data = $torrent->serializer(array($CONFIG['torrent_id_length'])); if ($torrent->write($data, $torrent->setDataPath($token, TRUE) . "/" . $token)) { chmod($torrent->setDataPath($token, TRUE) . "/" . $token, 0666); echo "<span class=\"success\">Structure created!</span>"; $stage[] = 2; } else { echo "<span class=\"error\">Failed</span> - Is directory '" . $CONFIG['torrent_folder'] . "' writable?";