$path_edit = trim($request['path_edit']);
$piece_size = $request['piece_size'];
$callback_log = create_function('$msg', '$fp=fopen("php://stdout","w"); fputs($fp, $msg."\\n"); fclose($fp);');
$callback_err = create_function('$msg', '$fp=fopen("php://stderr","w"); fputs($fp, $msg."\\n"); fclose($fp);');
if (count($announce_list) > 0) {
$torrent = new Torrent($path_edit, $announce_list[0][0], $piece_size, $callback_log, $callback_err);
if ($trackersCount > 1) {
$torrent->announce_list($announce_list);
}
} else {
$torrent = new Torrent($path_edit, array(), $piece_size, $callback_log, $callback_err);
}
if (isset($request['comment'])) {
$comment = trim($request['comment']);
if (strlen($comment)) {
$torrent->comment($comment);
}
}
if ($request['private']) {
$torrent->is_private(true);
}
$fname = rTask::formatPath($taskNo) . '/result.torrent';
$torrent->save($fname);
if ($request['start_seeding']) {
$fname = getUniqueUploadedFilename($torrent->info['name'] . '.torrent');
$path_edit = trim($request['path_edit']);
if (is_dir($path_edit)) {
$path_edit = addslash($path_edit);
}
if (rTorrentSettings::get()->correctDirectory($path_edit)) {
$path_edit = dirname($path_edit);