Редакция 504 | Редакция 506 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 504 | Редакция 505 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | /**
|
3 | /**
|
4 | *
|
4 | *
|
5 | * Codename: ant-ng - generator of sources.list for Debian and
|
5 | * Codename: ant-ng - generator of sources.list for Debian and
|
6 | * distributives, based on Debian
|
6 | * distributives, based on Debian
|
7 | * http://alex-w.org.ru/p/antng/
|
7 | * http://alex-w.org.ru/p/antng/
|
8 | *
|
8 | *
|
9 | * Copyright (c) 2009 Alexander Wolf
|
9 | * Copyright (c) 2009 Alexander Wolf
|
10 | * Dual licensed under the MIT and GNU LGPL licenses.
|
10 | * Dual licensed under the MIT and GNU LGPL licenses.
|
11 | * http://alex-w.org.ru/p/antng/license
|
11 | * http://alex-w.org.ru/p/antng/license
|
12 | *
|
12 | *
|
13 | */
|
13 | */
|
14 | 14 | ||
15 | class Core { |
15 | class Core { |
16 | protected $db = NULL; |
16 | protected $db = NULL; |
17 | protected $prefix = NULL; |
17 | protected $prefix = NULL; |
18 | protected $secure = NULL; |
18 | protected $secure = NULL; |
19 | protected $cookie = NULL; |
19 | protected $cookie = NULL; |
20 | 20 | ||
21 | /**
|
21 | /**
|
22 | * Конструктор класса Core - ядро генератора
|
22 | * Конструктор класса Core - ядро генератора
|
23 | *
|
23 | *
|
24 | * @author Alexander Wolf
|
24 | * @author Alexander Wolf
|
25 | * @category Core
|
25 | * @category Core
|
26 | *
|
26 | *
|
27 | * @param string $database
|
27 | * @param string $database
|
28 | * @param string $prefix
|
28 | * @param string $prefix
|
29 | * @param object $secure
|
29 | * @param object $secure
|
30 | * @param string $cookie
|
30 | * @param string $cookie
|
31 | */
|
31 | */
|
32 | public function __construct($database, $prefix, $secure, $cookie) { |
32 | public function __construct($database, $prefix, $secure, $cookie) { |
33 | $this->db = $database; |
33 | $this->db = $database; |
34 | $this->prefix = $prefix; |
34 | $this->prefix = $prefix; |
35 | $this->secure = $secure; |
35 | $this->secure = $secure; |
36 | $this->cookie = $cookie; |
36 | $this->cookie = $cookie; |
37 | }
|
37 | }
|
38 | 38 | ||
39 | /**
|
39 | /**
|
40 | * Получение данных о настройке
|
40 | * Получение данных о настройке
|
41 | *
|
41 | *
|
42 | * @author Alexander Wolf
|
42 | * @author Alexander Wolf
|
43 | * @category Core
|
43 | * @category Core
|
44 | *
|
44 | *
|
45 | * @param string $attr
|
45 | * @param string $attr
|
46 | * @return array
|
46 | * @return array
|
47 | */
|
47 | */
|
48 | public function getOption($attr) { |
48 | public function getOption($attr) { |
49 | $result = array(); |
49 | $result = array(); |
50 | $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkStr($attr)."'"; |
50 | $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkStr($attr)."'"; |
51 | $rq =& $this->db->query($query); |
51 | $rq =& $this->db->query($query); |
52 | if ($rq->numRows()!=0) { |
52 | if ($rq->numRows()!=0) { |
53 | $rq->fetchInto($element); |
53 | $rq->fetchInto($element); |
54 | $result["ERR"] = 0; |
54 | $result["ERR"] = 0; |
55 | $result["OptValue"] = $element["optvalue"]; |
55 | $result["OptValue"] = $element["optvalue"]; |
56 | } else { |
56 | } else { |
57 | $result["ERR"] = 1; |
57 | $result["ERR"] = 1; |
58 | $result["ERRINFO"] = "Empty result"; |
58 | $result["ERRINFO"] = "Empty result"; |
59 | }
|
59 | }
|
60 | return $result; |
60 | return $result; |
61 | }
|
61 | }
|
62 | 62 | ||
63 | /**
|
63 | /**
|
64 | * Установка данных о настройке
|
64 | * Установка данных о настройке
|
65 | *
|
65 | *
|
66 | * @author Alexander Wolf
|
66 | * @author Alexander Wolf
|
67 | * @category Core
|
67 | * @category Core
|
68 | *
|
68 | *
|
69 | * @param string $attr
|
69 | * @param string $attr
|
70 | * @param string $value
|
70 | * @param string $value
|
71 | * @return array
|
71 | * @return array
|
72 | */
|
72 | */
|
73 | public function setOption($attr, $value) { |
73 | public function setOption($attr, $value) { |
74 | $result = array(); |
74 | $result = array(); |
75 | 75 | ||
76 | if ($attr != "passwd") { |
76 | if ($attr != "passwd") { |
77 | $sValue = $this->secure->checkStr($value); |
77 | $sValue = $this->secure->checkStr($value); |
78 | } else { |
78 | } else { |
79 | $sValue = $value; |
79 | $sValue = $value; |
80 | }
|
80 | }
|
81 | 81 | ||
82 | $query = "UPDATE ".$this->prefix."settings SET optvalue='".$sValue."' WHERE opt='".$attr."'"; |
82 | $query = "UPDATE ".$this->prefix."settings SET optvalue='".$sValue."' WHERE opt='".$attr."'"; |
83 | $rq =& $this->db->query($query); |
83 | $rq =& $this->db->query($query); |
84 | if (PEAR::isError($this->db)) { |
84 | if (PEAR::isError($this->db)) { |
85 | $result["ERR"] = 1; |
85 | $result["ERR"] = 1; |
86 | $result["ERRINFO"] = $this->db->getMessage(); |
86 | $result["ERRINFO"] = $this->db->getMessage(); |
87 | } else { |
87 | } else { |
88 | $result["ERR"] = 0; |
88 | $result["ERR"] = 0; |
89 | }
|
89 | }
|
90 | 90 | ||
91 | return $result; |
91 | return $result; |
92 | }
|
92 | }
|
93 | 93 | ||
94 | /**
|
94 | /**
|
95 | * Создание настройки
|
95 | * Создание настройки
|
96 | *
|
96 | *
|
97 | * @author Alexander Wolf
|
97 | * @author Alexander Wolf
|
98 | * @category Core
|
98 | * @category Core
|
99 | *
|
99 | *
|
100 | * @param string $attr
|
100 | * @param string $attr
|
101 | * @param string $value
|
101 | * @param string $value
|
102 | * @return array
|
102 | * @return array
|
103 | */
|
103 | */
|
104 | public function addOption($attr, $value) { |
104 | public function addOption($attr, $value) { |
105 | $result = array(); |
105 | $result = array(); |
106 | $sValue = $this->secure->checkStr($value); |
106 | $sValue = $this->secure->checkStr($value); |
107 | 107 | ||
108 | $query = "INSERT INTO ".$this->prefix."settings SET opt='".$attr."', optvalue='".$sValue."'"; |
108 | $query = "INSERT INTO ".$this->prefix."settings SET opt='".$attr."', optvalue='".$sValue."'"; |
109 | $rq =& $this->db->query($query); |
109 | $rq =& $this->db->query($query); |
110 | if (PEAR::isError($this->db)) { |
110 | if (PEAR::isError($this->db)) { |
111 | $result["ERR"] = 1; |
111 | $result["ERR"] = 1; |
112 | $result["ERRINFO"] = $this->db->getMessage(); |
112 | $result["ERRINFO"] = $this->db->getMessage(); |
113 | } else { |
113 | } else { |
114 | $result["ERR"] = 0; |
114 | $result["ERR"] = 0; |
115 | }
|
115 | }
|
116 | 116 | ||
117 | return $result; |
117 | return $result; |
118 | }
|
118 | }
|
119 | 119 | ||
120 | /**
|
120 | /**
|
121 | * Получение и отображение списка дистрибутвов
|
121 | * Получение и отображение списка дистрибутвов
|
122 | *
|
122 | *
|
123 | * @author Alexander Wolf
|
123 | * @author Alexander Wolf
|
124 | * @category Core
|
124 | * @category Core
|
125 | * @deprecated may be deprecated XXX
|
125 | * @deprecated may be deprecated XXX
|
126 | *
|
126 | *
|
127 | * @param string $name
|
127 | * @param string $name
|
128 | * @param string $heads
|
128 | * @param string $heads
|
129 | * @param string $info
|
129 | * @param string $info
|
130 | * @param string $format
|
130 | * @param string $format
|
131 | * @return string
|
131 | * @return string
|
132 | */
|
132 | */
|
133 | public function showDistributionList($name, $heads = "", $info = "", $format = 'html') { |
133 | public function showDistributionList($name, $heads = "", $info = "", $format = 'html') { |
134 | $query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC"; |
134 | $query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC"; |
135 | $rq =& $this->db->query($query); |
135 | $rq =& $this->db->query($query); |
136 | switch ($format) { |
136 | switch ($format) { |
137 | case 'html': |
137 | case 'html': |
138 | $show = "<fieldset><legend>".$heads."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
138 | $show = "<fieldset><legend>".$heads."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
139 | $show .= "<option value=''>".$info."</option>\n"; |
139 | $show .= "<option value=''>".$info."</option>\n"; |
140 | while ($rq->fetchInto($element)) { |
140 | while ($rq->fetchInto($element)) { |
141 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
141 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
142 | }
|
142 | }
|
143 | $show .= "</select></fieldset>"; |
143 | $show .= "</select></fieldset>"; |
144 | break; |
144 | break; |
145 | case 'json': |
145 | case 'json': |
146 | $show = '[{value:"",text:"'.$info.'"}'; |
146 | $show = '[{value:"",text:"'.$info.'"}'; |
147 | while ($rq->fetchInto($element)) { |
147 | while ($rq->fetchInto($element)) { |
148 | $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}'; |
148 | $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}'; |
149 | }
|
149 | }
|
150 | $show .= ']'; |
150 | $show .= ']'; |
151 | break; |
151 | break; |
152 | case 'innerhtml': |
152 | case 'innerhtml': |
153 | $show = "<select id='".$name."' name='".$name."'>\n"; |
153 | $show = "<select id='".$name."' name='".$name."'>\n"; |
154 | while ($rq->fetchInto($element)) { |
154 | while ($rq->fetchInto($element)) { |
155 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
155 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
156 | }
|
156 | }
|
157 | $show .= "</select>"; |
157 | $show .= "</select>"; |
158 | break; |
158 | break; |
159 | }
|
159 | }
|
160 | return $show; |
160 | return $show; |
161 | }
|
161 | }
|
162 | 162 | ||
163 | /**
|
163 | /**
|
164 | * Получение названия дистрибутива
|
164 | * Получение названия дистрибутива
|
165 | *
|
165 | *
|
166 | * @author Alexander Wolf
|
166 | * @author Alexander Wolf
|
167 | * @category Core
|
167 | * @category Core
|
168 | *
|
168 | *
|
169 | * @param integer $distID
|
169 | * @param integer $distID
|
170 | * @return array
|
170 | * @return array
|
171 | */
|
171 | */
|
172 | public function getDistName($distID) { |
172 | public function getDistName($distID) { |
173 | $result = array(); |
173 | $result = array(); |
174 | $query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'"; |
174 | $query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'"; |
175 | $rq =& $this->db->query($query); |
175 | $rq =& $this->db->query($query); |
176 | if (PEAR::isError($this->db)) { |
176 | if (PEAR::isError($this->db)) { |
177 | $result["ERR"] = 1; |
177 | $result["ERR"] = 1; |
178 | $result["ERRINFO"] = $this->db->getMessage(); |
178 | $result["ERRINFO"] = $this->db->getMessage(); |
179 | } else { |
179 | } else { |
180 | $rq->fetchInto($element); |
180 | $rq->fetchInto($element); |
181 | $result["ERR"] = 0; |
181 | $result["ERR"] = 0; |
182 | $result["DistName"] = $this->secure->checkStr($element["distname"],1); |
182 | $result["DistName"] = $this->secure->checkStr($element["distname"],1); |
183 | }
|
183 | }
|
184 | 184 | ||
185 | return $result; |
185 | return $result; |
186 | }
|
186 | }
|
187 | 187 | ||
188 | /**
|
188 | /**
|
189 | * Получение названия программы, ее версии и описания
|
189 | * Получение названия программы, ее версии и описания
|
190 | *
|
190 | *
|
191 | * @author Alexander Wolf
|
191 | * @author Alexander Wolf
|
192 | * @category Core
|
192 | * @category Core
|
193 | *
|
193 | *
|
194 | * @param string $attr
|
194 | * @param string $attr
|
195 | * @return string
|
195 | * @return string
|
196 | */
|
196 | */
|
197 | public function getEngineAttr($attr = 'codename') { |
197 | public function getEngineAttr($attr = 'codename') { |
198 | $cname = $this->getOption($attr); |
198 | $cname = $this->getOption($attr); |
199 | return $this->secure->checkStr($cname["OptValue"],1); |
199 | return $this->secure->checkStr($cname["OptValue"],1); |
200 | }
|
200 | }
|
201 | 201 | ||
202 | /**
|
202 | /**
|
203 | * Получение и отображение списка версий дистрибутива
|
203 | * Получение и отображение списка версий дистрибутива
|
204 | *
|
204 | *
|
205 | * @author Alexander Wolf
|
205 | * @author Alexander Wolf
|
206 | * @category Core
|
206 | * @category Core
|
207 | *
|
207 | *
|
208 | * @param string $name
|
208 | * @param string $name
|
209 | * @param integer $distID
|
209 | * @param integer $distID
|
210 | * @param string $format
|
210 | * @param string $format
|
211 | * @return string
|
211 | * @return string
|
212 | */
|
212 | */
|
213 | public function showDistVersionsList($name, $distID, $format = 'html') { |
213 | public function showDistVersionsList($name, $distID, $format = 'html') { |
214 | $distname = $this->getDistName($distID); |
214 | $distname = $this->getDistName($distID); |
215 | $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
215 | $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
216 | $rq =& $this->db->query($query); |
216 | $rq =& $this->db->query($query); |
217 | switch ($format) { |
217 | switch ($format) { |
218 | case 'html': |
218 | case 'html': |
219 | $show = "<fieldset><legend>Версии ".$distname["DistName"]."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
219 | $show = "<fieldset><legend>Версии ".$distname["DistName"]."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
220 | $show .= "<option value=''>Выбери версию ".$distname["DistName"]."</option>\n"; |
220 | $show .= "<option value=''>Выбери версию ".$distname["DistName"]."</option>\n"; |
221 | while ($rq->fetchInto($element)) { |
221 | while ($rq->fetchInto($element)) { |
222 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["version"],1)." ".$this->secure->checkStr($element["vname"],1)."</option>\n"; |
222 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["version"],1)." ".$this->secure->checkStr($element["vname"],1)."</option>\n"; |
223 | }
|
223 | }
|
224 | $show .= "</select></fieldset>"; |
224 | $show .= "</select></fieldset>"; |
225 | break; |
225 | break; |
226 | case 'json': |
226 | case 'json': |
227 | $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}'; |
227 | $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}'; |
228 | while ($rq->fetchInto($element)) { |
228 | while ($rq->fetchInto($element)) { |
229 | $show .= ',{value:"'.$this->secure->checkInt($element["version_id"]).'",text:"'.$this->secure->checkStr($element["version"],1).' '.$this->secure->checkStr($element["vname"],1).'"}'; |
229 | $show .= ',{value:"'.$this->secure->checkInt($element["version_id"]).'",text:"'.$this->secure->checkStr($element["version"],1).' '.$this->secure->checkStr($element["vname"],1).'"}'; |
230 | }
|
230 | }
|
231 | $show .= ']'; |
231 | $show .= ']'; |
232 | break; |
232 | break; |
233 | }
|
233 | }
|
234 | return $show; |
234 | return $show; |
235 | }
|
235 | }
|
236 | 236 | ||
237 | /**
|
237 | /**
|
238 | * Получение и отображение списка секций основного (официального) репозитория
|
238 | * Получение и отображение списка секций основного (официального) репозитория
|
239 | *
|
239 | *
|
240 | * @author Alexander Wolf
|
240 | * @author Alexander Wolf
|
241 | * @category Core
|
241 | * @category Core
|
242 | *
|
242 | *
|
243 | * @param integer $version
|
243 | * @param integer $version
|
244 | * @param string $format
|
244 | * @param string $format
|
245 | * @return string
|
245 | * @return string
|
246 | */
|
246 | */
|
247 | public function showBranchesList($version, $format = 'html') { |
247 | public function showBranchesList($version, $format = 'html') { |
248 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
248 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
249 | $rq =& $this->db->query($query); |
249 | $rq =& $this->db->query($query); |
250 | $rq->fetchInto($types); |
250 | $rq->fetchInto($types); |
251 | $query = "SELECT s.*,t.rtype FROM ".$this->prefix."section s "; |
251 | $query = "SELECT s.*,t.rtype FROM ".$this->prefix."section s "; |
252 | $query .= "JOIN ".$this->prefix."sect2rep l ON s.sect_id=l.sect_id "; |
252 | $query .= "JOIN ".$this->prefix."sect2rep l ON s.sect_id=l.sect_id "; |
253 | $query .= "JOIN ".$this->prefix."repository r ON r.rep_id=l.rep_id "; |
253 | $query .= "JOIN ".$this->prefix."repository r ON r.rep_id=l.rep_id "; |
254 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
254 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
255 | $query .= "WHERE t.rtype_id='1' AND r.version='".$this->secure->checkInt($version)."'"; |
255 | $query .= "WHERE t.rtype_id='1' AND r.version='".$this->secure->checkInt($version)."'"; |
256 | $rq =& $this->db->query($query); |
256 | $rq =& $this->db->query($query); |
257 | switch ($format) { |
257 | switch ($format) { |
258 | case 'html': |
258 | case 'html': |
259 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
259 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
260 | while ($rq->fetchInto($element)) { |
260 | while ($rq->fetchInto($element)) { |
261 | $show .= "<div class='sections'><input type='checkbox' name='section[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." — ".$this->secure->checkStr($element["sectinfo"],1)."</div>\n"; |
261 | $show .= "<div class='sections'><input type='checkbox' name='section[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." — ".$this->secure->checkStr($element["sectinfo"],1)."</div>\n"; |
262 | }
|
262 | }
|
263 | $show .= "</fieldset>\n"; |
263 | $show .= "</fieldset>\n"; |
264 | break; |
264 | break; |
265 | case 'json': |
265 | case 'json': |
266 | //TODO Доделать JSON-вывод списка секций основного репозитория
|
266 | //TODO Доделать JSON-вывод списка секций основного репозитория
|
267 | break; |
267 | break; |
268 | }
|
268 | }
|
269 | 269 | ||
270 | return $show; |
270 | return $show; |
271 | }
|
271 | }
|
272 | 272 | ||
273 | /**
|
273 | /**
|
274 | * Получение и отображение списка репозиториев
|
274 | * Получение и отображение списка репозиториев
|
275 | *
|
275 | *
|
276 | * @author Alexander Wolf
|
276 | * @author Alexander Wolf
|
277 | * @category Core
|
277 | * @category Core
|
278 | *
|
278 | *
|
279 | * @param integer $version
|
279 | * @param integer $version
|
280 | * @param integer $reptype
|
280 | * @param integer $reptype
|
281 | * @param string $format
|
281 | * @param string $format
|
282 | * @return string
|
282 | * @return string
|
283 | */
|
283 | */
|
284 | public function showRepList($version, $reptype, $format = 'html') { |
284 | public function showRepList($version, $reptype, $format = 'html') { |
285 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='".$this->secure->checkInt($reptype)."'"; |
285 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='".$this->secure->checkInt($reptype)."'"; |
286 | $rq =& $this->db->query($query); |
286 | $rq =& $this->db->query($query); |
287 | $rq->fetchInto($types); |
287 | $rq->fetchInto($types); |
288 | $query = "SELECT * FROM ".$this->prefix."repository WHERE version='".$this->secure->checkInt($version)."' AND rtype_id='".$this->secure->checkInt($reptype)."'"; |
288 | $query = "SELECT * FROM ".$this->prefix."repository WHERE version='".$this->secure->checkInt($version)."' AND rtype_id='".$this->secure->checkInt($reptype)."'"; |
289 | $rq =& $this->db->query($query); |
289 | $rq =& $this->db->query($query); |
290 | switch ($format) { |
290 | switch ($format) { |
291 | case 'html': |
291 | case 'html': |
292 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
292 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
293 | while ($rq->fetchInto($types)) { |
293 | while ($rq->fetchInto($types)) { |
294 | $show .= "<div class='repository'><input type='checkbox' name='repository[]' value='".$element["rep_id"]."'> ".$this->secure->checkStr($element["repname"],1)." — ".$this->secure->checkStr($element["repinfo"],1)."</div>\n"; |
294 | $show .= "<div class='repository'><input type='checkbox' name='repository[]' value='".$element["rep_id"]."'> ".$this->secure->checkStr($element["repname"],1)." — ".$this->secure->checkStr($element["repinfo"],1)."</div>\n"; |
295 | }
|
295 | }
|
296 | $show .= "</fieldset>\n"; |
296 | $show .= "</fieldset>\n"; |
297 | break; |
297 | break; |
298 | case 'json': |
298 | case 'json': |
299 | //TODO Доделать JSON-вывод списка репозиториев
|
299 | //TODO Доделать JSON-вывод списка репозиториев
|
300 | break; |
300 | break; |
301 | }
|
301 | }
|
302 | 302 | ||
303 | return $show; |
303 | return $show; |
304 | }
|
304 | }
|
305 | 305 | ||
306 | /**
|
306 | /**
|
307 | * Добавление поддержки нового apt-дистрибутива
|
307 | * Добавление поддержки нового apt-дистрибутива
|
308 | *
|
308 | *
|
309 | * @author Alexander Wolf
|
309 | * @author Alexander Wolf
|
310 | * @category Core
|
310 | * @category Core
|
311 | *
|
311 | *
|
312 | * @param string $distname
|
312 | * @param string $distname
|
313 | * @param integer $disttype
|
313 | * @param integer $disttype
|
314 | * @param string $distua
|
314 | * @param string $distua
|
315 | * @param byte $distlogo
|
315 | * @param byte $distlogo
|
316 | * @return array
|
316 | * @return array
|
317 | */
|
317 | */
|
318 | public function addDistribution($distname, $disttype, $distua = 1, $distlogo = 0) { |
318 | public function addDistribution($distname, $disttype, $distua = 1, $distlogo = 0) { |
319 | $result = array(); |
319 | $result = array(); |
320 | $sDName = $this->secure->checkStr($distname); |
320 | $sDName = $this->secure->checkStr($distname); |
321 | $sDType = $this->secure->checkInt($disttype); |
321 | $sDType = $this->secure->checkInt($disttype); |
322 | $sDUAgt = $this->secure->checkStr($distua); |
322 | $sDUAgt = $this->secure->checkStr($distua); |
323 | $sDLogo = $this->secure->checkInt($distname); |
323 | $sDLogo = $this->secure->checkInt($distname); |
324 | 324 | ||
325 | $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'"; |
325 | $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'"; |
326 | $rq =& $this->db->query($query); |
326 | $rq =& $this->db->query($query); |
327 | if (PEAR::isError($this->db)) { |
327 | if (PEAR::isError($this->db)) { |
328 | $result["ERR"] = 1; |
328 | $result["ERR"] = 1; |
329 | $result["ERRINFO"] = $this->db->getMessage(); |
329 | $result["ERRINFO"] = $this->db->getMessage(); |
330 | } else { |
330 | } else { |
331 | $rq->fetchInto($element); |
331 | $rq->fetchInto($element); |
332 | $result["ERR"] = 0; |
332 | $result["ERR"] = 0; |
333 | }
|
333 | }
|
334 | 334 | ||
335 | return $result; |
335 | return $result; |
336 | }
|
336 | }
|
337 | 337 | ||
338 | /**
|
338 | /**
|
339 | * Добавление поддержки новой версии apt-дистрибутива
|
339 | * Добавление поддержки новой версии apt-дистрибутива
|
340 | *
|
340 | *
|
341 | * @author Alexander Wolf
|
341 | * @author Alexander Wolf
|
342 | * @category Core
|
342 | * @category Core
|
343 | *
|
343 | *
|
344 | * @param integer $distID
|
344 | * @param integer $distID
|
345 | * @param integer $version
|
345 | * @param integer $version
|
346 | * @param string $vname
|
346 | * @param string $vname
|
347 | * @param integer $vcodename
|
347 | * @param integer $vcodename
|
348 | * @return array
|
348 | * @return array
|
349 | */
|
349 | */
|
350 | public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
350 | public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
351 | $result = array(); |
351 | $result = array(); |
352 | $sDistID = $this->secure->checkInt($distID); |
352 | $sDistID = $this->secure->checkInt($distID); |
353 | $sDVersion = $this->secure->checkStr($version); |
353 | $sDVersion = $this->secure->checkStr($version); |
354 | $sDVName = $this->secure->checkStr($vname); |
354 | $sDVName = $this->secure->checkStr($vname); |
355 | $sDVCName = $this->secure->checkInt($vcodename); |
355 | $sDVCName = $this->secure->checkInt($vcodename); |
356 | 356 | ||
357 | $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'"; |
357 | $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'"; |
358 | $rq =& $this->db->query($query); |
358 | $rq =& $this->db->query($query); |
359 | if (PEAR::isError($this->db)) { |
359 | if (PEAR::isError($this->db)) { |
360 | $result["ERR"] = 1; |
360 | $result["ERR"] = 1; |
361 | $result["ERRINFO"] = $this->db->getMessage(); |
361 | $result["ERRINFO"] = $this->db->getMessage(); |
362 | } else { |
362 | } else { |
363 | $rq->fetchInto($element); |
363 | $rq->fetchInto($element); |
364 | $result["ERR"] = 0; |
364 | $result["ERR"] = 0; |
365 | }
|
365 | }
|
366 | 366 | ||
367 | return $result; |
367 | return $result; |
368 | }
|
368 | }
|
369 | 369 | ||
370 | /**
|
370 | /**
|
371 | * Отображение типа дистрибутива
|
371 | * Отображение типа дистрибутива
|
372 | *
|
372 | *
|
373 | * @author Alexander Wolf
|
373 | * @author Alexander Wolf
|
374 | * @category Core
|
374 | * @category Core
|
375 | *
|
375 | *
|
376 | * @param string $name
|
376 | * @param string $name
|
377 | * @param byte $type
|
377 | * @param byte $type
|
378 | * @return string
|
378 | * @return string
|
379 | */
|
379 | */
|
380 | public function showDistTypeForm($name = "dtype",$type = 0) { |
380 | public function showDistTypeForm($name = "dtype",$type = 0) { |
381 | $query = "SELECT * FROM ".$this->prefix."dtype"; |
381 | $query = "SELECT * FROM ".$this->prefix."dtype"; |
382 | $rq =& $this->db->query($query); |
382 | $rq =& $this->db->query($query); |
383 | $show = "<select name='".$name."' id='".$name."'>\n"; |
383 | $show = "<select name='".$name."' id='".$name."'>\n"; |
384 | while ($rq->fetchInto($element)) { |
384 | while ($rq->fetchInto($element)) { |
385 | if ($element["type_id"] == $type) { |
385 | if ($element["type_id"] == $type) { |
386 | $show .= "<option value='".$element["type_id"]."' selected>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
386 | $show .= "<option value='".$element["type_id"]."' selected>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
387 | } else { |
387 | } else { |
388 | $show .= "<option value='".$element["type_id"]."'>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
388 | $show .= "<option value='".$element["type_id"]."'>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
389 | }
|
389 | }
|
390 | }
|
390 | }
|
391 | $show .= "</select>"; |
391 | $show .= "</select>"; |
392 | 392 | ||
393 | return $show; |
393 | return $show; |
394 | }
|
394 | }
|
395 | 395 | ||
396 | /**
|
396 | /**
|
397 | * Отображение формы создания и редактирования apt-дистрибутива
|
397 | * Отображение формы создания и редактирования apt-дистрибутива
|
398 | *
|
398 | *
|
399 | * @author Alexander Wolf
|
399 | * @author Alexander Wolf
|
400 | * @category Core
|
400 | * @category Core
|
401 | *
|
401 | *
|
402 | * @param integer $distID
|
402 | * @param integer $distID
|
403 | * @return string
|
403 | * @return string
|
404 | */
|
404 | */
|
405 | public function showDistributionForm($distID = 0) { |
405 | public function showDistributionForm($distID = 0) { |
406 | $sDistID = $this->secure->checkInt($distID); |
406 | $sDistID = $this->secure->checkInt($distID); |
407 | if ($sDistID != 0) { |
407 | if ($sDistID != 0) { |
408 | // Режим редактирования
|
408 | // Режим редактирования
|
409 | $query = "SELECT * FROM ".$this->prefix."distribution WHERE dist_id='".$sDistID."'"; |
409 | $query = "SELECT * FROM ".$this->prefix."distribution WHERE dist_id='".$sDistID."'"; |
410 | $rq =& $this->db->query($query); |
410 | $rq =& $this->db->query($query); |
411 | $rq->fetchInto($element); |
411 | $rq->fetchInto($element); |
412 | }
|
412 | }
|
413 | 413 | ||
414 | if ($element["distlogo"] == 1) { |
414 | if ($element["distlogo"] == 1) { |
415 | $image = "<img src='./img/d/".$this->secure->checkStr($element["distua"],1).".png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива ".$this->secure->checkStr($element["distname"],1)."' title='Логотип дистрибутива ".$this->secure->checkStr($element["distname"],1)."'>"; |
415 | $image = "<img src='./img/d/".$this->secure->checkStr($element["distua"],1).".png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива ".$this->secure->checkStr($element["distname"],1)."' title='Логотип дистрибутива ".$this->secure->checkStr($element["distname"],1)."'>"; |
416 | } else { |
416 | } else { |
417 | $image = "<img src='./img/d/empty-logo.png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива' title='Логотип дистрибутива не загружен'>"; |
417 | $image = "<img src='./img/d/empty-logo.png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива' title='Логотип дистрибутива не загружен'>"; |
418 | }
|
418 | }
|
419 | 419 | ||
420 | $show = "<fieldset><legend>Дистрибутив</legend>\n"; |
420 | $show = "<fieldset><legend>Дистрибутив</legend>\n"; |
421 | $show .= "<div class='inputbox'><label for='dname'>Название дистрибутива:</label> <input type='text' name='dname' id='dname' value='".$this->secure->checkStr($element["distname"],1)."'></div>\n"; |
421 | $show .= "<div class='inputbox'><label for='dname'>Название дистрибутива:</label> <input type='text' name='dname' id='dname' value='".$this->secure->checkStr($element["distname"],1)."'></div>\n"; |
422 | $show .= "<div class='inputbox'><label for='dua'>UA дистрибутива:</label> <input type='text' name='dua' id='dua' value='".$this->secure->checkStr($element["distua"],1)."'></div>\n"; |
422 | $show .= "<div class='inputbox'><label for='dua'>UA дистрибутива:</label> <input type='text' name='dua' id='dua' value='".$this->secure->checkStr($element["distua"],1)."'></div>\n"; |
423 | $show .= "<div class='inputbox'><label for='dtype'>Тип дистрибутива:</label> ".$this->showDistTypeForm("dtype",$element["dtype_id"])."</div>\n"; |
423 | $show .= "<div class='inputbox'><label for='dtype'>Тип дистрибутива:</label> ".$this->showDistTypeForm("dtype",$element["dtype_id"])."</div>\n"; |
424 | $show .= "<div class='inputbox'><table><tr><td class='td-name'>Логотип дистрибутива:</td>\n"; |
424 | $show .= "<div class='inputbox'><table><tr><td class='td-name'>Логотип дистрибутива:</td>\n"; |
425 | $show .= "<td>".$image."</td>\n<td><input type='file' name='distlogo'></td>\n</tr></table>\n</div>\n"; |
425 | $show .= "<td>".$image."</td>\n<td><input type='file' name='distlogo'></td>\n</tr></table>\n</div>\n"; |
426 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
426 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
427 | 427 | ||
428 | return $show; |
428 | return $show; |
429 | }
|
429 | }
|
430 | 430 | ||
431 | // sourses.list
|
431 | // sourses.list
|
432 | public function showSourcesList($distID,$versID,$sectIDs,$repIDs) { |
432 | public function showSourcesList($distID,$versID,$sectIDs,$repIDs) { |
433 | //TODO Написать генератор sources.list
|
433 | //TODO Написать генератор sources.list
|
434 | }
|
434 | }
|
435 | 435 | ||
436 | /**
|
436 | /**
|
437 | * Проверка пароля (из формы авторизации)
|
437 | * Проверка пароля (из формы авторизации)
|
438 | *
|
438 | *
|
439 | * @author Alexander Wolf
|
439 | * @author Alexander Wolf
|
440 | * @category Core
|
440 | * @category Core
|
441 | *
|
441 | *
|
442 | * @param string $word
|
442 | * @param string $word
|
443 | * @return array
|
443 | * @return array
|
444 | */
|
444 | */
|
445 | public function checkSign($word) { |
445 | public function checkSign($word) { |
446 | $result = array(); |
446 | $result = array(); |
447 | 447 | ||
448 | $sHash = $this->secure->encryptStr($word); |
448 | $sHash = $this->secure->encryptStr($word); |
449 | $pwd = $this->getOption("passwd"); |
449 | $pwd = $this->getOption("passwd"); |
450 | if ($sHash == $pwd["OptValue"]) { |
450 | if ($sHash == $pwd["OptValue"]) { |
451 | $result["ERR"] = 0; |
451 | $result["ERR"] = 0; |
452 | $result["Location"] = "manager.php"; |
452 | $result["Location"] = "manager.php"; |
453 | setcookie($this->cookie, $sHash); |
453 | setcookie($this->cookie, $sHash); |
454 | } else { |
454 | } else { |
455 | $result["ERR"] = 1; |
455 | $result["ERR"] = 1; |
456 | $result["ERRINFO"] = "Password not valid"; |
456 | $result["ERRINFO"] = "Password not valid"; |
457 | $result["Location"] = "manager.php?error=1"; |
457 | $result["Location"] = "manager.php?error=1"; |
458 | }
|
458 | }
|
459 | 459 | ||
460 | return $result; |
460 | return $result; |
461 | }
|
461 | }
|
462 | 462 | ||
463 | /**
|
463 | /**
|
464 | * Проверка пароля (из cookies)
|
464 | * Проверка пароля (из cookies)
|
465 | *
|
465 | *
|
466 | * @author Alexander Wolf
|
466 | * @author Alexander Wolf
|
467 | * @category Core
|
467 | * @category Core
|
468 | *
|
468 | *
|
469 | * @param string $hash
|
469 | * @param string $hash
|
470 | * @return array
|
470 | * @return array
|
471 | */
|
471 | */
|
472 | public function checkCookieSign($hash) { |
472 | public function checkCookieSign($hash) { |
473 | $result = array(); |
473 | $result = array(); |
474 | 474 | ||
475 | $pwd = $this->getOption("passwd"); |
475 | $pwd = $this->getOption("passwd"); |
476 | if ($hash == $pwd["OptValue"]) { |
476 | if ($hash == $pwd["OptValue"]) { |
477 | $result["ERR"] = 0; |
477 | $result["ERR"] = 0; |
478 | } else { |
478 | } else { |
479 | $result["ERR"] = 1; |
479 | $result["ERR"] = 1; |
480 | $result["ERRINFO"] = "Hash not valid"; |
480 | $result["ERRINFO"] = "Hash not valid"; |
481 | $result["Location"] = "manager.php"; |
481 | $result["Location"] = "manager.php"; |
482 | }
|
482 | }
|
483 | 483 | ||
484 | return $result; |
484 | return $result; |
485 | }
|
485 | }
|
486 | 486 | ||
487 | /**
|
487 | /**
|
488 | * Форма ввода пароля
|
488 | * Форма ввода пароля
|
489 | *
|
489 | *
|
490 | * @author Alexander Wolf
|
490 | * @author Alexander Wolf
|
491 | * @category Core
|
491 | * @category Core
|
492 | *
|
492 | *
|
493 | * @return string
|
493 | * @return string
|
494 | */
|
494 | */
|
495 | public function showSigninForm() { |
495 | public function showSigninForm() { |
496 | $show = "<div id='regform'>"; |
496 | $show = "<div id='regform'>"; |
497 | $show .= "<form action='process.php' method='post'>\n"; |
497 | $show .= "<form action='process.php' method='post'>\n"; |
498 | $show .= "<fieldset><legend>Пароль</legend>\n"; |
498 | $show .= "<fieldset><legend>Пароль</legend>\n"; |
499 | $show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
499 | $show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
500 | $show .= "<input type='password' name='word' value=''>\n"; |
500 | $show .= "<input type='password' name='word' value=''>\n"; |
501 | $show .= "<input type='submit' value=' Войти '>\n"; |
501 | $show .= "<input type='submit' value=' Войти '>\n"; |
502 | $show .= "</fieldset>\n</form></div>\n"; |
502 | $show .= "</fieldset>\n</form></div>\n"; |
503 | 503 | ||
504 | return $show; |
504 | return $show; |
505 | }
|
505 | }
|
506 | 506 | ||
507 | /**
|
507 | /**
|
508 | * Обновление пароля
|
508 | * Обновление пароля
|
509 | *
|
509 | *
|
510 | * @author Alexander Wolf
|
510 | * @author Alexander Wolf
|
511 | * @category Core
|
511 | * @category Core
|
512 | *
|
512 | *
|
513 | * @param string $word1
|
513 | * @param string $word1
|
514 | * @param string $word2
|
514 | * @param string $word2
|
515 | * @return array
|
515 | * @return array
|
516 | */
|
516 | */
|
517 | public function updatePassword($word1, $word2) { |
517 | public function updatePassword($word1, $word2) { |
518 | $result = array(); |
518 | $result = array(); |
519 | 519 | ||
520 | if ($word1 == $word2) { |
520 | if ($word1 == $word2) { |
521 | $sWord = $this->secure->encryptStr($word1); |
521 | $sWord = $this->secure->encryptStr($word1); |
522 | $r = $this->setOption("passwd", $sWord); |
522 | $r = $this->setOption("passwd", $sWord); |
523 | $result = $r; |
523 | $result = $r; |
524 | } else { |
524 | } else { |
525 | $result["ERR"] = 1; |
525 | $result["ERR"] = 1; |
526 | $result["ERRINFO"] = "Passwords is mismatch"; |
526 | $result["ERRINFO"] = "Passwords is mismatch"; |
527 | }
|
527 | }
|
528 | 528 | ||
529 | return $result; |
529 | return $result; |
530 | }
|
530 | }
|
531 | 531 | ||
532 | /**
|
532 | /**
|
533 | * Показ формы редактирования версии дистрибутива или его списка
|
533 | * Показ формы редактирования версии дистрибутива или его списка
|
534 | *
|
534 | *
|
535 | * @author Alexander Wolf
|
535 | * @author Alexander Wolf
|
536 | * @category Core
|
536 | * @category Core
|
537 | *
|
537 | *
|
538 | * @param string $name
|
538 | * @param string $name
|
539 | * @param string $actor
|
539 | * @param string $actor
|
540 | * @param integer $versionID
|
540 | * @param integer $versionID
|
541 | * @return string
|
541 | * @return string
|
542 | */
|
542 | */
|
543 | public function showDistVersionsEditor($name, $actor, $versionID = 0) { |
543 | public function showDistVersionsEditor($name, $actor, $versionID = 0) { |
544 | if ($versionID == 0) { |
544 | if ($versionID == 0) { |
545 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id ORDER BY d.dist_id,v.version ASC"; |
545 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id ORDER BY d.dist_id,v.version ASC"; |
546 | $rq =& $this->db->query($query); |
546 | $rq =& $this->db->query($query); |
547 | $show = "<ul>\n"; |
547 | $show = "<ul>\n"; |
548 | while ($rq->fetchInto($element)) { |
548 | while ($rq->fetchInto($element)) { |
549 | $show .= "<li>[<a href='".$actor."?mode=versions&action=edit&uuid=".$this->secure->checkInt($element["version_id"])."'>править</a>][<a href='".$actor."?mode=versions&action=delete&uuid=".$this->secure->checkInt($element["version_id"])."'>удалить</a>] ".$this->secure->checkStr($element["distname"],1)." ".$this->secure->checkStr($element["version"],1)." “<em>".$this->secure->checkStr($element["vname"],1)."</em>”</li>\n"; |
549 | $show .= "<li>[<a href='".$actor."?mode=versions&action=edit&uuid=".$this->secure->checkInt($element["version_id"])."'>править</a>][<a href='".$actor."?mode=versions&action=delete&uuid=".$this->secure->checkInt($element["version_id"])."'>удалить</a>] ".$this->secure->checkStr($element["distname"],1)." ".$this->secure->checkStr($element["version"],1)." “<em>".$this->secure->checkStr($element["vname"],1)."</em>”</li>\n"; |
550 | }
|
550 | }
|
551 | $show .= "</ul>"; |
551 | $show .= "</ul>"; |
552 | } else { |
552 | } else { |
553 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id WHERE v.version_id='".$versionID."'"; |
553 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id WHERE v.version_id='".$versionID."'"; |
554 | $rq =& $this->db->query($query); |
554 | $rq =& $this->db->query($query); |
555 | $rq->fetchInto($element); |
555 | $rq->fetchInto($element); |
556 | $show = "<form action='".$actor."' method='post'>\n"; |
556 | $show = "<form action='".$actor."' method='post'>\n"; |
557 | $show .= "<fieldset><legend>Редактирование описания версии дистрибутива</legend>\n"; |
557 | $show .= "<fieldset><legend>Редактирование описания версии дистрибутива</legend>\n"; |
558 | $show .= "<input type='hidden' name='mode' value='".$name."-edit'>\n"; |
558 | $show .= "<input type='hidden' name='mode' value='".$name."-edit'>\n"; |
559 | $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\n"; |
559 | $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\n"; |
560 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n"; |
560 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n"; |
561 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."'></div>\n"; |
561 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."'></div>\n"; |
562 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."'></div>\n"; |
562 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."'></div>\n"; |
563 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."'></div>\n"; |
563 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."'></div>\n"; |
564 | $show .= "<div class='inputbox'><input type='submit' value=' Править '></div></fieldset></form>\n"; |
564 | $show .= "<div class='inputbox'><input type='submit' value=' Править '></div></fieldset></form>\n"; |
565 | }
|
565 | }
|
566 | return $show; |
566 | return $show; |
567 | }
|
567 | }
|
568 | 568 | ||
569 | public function showDistVersionsForm($name, $actor, $versionID = 0) { |
569 | public function showDistVersionsForm($name, $actor, $versionID = 0) { |
570 | $show = "<form action='".$actor."' method='post'>"; |
570 | $show = "<form action='".$actor."' method='post'>"; |
571 | if ($versionID == 0) { |
571 | if ($versionID == 0) { |
572 | $show .= "<fieldset><legend>Добавить описание новой версии дистрибутива</legend>\n"; |
572 | $show .= "<fieldset><legend>Добавить описание новой версии дистрибутива</legend>\n"; |
573 | $show .= "<input type='hidden' name='mode' value='".$name."-add'>\n"; |
573 | $show .= "<input type='hidden' name='mode' value='".$name."-add'>\n"; |
574 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> ".$this->showDistributionList("distname", "", "", "innerhtml") ."</div>\n"; |
574 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> ".$this->showDistributionList("distname", "", "", "innerhtml") ."</div>\n"; |
575 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value=''></div>\n"; |
575 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value=''></div>\n"; |
576 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value=''></div>\n"; |
576 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value=''></div>\n"; |
577 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value=''></div>\n"; |
577 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value=''></div>\n"; |
578 | $show .= "<div class='inputbox'><input type='submit' value=' Добавить '></div></fieldset>\n"; |
578 | $show .= "<div class='inputbox'><input type='submit' value=' Добавить '></div></fieldset>\n"; |
579 | } else { |
579 | } else { |
- | 580 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id WHERE v.version_id='".$versionID."'"; |
|
- | 581 | $rq =& $this->db->query($query); |
|
- | 582 | $rq->fetchInto($element); |
|
580 | $show .= "<fieldset><legend>Удалить описание существующей версии дистрибутива</legend>\n"; |
583 | $show .= "<fieldset><legend>Удалить описание существующей версии дистрибутива</legend>\n"; |
581 | $show .= "<input type='hidden' name='mode' value='".$name."-delete'>\n"; |
584 | $show .= "<input type='hidden' name='mode' value='".$name."-delete'>\n"; |
582 | $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\n"; |
585 | $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\n"; |
583 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n"; |
586 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n"; |
584 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."' readonly='readonly'></div>\n"; |
587 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."' readonly='readonly'></div>\n"; |
585 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."' readonly='readonly'></div>\n"; |
588 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."' readonly='readonly'></div>\n"; |
586 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."' readonly='readonly'></div>\n"; |
589 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."' readonly='readonly'></div>\n"; |
587 | $show .= "<div class='inputbox'><input type='submit' value=' Удалить '></div></fieldset>\n"; |
590 | $show .= "<div class='inputbox'><input type='submit' value=' Удалить '></div></fieldset>\n"; |
588 | }
|
591 | }
|
589 | $show .= "</form>"; |
592 | $show .= "</form>"; |
590 | 593 | ||
591 | return $show; |
594 | return $show; |
592 | }
|
595 | }
|
593 | 596 | ||
594 | }
|
597 | }
|
595 | 598 | ||
596 | ?>
|
599 | ?>
|