<?php
/*
    kernel.php - Output a metalink to a kernel and it's signature
    Copyright (C) 2007 A. Bram Neijt <bram@neijt.nl>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

if(isset($_SERVER['PATH_INFO']))
{
    
$fp str_replace('<'''substr($_SERVER['PATH_INFO'], 0, -9));
    
$fn basename($fp);
    require 
'md5hashes.php';    //Contains an dictionary of known MD5 hashes
    
$urls = <<<EOURLS
            <url type="http" location="al" preference="10">http://www.al.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="al" preference="20">ftp://ftp.al.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="aq" preference="10">http://www.aq.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ag" preference="10">http://www.ag.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ar" preference="10">http://www.ar.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ar" preference="20">ftp://ftp.ar.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="am" preference="10">http://www.am.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="am" preference="20">ftp://ftp.am.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="aw" preference="10">http://www.aw.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="au" preference="10">http://www.au.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="au" preference="20">ftp://ftp.au.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="at" preference="10">http://www.at.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="at" preference="20">ftp://ftp.at.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="at" preference="10">http://www.az.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="az" preference="20">ftp://ftp.az.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ax" preference="10">http://www.ax.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="bs" preference="20">ftp://ftp.ax.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="bs" preference="10">http://www.bs.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="bb" preference="10">http://www.bb.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="by" preference="10">http://www.by.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="by" preference="20">ftp://ftp.by.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="be" preference="10">http://www.be.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="be" preference="20">ftp://ftp.be.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="bz" preference="10">http://www.bz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="bm" preference="10">http://www.bm.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="bm" preference="20">ftp://ftp.bm.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="bo" preference="10">http://www.bo.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="bo" preference="20">ftp://ftp.bo.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ba" preference="10">http://www.ba.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ba" preference="20">ftp://ftp.ba.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="br" preference="10">http://www.br.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="br" preference="20">ftp://ftp.br.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="bg" preference="10">http://www.bg.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="bg" preference="20">ftp://ftp.bg.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ca" preference="10">http://www.ca.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ca" preference="20">ftp://ftp.ca.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ky" preference="10">http://www.ky.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="cl" preference="10">http://www.cl.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="cl" preference="20">ftp://ftp.cl.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="cn" preference="10">http://www.cn.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="cn" preference="20">ftp://ftp.cn.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="co" preference="10">http://www.co.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="co" preference="20">ftp://ftp.co.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="cr" preference="10">http://www.cr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="hr" preference="10">http://www.hr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="hr" preference="20">ftp://ftp.hr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="cy" preference="10">http://www.cy.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="cy" preference="20">ftp://ftp.cy.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="cz" preference="10">http://www.cz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="cz" preference="20">ftp://ftp.cz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="dk" preference="10">http://www.dk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="dk" preference="20">ftp://ftp.dk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="dm" preference="10">http://www.dm.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="do" preference="10">http://www.do.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ec" preference="10">http://www.ec.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ec" preference="20">ftp://ftp.ec.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="sv" preference="10">http://www.sv.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ee" preference="10">http://www.ee.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ee" preference="20">ftp://ftp.ee.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="fk" preference="10">http://www.fk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="fo" preference="10">http://www.fo.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="fo" preference="20">ftp://ftp.fo.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="fi" preference="10">http://www.fi.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="fi" preference="20">ftp://ftp.fi.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="fr" preference="10">http://www.fr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="fr" preference="20">ftp://ftp.fr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="gf" preference="10">http://www.gf.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="gf" preference="20">ftp://ftp.gf.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="de" preference="10">http://www.de.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="de" preference="20">ftp://ftp.de.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="gi" preference="10">http://www.gi.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="gi" preference="20">ftp://ftp.gi.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="gr" preference="10">http://www.gr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="gr" preference="20">ftp://ftp.gr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="gl" preference="10">http://www.gl.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="gl" preference="20">ftp://ftp.gl.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="gd" preference="10">http://www.gd.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="gp" preference="10">http://www.gp.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="gt" preference="10">http://www.gt.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="gy" preference="10">http://www.gy.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="gy" preference="20">ftp://ftp.gy.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ht" preference="10">http://www.ht.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="hn" preference="10">http://www.hn.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="hk" preference="10">http://www.hk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="hk" preference="20">ftp://ftp.hk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="hu" preference="10">http://www.hu.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="hu" preference="20">ftp://ftp.hu.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="is" preference="10">http://www.is.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="is" preference="20">ftp://ftp.is.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="in" preference="10">http://www.in.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="in" preference="20">ftp://ftp.in.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="id" preference="10">http://www.id.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ie" preference="10">http://www.ie.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ie" preference="20">ftp://ftp.ie.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="il" preference="10">http://www.il.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="it" preference="10">http://www.it.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="it" preference="20">ftp://ftp.it.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="jp" preference="10">http://www.jp.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="jp" preference="20">ftp://ftp.jp.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="kz" preference="10">http://www.kz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="kz" preference="20">ftp://ftp.kz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="kr" preference="10">http://www.kr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="kr" preference="20">ftp://ftp.kr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="kw" preference="10">http://www.kw.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="kg" preference="20">ftp://ftp.kw.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="kg" preference="10">http://www.kg.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="kg" preference="20">ftp://ftp.kg.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="lv" preference="10">http://www.lv.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="lv" preference="20">ftp://ftp.lv.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="li" preference="10">http://www.li.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="li" preference="20">ftp://ftp.li.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="lt" preference="10">http://www.lt.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="lt" preference="20">ftp://ftp.lt.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="lu" preference="10">http://www.lu.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="lu" preference="20">ftp://ftp.lu.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="mk" preference="10">http://www.mk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="mk" preference="20">ftp://ftp.mk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="mq" preference="10">http://www.mq.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="mx" preference="10">http://www.mx.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="mx" preference="20">ftp://ftp.mx.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="md" preference="10">http://www.md.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="md" preference="20">ftp://ftp.md.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="mc" preference="10">http://www.mc.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="mc" preference="20">ftp://ftp.mc.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="me" preference="10">http://www.me.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="me" preference="20">ftp://ftp.me.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="nl" preference="10">http://www.nl.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="nl" preference="20">ftp://ftp.nl.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="nz" preference="10">http://www.nz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="nz" preference="20">ftp://ftp.nz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ni" preference="10">http://www.ni.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="no" preference="10">http://www.no.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="no" preference="20">ftp://ftp.no.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="pa" preference="10">http://www.pa.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="py" preference="10">http://www.py.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="py" preference="20">ftp://ftp.py.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="pe" preference="10">http://www.pe.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="pe" preference="20">ftp://ftp.pe.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="pl" preference="10">http://www.pl.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="pl" preference="20">ftp://ftp.pl.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="pt" preference="10">http://www.pt.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="pt" preference="20">ftp://ftp.pt.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ro" preference="10">http://www.ro.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ro" preference="20">ftp://ftp.ro.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ru" preference="10">http://www.ru.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ru" preference="20">ftp://ftp.ru.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="pm" preference="10">http://www.pm.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="vc" preference="10">http://www.vc.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="sm" preference="10">http://www.sm.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="sm" preference="20">ftp://ftp.sm.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="rs" preference="10">http://www.rs.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="rs" preference="20">ftp://ftp.rs.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="sg" preference="10">http://www.sg.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="sg" preference="20">ftp://ftp.sg.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="sk" preference="10">http://www.sk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="sk" preference="20">ftp://ftp.sk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="si" preference="10">http://www.si.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="si" preference="20">ftp://ftp.si.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="es" preference="10">http://www.es.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="es" preference="20">ftp://ftp.es.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="sr" preference="10">http://www.sr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="sr" preference="20">ftp://ftp.sr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="sj" preference="10">http://www.sj.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="sj" preference="20">ftp://ftp.sj.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="sz" preference="10">http://www.sz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="sz" preference="20">ftp://ftp.sz.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="se" preference="10">http://www.se.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="se" preference="20">ftp://ftp.se.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ch" preference="10">http://www.ch.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ch" preference="20">ftp://ftp.ch.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="tw" preference="10">http://www.tw.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="tw" preference="20">ftp://ftp.tw.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="tj" preference="10">http://www.tj.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="tj" preference="20">ftp://ftp.tj.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="th" preference="20">ftp://ftp.th.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="tt" preference="10">http://www.tt.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="tr" preference="10">http://www.tr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="tr" preference="20">ftp://ftp.tr.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="tm" preference="10">http://www.tm.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="tm" preference="20">ftp://ftp.tm.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="tc" preference="10">http://www.tc.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ua" preference="10">http://www.ua.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ua" preference="20">ftp://ftp.ua.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="uk" preference="10">http://www.uk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="uk" preference="20">ftp://ftp.uk.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="us" preference="10">http://www.us.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="us" preference="20">ftp://ftp.us.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="uy" preference="10">http://www.uy.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="uy" preference="20">ftp://ftp.uy.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="va" preference="10">http://www.va.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="va" preference="20">ftp://ftp.va.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="ve" preference="10">http://www.ve.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="ve" preference="20">ftp://ftp.ve.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="vg" preference="10">http://www.vg.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="vg" preference="20">ftp://ftp.vg.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="vi" preference="10">http://www.vi.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="vi" preference="20">ftp://ftp.vi.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="http" location="eh" preference="10">http://www.eh.kernel.org/pub/linux%%FILEPATH%%</url>
            <url type="ftp" location="eh" preference="20">ftp://ftp.eh.kernel.org/pub/linux%%FILEPATH%%</url>

EOURLS;
    
$sigf preg_match('/.*linux-([0-9]+\.)+tar\.(bz2|gz)$/'$fn);
    
//File is here, header and output
    
header('Content-type: application/metalink+xml');
    
//header('Content-type: text/xml');
    //header('Content-type: text/plain');
    
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
?>
<metalink
  version="3.0"
  xmlns="http://www.metalinker.org/"
  origin="http://prog.infosnel.nl/metalinks/kernel.php<?php echo $fp ?>.metalink"
  generator="http://prog.infosnel.nl/metalinks/kernel.php"
  >
  <publisher>
      <name>Kernel.org</name>
      <url>http://kernel.org/</url>
  </publisher>
<files>
    <file name="<?php echo $fn ?>">
        <verification>
<?php
if($md5[$fn])
    echo 
'            <hash type="md5">'.$md5[$fn].'</hash>'."\n";
if(
$sigf)
    echo 
'            <signature file="'.$fn.'.sign" />'."\n";
?>
        </verification>
        <resources>
<?php echo str_replace('%%FILEPATH%%'$fp$urls?>
        </resources>
    </file>
<?php
if($sigf)
{
    
$fn $fn .'.sign';
    
$fp $fp .'.sign';
?>
    <file name="<?php echo $fn ?>">
        <resources>
<?php echo str_replace('%%FILEPATH%%'$fp$urls?>
        </resources>
    </file>
<?php
}
?>
</files>
</metalink>
<?php
    
die();
}

?>
<?php 
echo '<?xml version="1.0" encoding="UTF-8"?>'error_reporting(E_ALL); ini_set('display_errors''1'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Linux kernel metalink generator: The metalink for all kernel.org files</title>
<link rel="shortcut icon" href="http://prog.infosnel.nl/metalinks/img/small-meta.png" type="image/png" />
<link rel="Top"  href="/" title="Top" />
<link rel="stylesheet" type="text/css" href="http://lib.infosnel.nl/main.css" /><meta name="dc.date" content="2006-10-22" /><meta name="dc.creator" content="Infosnel.nl" /><meta name="language" content="en" /><meta name="dc.modified" content="2007-09-28" /><meta name="author" content="Infosnel.nl" /><meta name="lang" content="en" /><meta name="copyright" content="Copyright (C) Infosnel.nl" />
</head><body>
<div id="navbar" class="center"><script type="text/javascript"><!--
google_ad_client = "pub-7399904085557293";
google_alternate_ad_url = "http://lib.infosnel.nl/collapse.html";
google_ad_width = 728;
google_ad_height = 15;
google_ad_format = "728x15_0ads_al";
google_ad_channel ="9610297870";
google_color_border = "3366CC";
google_color_bg = "E5ECF9";
google_color_link = "0000CC";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div><div class="center"><h1>Linux kernel metalink generator</h1><em> The <a href="http://metalinker.org/" target="_blank">metalink</a> for all <a href="http://kernel.org" target="_blank">Kernel.org</a> files,<br /> see <a href="http://metamirrors.nl/">metamirrors</a> for more.</em></div>
<table><tr>
<td id="ads"><br /></td>
<td id="content"><script type="text/javascript"><!--
function kversion()
{
    var l = document.getElementById('link');
    var v = document.getElementById('version').value;

    //Don't update on emtpy string
    if(v.length == 0)
        return;

    //Update and set colours
    document.getElementById('version').className = "blue";
    document.getElementById('path').className = "";

    var va = v.split('.');
    l.value = "http://prog.infosnel.nl/metalinks/kernel.php/kernel/v"+va[0]+"."+va[1]+"/linux-"+v+".tar.bz2.metalink";
    
    document.getElementById('gobutton').disabled = false;
}
function kpath()
{
    var l = document.getElementById('link');
    var v = document.getElementById('path').value;
    
    //Don't update on emtpy string
    if(v.length == 0)
        return;

    //Update and set colours
    document.getElementById('version').className = "";
    document.getElementById('path').className = "blue";

    var idx = v.indexOf("/pub/linux/");
    l.value = "http://prog.infosnel.nl/metalinks/kernel.php/"+v.substr(idx + 11)+".metalink";
    
    document.getElementById('gobutton').disabled = false;
}
//--></script>
<div class="center">
<h2>Either</h2>
<p>type in the kernel version:<br />
    <input type="text" id="version" onchange="kversion()" onclick="kversion()" /><br />
    <small>Example: 2.6.18.1</small>
</p>
<h2>Or</h2>
<p>type in the file url at kernel.org:<br />
<input type="text" id="path" value="http://www.kernel.org/pub/linux/" size="100" onchange="kpath()" onclick="kpath()" /><br />
<small>Example: http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.1.tar.bz2</small>
</p>
<h2>And then</h2>
<p>a metalink link will be ready at this address:
<br />
<input type="text" id="link" size="100" />
<input type="button" id="gobutton" value="Go" disabled="true" onclick="window.location = document.getElementById('link').value" /></p>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p class="center silver">v0.0.5 <a href="kernel.phps">src</a></p>
<p>&nbsp;</p>
</td>
<td id="right"></td>
</tr></table>

<div id="copyblock">Last update: September 28 2007<br /><small>[<a href="http://www.infosnel.nl/contact.php">Contact</a>] [<a href="http://validator.w3.org/check?uri=referer">XHTML</a>]<br />Copyright &copy; <a href="http://www.infosnel.nl">Infosnel.nl</a></small></div>
</body>
</html>