Редакция 480 | К новейшей редакции | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 480 | Редакция 481 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | include "inc/header.htm"; |
3 | include "inc/header.htm"; |
4 | 4 | ||
5 | require_once 'DB.php'; |
5 | require_once 'DB.php'; |
6 | 6 | ||
7 | $dsn = 'sqlite:///apt.db?mode=0777'; |
7 | $dsn = 'sqlite:///apt.db?mode=0777'; |
8 | 8 | ||
9 | $db_apt =& DB::connect($dsn); |
9 | $db_apt =& DB::connect($dsn); |
10 | if (PEAR::isError($db_apt)) { |
10 | if (PEAR::isError($db_apt)) { |
11 | die($db_apt->getMessage()); |
11 | die($db_apt->getMessage()); |
12 | }
|
12 | }
|
13 | 13 | ||
14 | $dsn = 'sqlite:///set.db?mode=0777'; |
14 | $dsn = 'sqlite:///set.db?mode=0777'; |
15 | 15 | ||
16 | $db_set =& DB::connect($dsn); |
16 | $db_set =& DB::connect($dsn); |
17 | if (PEAR::isError($db_set)) { |
17 | if (PEAR::isError($db_set)) { |
18 | die($db_set->getMessage()); |
18 | die($db_set->getMessage()); |
19 | }
|
19 | }
|
20 | 20 | ||
21 | <h1>sources.list</h1> |
21 | echo "<h1>sources.list</h1>"; |
22 | 22 | ||
23 | $distr = abs(intval($_GET["d"])); |
23 | $distr = abs(intval($_GET["d"])); |
24 | 24 | ||
25 | if($distr==0) { |
25 | if($distr==0) { |
26 | $reps =& $db_apt->query("SELECT * FROM reps"); |
26 | $reps =& $db_apt->query("SELECT * FROM reps"); |
27 | while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) { |
27 | while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) { |
28 | $dists =& $db_apt->query("SELECT * FROM reps2dists JOIN dists ON reps2dists.dist_id=dists.id WHERE rep_id=".$info_reps['id']); |
28 | $dists =& $db_apt->query("SELECT * FROM reps2dists JOIN dists ON reps2dists.dist_id=dists.id WHERE rep_id=".$info_reps['id']); |
29 | echo "# ".$info_reps['rep']."<br>"; |
29 | echo "# ".$info_reps['rep']."<br>"; |
30 | while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) { |
30 | while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) { |
31 | echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist']; |
31 | echo "deb http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist']; |
32 | $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']); |
32 | $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']); |
33 | while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) { |
33 | while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) { |
34 | echo " ".$info_sects['sects.sect']; |
34 | echo " ".$info_sects['sects.sect']; |
35 | }
|
35 | }
|
36 | echo "<br>"; |
36 | echo "<br>"; |
37 | }
|
37 | }
|
38 | }
|
38 | }
|
39 | }
|
39 | }
|
40 | else { |
40 | else { |
41 | $codename =& $db_set->getOne("SELECT codename FROM vers WHERE id=".$distr); |
41 | $codename =& $db_set->getOne("SELECT codename FROM vers WHERE id=".$distr); |
42 | 42 | ||
43 | $reps =& $db_apt->query("SELECT * FROM reps"); |
43 | $reps =& $db_apt->query("SELECT * FROM reps"); |
44 | while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) { |
44 | while ($reps->fetchInto($info_reps,DB_FETCHMODE_ASSOC)) { |
45 | $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.'%"'); |
45 | $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.'%"'); |
46 | if ($dists->numRows()!=0) echo "# ".$info_reps['rep']."<br>"; |
46 | if ($dists->numRows()!=0) echo "# ".$info_reps['rep']."<br>"; |
47 | while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) { |
47 | while ($dists->fetchInto($info_dists,DB_FETCHMODE_ASSOC)) { |
48 | echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist']; |
48 | echo " http://apt.nix-files.org.ru/".$info_reps['rep']." ".$info_dists['dists.dist']; |
49 | $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']); |
49 | $sects =& $db_apt->query("SELECT * FROM reps2dists2sects JOIN sects ON reps2dists2sects.sect_id=sects.id WHERE reps2dists_id==".$info_dists['reps2dists.id']); |
50 | while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) { |
50 | while ($sects->fetchInto($info_sects,DB_FETCHMODE_ASSOC)) { |
51 | echo " ".$info_sects['sects.sect']; |
51 | echo " ".$info_sects['sects.sect']; |
52 | }
|
52 | }
|
53 | echo "<br>"; |
53 | echo "<br>"; |
54 | }
|
54 | }
|
55 | }
|
55 | }
|
56 | }
|
56 | }
|
57 | 57 | ||
58 | //$query =& $dba->query("SET NAMES utf8");
|
58 | //$query =& $dba->query("SET NAMES utf8");
|
59 | 59 | ||
60 | include "inc/footer.htm"; |
60 | include "inc/footer.htm"; |
61 | 61 | ||
62 | ?>
|
62 | ?>
|
63 | 63 |