Редакция 217 | Редакция 234 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 217 | Редакция 219 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | /**
|
3 | /**
|
4 | * Project: Ant: sources.list generator
|
4 | * Project: Ant: sources.list generator
|
5 | * File: core.php
|
5 | * File: core.php
|
6 | *
|
6 | *
|
7 | * This library is free software; you can redistribute it and/or
|
7 | * This library is free software; you can redistribute it and/or
|
8 | * modify it under the terms of the GNU Lesser General Public
|
8 | * modify it under the terms of the GNU Lesser General Public
|
9 | * License as published by the Free Software Foundation; either
|
9 | * License as published by the Free Software Foundation; either
|
10 | * version 2.1 of the License, or (at your option) any later version.
|
10 | * version 2.1 of the License, or (at your option) any later version.
|
11 | *
|
11 | *
|
12 | * This library is distributed in the hope that it will be useful,
|
12 | * This library is distributed in the hope that it will be useful,
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 | * Lesser General Public License for more details.
|
15 | * Lesser General Public License for more details.
|
16 | *
|
16 | *
|
17 | * You should have received a copy of the GNU Lesser General Public
|
17 | * You should have received a copy of the GNU Lesser General Public
|
18 | * License along with this library; if not, write to the Free Software
|
18 | * License along with this library; if not, write to the Free Software
|
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20 | *
|
20 | *
|
21 | */
|
21 | */
|
22 | 22 | ||
23 | 23 | ||
24 | class Core { |
24 | class Core { |
25 | 25 | ||
26 | function getSourceList($distro,$version,$repos,$dblink) { |
26 | function getSourceList($distro,$version,$repos,$dblink) { |
- | 27 | // TODO optimize this
|
|
- | 28 | if(count($repos)==0) return; |
|
27 | // Fetch settings
|
29 | // Fetch settings
|
28 | $query =& $dblink->query("SELECT * FROM settings"); |
30 | $query =& $dblink->query("SELECT * FROM settings"); |
29 | $settings = array(); |
31 | $settings = array(); |
30 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
32 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
31 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
33 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
32 | }; |
34 | }; |
33 | // Fetch info about distribution
|
35 | // 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'"); |
36 | $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); |
37 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
- | 38 | // Fetch default repos if not defined
|
|
- | 39 | if($repos[0]=="-1") { |
|
- | 40 | $querydrep =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN version v2 ON v.ver_id=v2.version_id WHERE r.defaultrep='1' AND v2.version_id='$version'"); |
|
- | 41 | $i=0; |
|
- | 42 | while ($querydrep->fetchInto($dreps,DB_FETCHMODE_ASSOC)) { |
|
- | 43 | $repos[$i] = $dreps["rep_id"]; |
|
- | 44 | $i++; |
|
- | 45 | }
|
|
- | 46 | }; |
|
- | 47 | if(count($repos)==0) return; |
|
36 | // Fetch repos
|
48 | // Processing repos
|
37 | $porigid = -1; // Previous origin id |
49 | $porigid = -1; // Previous origin id |
38 | - | ||
39 | for($i=0;$i<count($repos);$i++) { |
50 | for($i=0;$i<count($repos);$i++) { |
40 | $id=$repos[$i]; |
51 | $id=$repos[$i]; |
41 | // Fetch info about origin and scheme
|
52 | // Fetch info about origin and scheme
|
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); |
53 | $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 | $sql->fetchInto($resinfo, DB_FETCHMODE_ASSOC); |
54 | $sql->fetchInto($resinfo, DB_FETCHMODE_ASSOC); |
44 | $repscheme = stripslashes($resinfo["scheme"]); |
55 | $repscheme = stripslashes($resinfo["scheme"]); |
45 | // Fetch info about sections
|
56 | // Fetch info about sections
|
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]'"); |
57 | $querysect =& $dblink->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$resinfo[rep_id]'"); |
47 | $sections = ""; |
58 | $sections = ""; |
48 | while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) { |
59 | while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) { |
49 | $sections .= stripslashes($section["sectname"])." "; |
60 | $sections .= stripslashes($section["sectname"])." "; |
50 | }
|
61 | }
|
51 | // Conversion scheme
|
62 | // Conversion scheme
|
52 | $repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme); |
63 | $repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme); |
53 | $repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme); |
64 | $repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme); |
54 | $repscheme = str_replace("{URL}",$settings["url"],$repscheme); |
65 | $repscheme = str_replace("{URL}",$settings["url"],$repscheme); |
55 | $repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme); |
66 | $repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme); |
56 | $repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme); |
67 | $repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme); |
57 | $repscheme = str_replace("{SECT}",$sections,$repscheme); |
68 | $repscheme = str_replace("{SECT}",$sections,$repscheme); |
58 | $repscheme = str_replace("{ROOT}",stripslashes($resinfo["root_folder"]),$repscheme); |
69 | $repscheme = str_replace("{ROOT}",stripslashes($resinfo["root_folder"]),$repscheme); |
59 | // Comment if another origin
|
70 | // Comment if another origin
|
60 | if($porigid != $resinfo["orig_id"]) { |
71 | if($porigid != $resinfo["orig_id"]) { |
61 | $result .= "### ".$resinfo["origin"]." ( ".$resinfo["desk"]." ) - ".$resinfo["homeurl"]." ###\n"; |
72 | $result .= "### ".$resinfo["origin"]." ( ".$resinfo["desk"]." ) - ".$resinfo["homeurl"]." ###\n"; |
62 | }
|
73 | }
|
63 | $porigid = $resinfo["orig_id"]; |
74 | $porigid = $resinfo["orig_id"]; |
64 | // Result
|
75 | // Result
|
65 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
76 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
66 | }
|
77 | }
|
67 | return $result; |
78 | return $result; |
68 | }
|
79 | }
|
69 | 80 | ||
70 | // For backward compatibility for Modern and Telepathy interfaces. Current getRepList() crushed his.
|
81 | // For backward compatibility for Modern interface. Current getRepList() crushed his.
|
71 | function getRepListLegacy($distro,$version,$dblink) { |
82 | function getRepListLegacy($distro,$version,$dblink) { |
72 | $query =& $dblink->query("SELECT * FROM settings"); |
83 | $query =& $dblink->query("SELECT * FROM settings"); |
73 | $settings = array(); |
84 | $settings = array(); |
74 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
85 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
75 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
86 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
76 | }; |
87 | }; |
77 | $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'"); |
88 | $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'"); |
78 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
89 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
79 | $query =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_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 v.ver_id='$version' ORDER BY r.rtype_id, r.scheme_id ASC"); |
90 | $query =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_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 v.ver_id='$version' ORDER BY r.rtype_id, r.scheme_id ASC"); |
80 | while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC)) { |
91 | while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC)) { |
81 | $repscheme = stripslashes($resinfo["scheme"]); |
92 | $repscheme = stripslashes($resinfo["scheme"]); |
82 | 93 | ||
83 | $querysect =& $dblink->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE |
94 | $querysect =& $dblink->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE |
84 | r.rep_id='$resinfo[rep_id]'"); |
95 | r.rep_id='$resinfo[rep_id]'"); |
85 | $sections = ""; |
96 | $sections = ""; |
86 | while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) { |
97 | while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) { |
87 | $sections .= stripslashes($section["sectname"])." "; |
98 | $sections .= stripslashes($section["sectname"])." "; |
88 | }
|
99 | }
|
89 | 100 | ||
90 | $repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme); |
101 | $repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme); |
91 | $repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme); |
102 | $repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme); |
92 | $repscheme = str_replace("{URL}",$settings["url"],$repscheme); |
103 | $repscheme = str_replace("{URL}",$settings["url"],$repscheme); |
93 | $repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme); |
104 | $repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme); |
94 | $repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme); |
105 | $repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme); |
95 | $repscheme = str_replace("{SECT}",$sections,$repscheme); |
106 | $repscheme = str_replace("{SECT}",$sections,$repscheme); |
96 | $repscheme = str_replace("{ROOT}",stripslashes($resinfo["root_folder"]),$repscheme); |
107 | $repscheme = str_replace("{ROOT}",stripslashes($resinfo["root_folder"]),$repscheme); |
97 | 108 | ||
98 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
109 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
99 | }
|
110 | }
|
100 | return $result; |
111 | return $result; |
101 | }
|
112 | }
|
102 | 113 | ||
103 | function getInfo($message,$dblink){ |
114 | function getInfo($message,$dblink){ |
104 | $answer = array(); |
115 | $answer = array(); |
105 | 116 | ||
106 | if (preg_match("/linux/i",$message)) { |
117 | if (preg_match("/linux/i",$message)) { |
107 | $dist_id = 0; |
118 | $dist_id = 0; |
108 | $dist_info = ""; |
119 | $dist_info = ""; |
109 | $vers_id = 0; |
120 | $vers_id = 0; |
110 | $vers_info = ""; |
121 | $vers_info = ""; |
111 | $qd =& $dblink->query("SELECT * FROM distribution"); |
122 | $qd =& $dblink->query("SELECT * FROM distribution"); |
112 | while ($qd->fetchInto($res, DB_FETCHMODE_ASSOC)) { |
123 | while ($qd->fetchInto($res, DB_FETCHMODE_ASSOC)) { |
113 | if (preg_match("/".stripslashes($res["distua"])."/i",$message)) { |
124 | if (preg_match("/".stripslashes($res["distua"])."/i",$message)) { |
114 | $dist_id = $res["dist_id"]; |
125 | $dist_id = $res["dist_id"]; |
115 | $dist_info = stripslashes($res["distname"]); |
126 | $dist_info = stripslashes($res["distname"]); |
116 | $qv =& $dblink->query("SELECT * FROM version WHERE dist_id='$dist_id'"); |
127 | $qv =& $dblink->query("SELECT * FROM version WHERE dist_id='$dist_id'"); |
117 | while($qv->fetchInto($rev, DB_FETCHMODE_ASSOC)) { |
128 | while($qv->fetchInto($rev, DB_FETCHMODE_ASSOC)) { |
118 | if (preg_match("/".stripslashes($rev["vcodename"])."/i",$message)) { |
129 | if (preg_match("/".stripslashes($rev["vcodename"])."/i",$message)) { |
119 | $vers_id = $rev["version_id"]; |
130 | $vers_id = $rev["version_id"]; |
120 | $vers_info = stripslashes($rev["version"])." “".stripslashes($rev["vname"])."”"; |
131 | $vers_info = stripslashes($rev["version"])." “".stripslashes($rev["vname"])."”"; |
121 | }
|
132 | }
|
122 | }
|
133 | }
|
123 | }
|
134 | }
|
124 | }
|
135 | }
|
125 | $answer[] = "Linux"; |
136 | $answer[] = "Linux"; |
126 | $answer[] = "Судя по всему у Вас операционная система "; |
137 | $answer[] = "Судя по всему у Вас операционная система "; |
127 | if ($dist_id!=0) { |
138 | if ($dist_id!=0) { |
128 | $answer[] = $dist_id; |
139 | $answer[] = $dist_id; |
129 | $answer[] = $dist_info; |
140 | $answer[] = $dist_info; |
130 | }
|
141 | }
|
131 | if ($vers_id!=0) { |
142 | if ($vers_id!=0) { |
132 | $answer[] = $vers_id; |
143 | $answer[] = $vers_id; |
133 | $answer[] = $vers_info; |
144 | $answer[] = $vers_info; |
134 | }
|
145 | }
|
135 | 146 | ||
136 | } else { |
147 | } else { |
137 | $answer[] = "unknown"; |
148 | $answer[] = "unknown"; |
138 | $answer[] = "Ресурс рассчитан явно не на Вашу операционную систему!"; |
149 | $answer[] = "Ресурс рассчитан явно не на Вашу операционную систему!"; |
139 | }
|
150 | }
|
140 | 151 | ||
141 | return $answer; |
152 | return $answer; |
142 | }
|
153 | }
|
143 | 154 | ||
144 | function getInterfacesList($current,$dblink) { |
155 | function getInterfacesList($current,$dblink) { |
145 | $url = parse_url($current); |
156 | $url = parse_url($current); |
146 | $path = array(); |
157 | $path = array(); |
147 | $path = split("/",$url["path"]); |
158 | $path = split("/",$url["path"]); |
148 | $currentIF = str_replace(".php","",$path[count($path)-1]); |
159 | $currentIF = str_replace(".php","",$path[count($path)-1]); |
149 | $req =& $dblink->query("SELECT * FROM interfaces WHERE interface NOT LIKE '$currentIF'"); |
160 | $req =& $dblink->query("SELECT * FROM interfaces WHERE interface NOT LIKE '$currentIF'"); |
150 | $iflist = "<a href='./'>Интерфейсы</a>: "; |
161 | $iflist = "<a href='./'>Интерфейсы</a>: "; |
151 | while ($req->fetchInto($if, DB_FETCHMODE_ASSOC)) { |
162 | while ($req->fetchInto($if, DB_FETCHMODE_ASSOC)) { |
152 | $iflist .= "<a href='./".stripslashes($if["interface"]).".php'>".strtolower(stripslashes($if["interfaceinfo"]))."</a>, "; |
163 | $iflist .= "<a href='./".stripslashes($if["interface"]).".php'>".strtolower(stripslashes($if["interfaceinfo"]))."</a>, "; |
153 | }
|
164 | }
|
154 | $iflist = substr($iflist, 0, strlen($iflist)-2); |
165 | $iflist = substr($iflist, 0, strlen($iflist)-2); |
155 | return $iflist; |
166 | return $iflist; |
156 | }
|
167 | }
|
157 | 168 | ||
158 | function getCSSList($dblink) { |
169 | function getCSSList($dblink) { |
159 | $req =& $dblink->query("SELECT * FROM distribution"); |
170 | $req =& $dblink->query("SELECT * FROM distribution"); |
160 | if ($req->numRows()>0) { |
171 | if ($req->numRows()>0) { |
161 | $css = "<style type=\"text/css\">\n"; |
172 | $css = "<style type=\"text/css\">\n"; |
162 | while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) { |
173 | while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) { |
163 | if ($dist["distlogo"]) { |
174 | if ($dist["distlogo"]) { |
164 | $css .= ".".stripslashes($dist["distua"])." { display: inline; padding-left: 15px; background: transparent url(./img/logo/".stripslashes($dist["distua"]).".png) top left no-repeat; }\n"; |
175 | $css .= ".".stripslashes($dist["distua"])." { display: inline; padding-left: 15px; background: transparent url(./img/logo/".stripslashes($dist["distua"]).".png) top left no-repeat; }\n"; |
165 | $css .= ".".stripslashes($dist["distua"])."-em { display: inline; padding-left: 30px; background: transparent url(./img/logo/".stripslashes($dist["distua"])."-em.png) top left no-repeat; }\n"; |
176 | $css .= ".".stripslashes($dist["distua"])."-em { display: inline; padding-left: 30px; background: transparent url(./img/logo/".stripslashes($dist["distua"])."-em.png) top left no-repeat; }\n"; |
166 | } else { |
177 | } else { |
167 | $css .= ""; |
178 | $css .= ""; |
168 | }
|
179 | }
|
169 | }
|
180 | }
|
170 | $css .= "</style>"; |
181 | $css .= "</style>"; |
171 | } else { |
182 | } else { |
172 | $css = ""; |
183 | $css = ""; |
173 | }
|
184 | }
|
174 | return $css; |
185 | return $css; |
175 | }
|
186 | }
|
176 | 187 | ||
177 | function getSetting($setting, $dblink) { |
188 | function getSetting($setting, $dblink) { |
178 | $query =& $dblink->query("SELECT * FROM settings WHERE opt LIKE '".$setting."'"); |
189 | $query =& $dblink->query("SELECT * FROM settings WHERE opt LIKE '".$setting."'"); |
179 | $query->fetchInto($sett, DB_FETCHMODE_ASSOC); |
190 | $query->fetchInto($sett, DB_FETCHMODE_ASSOC); |
180 | return stripslashes($sett["optvalue"]); |
191 | return stripslashes($sett["optvalue"]); |
181 | }
|
192 | }
|
182 | 193 | ||
183 | function getUUID($param) { |
194 | function getUUID($param) { |
184 | $param_s = md5($param); |
195 | $param_s = md5($param); |
185 | $time_low = bin2hex(substr($param_s,0, 4)); |
196 | $time_low = bin2hex(substr($param_s,0, 4)); |
186 | $time_mid = bin2hex(substr($param_s,4, 2)); |
197 | $time_mid = bin2hex(substr($param_s,4, 2)); |
187 | $time_hi_and_version = bin2hex(substr($param_s,6, 2)); |
198 | $time_hi_and_version = bin2hex(substr($param_s,6, 2)); |
188 | $clock_seq_hi_and_reserved = bin2hex(substr($param_s,8, 2)); |
199 | $clock_seq_hi_and_reserved = bin2hex(substr($param_s,8, 2)); |
189 | $node = bin2hex(substr($param_s,10, 6)); |
200 | $node = bin2hex(substr($param_s,10, 6)); |
190 | 201 | ||
191 | $time_hi_and_version = hexdec($time_hi_and_version); |
202 | $time_hi_and_version = hexdec($time_hi_and_version); |
192 | $time_hi_and_version = $time_hi_and_version >> 4; |
203 | $time_hi_and_version = $time_hi_and_version >> 4; |
193 | $time_hi_and_version = $time_hi_and_version | 0x4000; |
204 | $time_hi_and_version = $time_hi_and_version | 0x4000; |
194 | 205 | ||
195 | $clock_seq_hi_and_reserved = hexdec($clock_seq_hi_and_reserved); |
206 | $clock_seq_hi_and_reserved = hexdec($clock_seq_hi_and_reserved); |
196 | $clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved >> 2; |
207 | $clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved >> 2; |
197 | $clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved | 0x8000; |
208 | $clock_seq_hi_and_reserved = $clock_seq_hi_and_reserved | 0x8000; |
198 | 209 | ||
199 | return sprintf('%08s-%04s-%04x-%04x-%012s',$time_low, $time_mid, $time_hi_and_version, $clock_seq_hi_and_reserved, $node); |
210 | return sprintf('%08s-%04s-%04x-%04x-%012s',$time_low, $time_mid, $time_hi_and_version, $clock_seq_hi_and_reserved, $node); |
200 | }
|
211 | }
|
201 | 212 | ||
202 | 213 | ||
203 | function getRepList($distro,$version,$dblink) { |
214 | function getRepList($distro,$version,$dblink) { |
204 | $query =& $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 v.ver_id='$version' ORDER BY r.rtype_id, r.scheme_id ASC"); |
215 | $query =& $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 v.ver_id='$version' ORDER BY r.rtype_id, r.scheme_id ASC"); |
205 | $i=-1; |
216 | $i=-1; |
206 | while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC)) { |
217 | while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC)) { |
207 | $i++; |
218 | $i++; |
208 | $res[0][$i]=$resinfo["rep_id"]; |
219 | $res[0][$i]=$resinfo["rep_id"]; |
209 | $res[1][$i]=$resinfo["repname"]; |
220 | $res[1][$i]=$resinfo["repname"]; |
210 | $res[2][$i]=$resinfo["repdescribe"]; |
221 | $res[2][$i]=$resinfo["repdescribe"]; |
211 | $res[3][$i]=$resinfo["defaultrep"]; |
222 | $res[3][$i]=$resinfo["defaultrep"]; |
212 | }
|
223 | }
|
213 | return $res; |
224 | return $res; |
214 | }
|
225 | }
|
215 | }
|
226 | }
|
216 | ?>
|
227 | ?>
|
217 | 228 |