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