$secretQuestion = trim($_POST['SecretQuestion']); $secretAnswer = trim($_POST['SecretAnswer']); } // Make sure they are posting // back the information if (!empty($userName) && !empty($passWord) && !empty($module) && !empty($location) && !empty($secretQuestion) && !empty($secretAnswer)) { //create download directory if it doesn't exist if (!file_exists($location)) { mkdir($location); } $installed = true; require_once 'lib/configuration.php'; // set up the configuration.xml $configuration = new Configuration($location, $module, 0, 0, 6, 4, 10, 60000, 60000); // write out the configuration.xml if (!config_setConfiguration($configuration)) { $message .= "The configuration XML file could not be written.<br />"; $installed = false; } //Check to see if the user information provided can be used to create a site admin if (user_createUser(new User($userName, $passWord, $secretQuestion, $secretAnswer, "Admin")) === 'file error') { $message .= "The users XML file could not be written.<br />"; $installed = false; } //check to see if the torrents.xml file is able to be written if (!torrent_createFile()) { $message .= "The torrents XML file could not be written.<br />"; $installed = false; } } else { if ($_POST) {
} // If everything went fine, we can save everything. if (empty($errors)) { //write settings to XML $xmlConfig->setDownloadLocation($_POST['downloadLocation']); $xmlConfig->setTorrentModule($_POST['torrentModule']); $xmlConfig->setMaxDownloadSpeed($_POST['maxDownloadSpeed']); $xmlConfig->setMaxUploadSpeed($_POST['maxUploadSpeed']); $xmlConfig->setMaxDownloads($_POST['maxDownloads']); $xmlConfig->setMaxUploads($_POST['maxUploads']); $xmlConfig->setMaxActiveTorrents($_POST['maxActiveTorrents']); $xmlConfig->setTcpPort($_POST['tcpPort']); $xmlConfig->setUdpPort($_POST['udpPort']); $xmlConfig->setHideOtherUsers($_POST['hideOtherUsers']); $xmlConfig->setAllowDirectDownload($_POST['allowDirectDownload']); config_setConfiguration($xmlConfig); //write settings to Torrent Module require_once '../lib/torrent_module_loader.php'; $torrentModule = new TorrentFunctions('localhost'); $torrentModule->writeSetting(TorrentSetting::MaxDownloadSpeed, $_POST['maxDownloadSpeed']); $torrentModule->writeSetting(TorrentSetting::MaxUploadSpeed, $_POST['maxUploadSpeed']); $torrentModule->writeSetting(TorrentSetting::MaxDownloads, $_POST['maxDownloads']); $torrentModule->writeSetting(TorrentSetting::MaxUploads, $_POST['maxUploads']); $torrentModule->writeSetting(TorrentSetting::MaxActiveTorrents, $_POST['maxActiveTorrents']); $torrentModule->writeSetting(TorrentSetting::TcpPort, $_POST['tcpPort']); $torrentModule->writeSetting(TorrentSetting::UdpPort, $_POST['udpPort']); ?> <div id="divStatus">Settings saved.</div> <br />