Редакция 470 | Редакция 480 | К новейшей редакции | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 470 | Редакция 471 | ||
---|---|---|---|
- | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd"> |
|
- | 2 | <html lang="ru"> |
|
- | 3 | <head> |
|
- | 4 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> |
|
- | 5 | <title>Генератор sources.list для apt.niX-FILES</title> |
|
- | 6 | </head> |
|
- | 7 | <body bgcolor="#F7F7F7"> |
|
- | 8 | ||
- | 9 | <h1>sources.list</h1> |
|
- | 10 | ||
1 | <?php
|
11 | <?php
|
2 | 12 | ||
3 | require_once 'DB.php'; |
13 | require_once 'DB.php'; |
4 | 14 | ||
5 | $dsn = 'sqlite:///apt.db?mode=0777'; |
15 | $dsn = 'sqlite:///apt.db?mode=0777'; |
6 | 16 | ||
7 | $db_apt =& DB::connect($dsn); |
17 | $db_apt =& DB::connect($dsn); |
8 | if (PEAR::isError($db_apt)) { |
18 | if (PEAR::isError($db_apt)) { |
9 | die($db_apt->getMessage()); |
19 | die($db_apt->getMessage()); |
10 | }
|
20 | }
|
11 | 21 | ||
12 | $dsn = 'sqlite:///set.db?mode=0777'; |
22 | $dsn = 'sqlite:///set.db?mode=0777'; |
13 | 23 | ||
14 | $db_set =& DB::connect($dsn); |
24 | $db_set =& DB::connect($dsn); |
15 | if (PEAR::isError($db_set)) { |
25 | if (PEAR::isError($db_set)) { |
16 | die($db_set->getMessage()); |
26 | die($db_set->getMessage()); |
17 | }
|
27 | }
|
18 | 28 | ||
19 | $distr = abs(intval($_GET["d"])); |
29 | $distr = abs(intval($_GET["d"])); |
20 | 30 | ||
21 | if($distr==0) { |
31 | if($distr==0) { |
22 | $reps =& $db_apt->query("SELECT * FROM reps"); |
32 | $reps =& $db_apt->query("SELECT * FROM reps"); |
23 | while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) { |
33 | while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) { |
24 | $dists =& $db_apt->query("SELECT * FROM reps2dists JOIN dists ON reps2dists.dist_id=dists.id WHERE rep_id=".$info_reps['id']); |
34 | $dists =& $db_apt->query("SELECT * FROM reps2dists JOIN dists ON reps2dists.dist_id=dists.id WHERE rep_id=".$info_reps['id']); |
25 | echo "# ".$info_reps['rep']."<br>"; |
35 | echo "# ".$info_reps['rep']."<br>"; |
26 | while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) { |
36 | while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) { |
27 | echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist']; |
37 | echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist']; |
28 | $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']); |
38 | $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']); |
29 | while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) { |
39 | while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) { |
30 | echo " ".$info_sects['sects.sect']; |
40 | echo " ".$info_sects['sects.sect']; |
31 | }
|
41 | }
|
32 | echo "<br>"; |
42 | echo "<br>"; |
33 | }
|
43 | }
|
34 | }
|
44 | }
|
35 | }
|
45 | }
|
36 | else { |
46 | else { |
37 | $codename =& $db_set->getOne("SELECT codename FROM vers WHERE id=".$distr); |
47 | $codename =& $db_set->getOne("SELECT codename FROM vers WHERE id=".$distr); |
38 | 48 | ||
39 | $reps =& $db_apt->query("SELECT * FROM reps"); |
49 | $reps =& $db_apt->query("SELECT * FROM reps"); |
40 | while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) { |
50 | while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) { |
41 | $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.'%"'); |
51 | $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.'%"'); |
42 | if ($dists->numRows()!=0) echo "# ".$info_reps['rep']."<br>"; |
52 | if ($dists->numRows()!=0) echo "# ".$info_reps['rep']."<br>"; |
43 | while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) { |
53 | while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) { |
44 | echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist']; |
54 | echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist']; |
45 | $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']); |
55 | $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']); |
46 | while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) { |
56 | while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) { |
47 | echo " ".$info_sects['sects.sect']; |
57 | echo " ".$info_sects['sects.sect']; |
48 | }
|
58 | }
|
49 | echo "<br>"; |
59 | echo "<br>"; |
50 | }
|
60 | }
|
51 | }
|
61 | }
|
52 | }
|
62 | }
|
53 | 63 | ||
54 | //$query =& $dba->query("SET NAMES utf8");
|
64 | //$query =& $dba->query("SET NAMES utf8");
|
55 | 65 | ||
56 | ?>
|
66 | ?>
|
- | 67 | ||
- | 68 | </body> |
|
- | 69 | </html> |
|
57 | 70 |