Редакция 201 | Редакция 203 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 201 | Редакция 202 | ||
---|---|---|---|
Строка 26... | Строка 26... | ||
26 | function getRepList($distro,$version,$dblink) { |
26 | function getRepList($distro,$version,$dblink) { |
27 | // Fetch settings
|
27 | // Fetch settings
|
28 | $query =& $dblink->query("SELECT * FROM settings"); |
28 | $query =& $dblink->query("SELECT * FROM settings"); |
29 | $settings = array(); |
29 | $settings = array(); |
30 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
30 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
31 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
31 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
32 | }; |
32 | }; |
33 | // Fetch information about distribution
|
33 | // Fetch info about distribution
|
34 | $query =& $dblink->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id JOIN dtype p ON d.disttype=p.type_id WHERE v.dist_id='$distro' AND v.version_id='$version'"); |
34 | $query =& $dblink->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id JOIN dtype p ON d.disttype=p.type_id WHERE v.dist_id='$distro' AND v.version_id='$version'"); |
35 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
35 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
36 | // Fetch repos
|
36 | // Fetch repos
|
37 | $repos=array_values($_GET); |
37 | $repos=array_values($_GET); |
- | 38 | $porigid = -1; // Previous origin id |
|
38 | for ($i=3;$i<count($repos);$i++){ |
39 | for ($i=3;$i<count($repos);$i++){ |
39 | $pre=-1; //wtf? |
- | |
40 | $id=(int)$repos[$i]; |
40 | $id=(int)$repos[$i]; |
41 | $sql =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN origin o ON o.orig_id=r.orig_id JOIN version v2 ON v.ver_id=v2.version_id JOIN scheme s ON s.scheme_id=r.scheme_id JOIN root r2 ON r2.root_id=r.root_id WHERE r.rep_id=".$id); |
41 | // Fetch info about origin and scheme
|
42 | $sql->fetchInto($resinfo, DB_FETCHMODE_ASSOC); |
42 | $sql =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN origin o ON o.orig_id=r.orig_id JOIN version v2 ON v.ver_id=v2.version_id JOIN scheme s ON s.scheme_id=r.scheme_id JOIN root r2 ON r2.root_id=r.root_id WHERE r.rep_id=".$id); |
43 | - | ||
- | 43 | $sql->fetchInto($resinfo, DB_FETCHMODE_ASSOC); |
|
44 | $repscheme = stripslashes($resinfo["scheme"]); |
44 | $repscheme = stripslashes($resinfo["scheme"]); |
- | 45 | // Fetch info about sections
|
|
45 | $querysect =& $dblink->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$resinfo[rep_id]'"); |
46 | $querysect =& $dblink->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$resinfo[rep_id]'"); |
46 | $sections = ""; |
47 | $sections = ""; |
47 | while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) { |
48 | while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) { |
48 | $sections .= stripslashes($section["sectname"])." "; |
49 | $sections .= stripslashes($section["sectname"])." "; |
- | 50 | }
|
|
49 | }
|
51 | // Conversion scheme
|
50 | $repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme); |
52 | $repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme); |
51 | $repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme); |
53 | $repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme); |
52 | $repscheme = str_replace("{URL}",$settings["url"],$repscheme); |
54 | $repscheme = str_replace("{URL}",$settings["url"],$repscheme); |
53 | $repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme); |
55 | $repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme); |
54 | $repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme); |
56 | $repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme); |
55 | $repscheme = str_replace("{SECT}",$sections,$repscheme); |
57 | $repscheme = str_replace("{SECT}",$sections,$repscheme); |
56 | $repscheme = str_replace("{ROOT}",stripslashes($resinfo["root_folder"]),$repscheme); |
58 | $repscheme = str_replace("{ROOT}",stripslashes($resinfo["root_folder"]),$repscheme); |
- | 59 | // Comment if another origin
|
|
57 | if($pre != $resinfo["orig_id"]) { |
60 | if($porigid != $resinfo["orig_id"]) { |
58 | $result .= "### ".$resinfo["origin"]."( ".$resinfo["desk"]." ) - ".$resinfo["homeurl"]." ###\n"; |
61 | $result .= "### ".$resinfo["origin"]."( ".$resinfo["desk"]." ) - ".$resinfo["homeurl"]." ###\n"; |
59 | }
|
62 | }
|
60 | $pre = $resinfo["orig_id"]; |
63 | $porigid = $resinfo["orig_id"]; |
- | 64 | // Result
|
|
61 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
65 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
62 | }
|
66 | }
|
63 | return $result; |
67 | return $result; |
64 | }
|
68 | }
|
65 | 69 | ||
66 | function getInfo($message,$dblink){ |
70 | function getInfo($message,$dblink){ |
67 | $answer = array(); |
71 | $answer = array(); |
68 | 72 |