= "4.0.0") { header("Location: http://{$users[$user]['ip']}" . ($users[$user]['port'] ? ":{$users[$user]['port']}" : "") . "/{$version}/{$_GET['file']}"); } else { header("Location: http://{$users[$user]['ip']}" . ($users[$user]['port'] ? ":{$users[$user]['port']}" : "") . (isset ($_GET['file']) ? "/file/{$_GET['file']}" : "?{$_SERVER['QUERY_STRING']}")); } exit; } } if (is_dir("{$config['download']}{$version}/{$userpath}")) { // addonliste zurückgebe listaddons("{$config['download']}{$version}/{$userpath}", $config['download']); } function listaddons($path, $dir) { $db = new Database ("data", $GLOBALS['config']['db']); $groupstates = array(); if ($d = @dir($path)) { while ($f = $d->read()) { if (is_dir($d->path . $f) && $f != "." && $f != "..") { listaddons($d->path . $f . "/", $dir); } else if (is_file($d->path . $f) && preg_match("/\d{2}_?MLD.*\.tgz$|MLD.*\.sfs$|MLD.*\.gz$/", $f, $erg) && (isset ($_GET['extra']) && $_GET['extra'] == "all" || !preg_match("/_" . implode("-|_", $GLOBALS['config']['extra_addons']) . "-/", $f, $erg)) ) { $state = 0; if ($db->query("SELECT state from state WHERE filename='$f'")) { $state = $db['state']; } if ($state == 0 && preg_match("/.+-.+_(.+)-(.+)_(.+)-.+_.+\.sfs/", $f, $erg)) { if (!isset ($groupstates[$erg[1]])) { if ($db->query("SELECT state FROM state WHERE name='$erg[1]' AND state>0 AND version LIKE '$erg[2]_%'")) { $groupstates[$erg[1]] = $db['state']; } else { $groupstates[$erg[1]] = 0; } } if ($groupstates[$erg[1]] > 0 && $db->query("SELECT state, version FROM state WHERE name='$erg[3]' AND state>0 ORDER BY version DESC LIMIT 1")) { $state = $groupstates[$erg[1]]; } } if (empty ($_GET['class']) || $_GET['class'] == "all" || $_GET['class'] == "devel" && $state >= 0 || $_GET['class'] == "stable" && $state > 0) { echo "http://" . $_SERVER['SERVER_NAME'] . "/download.php?file=" . substr($d->path . $f . "\n", strlen($dir)); } } } $d->close(); } } ?>