} else {
if ($useExternal === false) {
$useExternal = "inner";
}
}
$task = new rTask(array('arg' => call_user_func('getFileName', $path_edit), 'requester' => 'create', 'name' => 'create', 'path_edit' => $_REQUEST['path_edit'], 'trackers' => $_REQUEST['trackers'], 'comment' => $_REQUEST['comment'], 'start_seeding' => $_REQUEST['start_seeding'], 'piece_size' => $_REQUEST['piece_size'], 'private' => $_REQUEST['private']));
$commands = array();
$commands[] = escapeshellarg($rootPath . '/plugins/create/' . $useExternal . '.sh') . " " . $task->id . " " . escapeshellarg(getPHP()) . " " . escapeshellarg($pathToCreatetorrent) . " " . escapeshellarg($path_edit) . " " . $piece_size . " " . escapeshellarg(getUser()) . " " . escapeshellarg(rTask::formatPath($task->id));
$commands[] = '{';
$commands[] = 'chmod a+r "${dir}"/result.torrent';
$commands[] = '}';
$ret = $task->start($commands, 0);
break;
} else {
$error = 'Incorrect directory (' . mb_substr($path_edit, mb_strlen($topDirectory) - 1) . ')';
}
}
$ret = array("no" => -1, "pid" => 0, "status" => 255, "log" => array(), "errors" => array($error));
break;
case "getfile":
$dir = rTask::formatPath($_REQUEST['no']);
$torrent = new Torrent($dir . "/result.torrent");
if (!$torrent->errors()) {
$torrent->send();
} else {
header('HTTP/1.0 404 Not Found');
}
exit;
}
}
cachedEcho(safe_json_encode($ret), "application/json");