return $string; } if ($_REQUEST["ajax"] == 1) { if ($_REQUEST["randomize"] == 1) { echo md5(microtime()); } if ($_REQUEST["installStep"] == 1) { echo "Sputnik startet, der Countdown läuft, bitte warten...<br />"; } if ($_REQUEST["installStep"] == 2) { // call to PLESK API to create DB was removed here, feel free to add it as you like downloadFile("http://www.download.oxid-esales.com.server675-han.de-nserver.de/ce/index.php", "oxid.zip"); echo "Aktuelle OXID Version wurde heruntergeladen<br />"; } if ($_REQUEST["installStep"] == 3) { unpackFile("oxid.zip"); echo "Daten wurde extrahiert, die Installation beginnt<br />"; } if ($_REQUEST["installStep"] == 5) { chmodRec(dirname(__FILE__) . "/tmp/", 0777, 0777); chmodRec(dirname(__FILE__) . "/export/", 0777, 0777); chmod(dirname(__FILE__) . '/.htaccess', 0777); chmod(dirname(__FILE__) . "/config.inc.php", 0777); chmodRec(dirname(__FILE__) . "/log/", 0777, 0777); chmodRec(dirname(__FILE__) . "/out/", 0777, 0777); $config = file_get_contents(dirname(__FILE__) . "/config.inc.php"); $config = str_replace("<dbHost_ce>", $_REQUEST["host"], $config); $config = str_replace("<dbName_ce>", $_REQUEST["name"], $config); $config = str_replace("<dbUser_ce>", $_REQUEST["user"], $config); $config = str_replace("<dbPwd_ce>", $_REQUEST["pass"], $config); $config = str_replace("<sShopURL_ce>", "http://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]), $config);
break; case "deleteDir": $path = filter_input(INPUT_GET, "path"); delete_directory($path); exit; break; case "makeDir": $path = filter_input(INPUT_GET, "path") == "" ? "" : filter_input(INPUT_GET, "path") . "/"; $name = filter_input(INPUT_GET, "name"); mkdir(__DIR__ . "/" . $path . $name, 0755); exit; break; case "unpack": $path = filter_input(INPUT_GET, "path"); $file = filter_input(INPUT_GET, "file"); unpackFile($file, $path); exit; break; case "pack": $path = filter_input(INPUT_GET, "path"); $file = filter_input(INPUT_GET, "file") . ".zip"; packDir($path, $file); exit; break; case "changeChmod": $path = filter_input(INPUT_GET, "path"); $recursively = filter_input(INPUT_GET, "recursively") == "true"; $filesChange = filter_input(INPUT_GET, "filesChange") == "true"; $foldersChange = filter_input(INPUT_GET, "foldersChange") == "true"; $filesPerm = filter_input(INPUT_GET, "filesPerm"); $foldersPerm = filter_input(INPUT_GET, "foldersPerm");
private function getModpack($output, $modpackSlug, $modpackBuild) { if ($modpackSlug == '' || $modpackBuild == '') { throw new \InvalidArgumentException('Invalid arguments'); } $apiClient = new Client(); $appConfig = solder_config(); if ($modpackBuild == 'latest' || $modpackBuild == 'recommended') { $apiResponse = $apiClient->get($appConfig->api . '/modpack/' . $modpackSlug)->json(); $modpackBuild = $apiResponse[$modpackBuild]; } $apiResponse = $apiClient->get($appConfig->api . '/modpack/' . $modpackSlug . '/' . $modpackBuild)->json(); if (isset($apiResponse['error'])) { throw new \Exception($apiResponse['error']); } if (!is_dir($modpackSlug . '-' . $modpackBuild)) { $output->writeln("creating: {$modpackSlug}-{$modpackBuild}" . DIRECTORY_SEPARATOR); mkdir($modpackSlug . '-' . $modpackBuild); } foreach ($apiResponse['mods'] as $mod) { $url = $mod['url']; $filename = basename($url); $md5 = $mod['md5']; downloadFile($url, $modpackSlug . '-' . $modpackBuild . DIRECTORY_SEPARATOR . $filename, $output, $md5); unpackFile($modpackSlug . '-' . $modpackBuild . DIRECTORY_SEPARATOR . $filename, $output); } }