$v) { $getvar = get("$key"); $list = implode(", ", $v); if (in_array($getvar, $v)) { $out = array($key => $getvar); }else{ $out = array("Error" => "Error $key: $getvar - not in list - $list"); break; } } return $out; } $source = $debug = false; $release = get('release'); $arch = get('arch'); $section = get('section'); $repo = get('repo'); $debug = get('debug'); $source = get('source'); $wsd = new Downloads(); $dl = $wsd->prepare_download(true, null); $arraycheck =array( 'release' => array('5', '6', 'cauldron'), 'arch' => array('i586', 'x86_64', 'SRPMS', 'armv5tl', 'armv7hl'), 'section' => array('core', 'nonfree', 'tainted'), 'repo' => array('release', 'updates', 'updates_testing', 'backports', 'backports_testing'), ); if ($source){ $link = "MIRROR/distrib/$release/SRPMS/media/$section/$repo/"; }elseif ($debug){ $link = "MIRROR/distrib/$release/$arch/media/debug/$section/$repo/"; }else{ $link = "MIRROR/distrib/$release/$arch/media/$section/$repo/"; } if ($release && $arch && $section && $repo){ $out = str_replace('MIRROR', $dl['mirror_url'], $link); //$out = check($arraycheck); //print_r($out); }else{ $out = "Invalid options"; } echo $out;