Хранилища Subversion ant

Редакция

Редакция 470 | Авторство | Сравнить с предыдущей | Последнее изменение | Открыть журнал | Скачать | RSS

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html lang="ru">
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  <title>Генератор sources.list для apt.niX-FILES</title>
</head>
<body bgcolor="#F7F7F7">

<h1>sources.list</h1>

<?php

require_once 'DB.php';

$dsn = 'sqlite:///apt.db?mode=0777';

$db_apt =& DB::connect($dsn);
if (PEAR::isError($db_apt)) {
    die($db_apt->getMessage());
}

$dsn = 'sqlite:///set.db?mode=0777';

$db_set =& DB::connect($dsn);
if (PEAR::isError($db_set)) {
    die($db_set->getMessage());
}

$distr = abs(intval($_GET["d"]));

if($distr==0) {
        $reps =& $db_apt->query("SELECT * FROM reps");
        while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) {
            $dists =& $db_apt->query("SELECT * FROM reps2dists JOIN dists ON reps2dists.dist_id=dists.id WHERE rep_id=".$info_reps['id']);
            echo "# ".$info_reps['rep']."<br>";
            while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) {
                echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist'];
                $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']);
                while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) {
                    echo " ".$info_sects['sects.sect'];
                }
                echo "<br>";
            }
        }
}
else {
        $codename =& $db_set->getOne("SELECT codename FROM vers WHERE id=".$distr);
       
        $reps =& $db_apt->query("SELECT * FROM reps");
        while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) {
            $dists =& $db_apt->query('SELECT * FROM reps2dists JOIN dists ON reps2dists.dist_id=dists.id WHERE rep_id='.$info_reps['id'].' AND dists.dist LIKE "'.$codename.'%"');
            if ($dists->numRows()!=0) echo "# ".$info_reps['rep']."<br>";
            while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) {
                echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist'];
                $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']);
                while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) {
                    echo " ".$info_sects['sects.sect'];
                }
                echo "<br>";
            }
        }
}

//$query =& $dba->query("SET NAMES utf8");

?>

</body>
</html>