Редакция 505 | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 505 | Редакция 506 | ||
---|---|---|---|
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 | case 'list': |
|
- | 160 | $show = "<ul>"; |
|
- | 161 | while ($rq->fetchInto($element)) { |
|
- | 162 | $show .= "<li>[<a href='".$heads."?mode=distributions&action=edit&uuid=".$this->secure->checkInt($element["dist_id"])."'>править</a>][<a href='".$heads."?mode=distributions&action=delete&uuid=".$this->secure->checkInt($element["dist_id"])."'>удалить</a>] ".$this->secure->checkStr($element["distname"],1)."</li>\n"; |
|
- | 163 | }
|
|
- | 164 | $show .= "</ul>"; |
|
- | 165 | break; |
|
159 | }
|
166 | }
|
160 | return $show; |
167 | return $show; |
161 | }
|
168 | }
|
162 | 169 | ||
163 | /**
|
170 | /**
|
164 | * Получение названия дистрибутива
|
171 | * Получение названия дистрибутива
|
165 | *
|
172 | *
|
166 | * @author Alexander Wolf
|
173 | * @author Alexander Wolf
|
167 | * @category Core
|
174 | * @category Core
|
168 | *
|
175 | *
|
169 | * @param integer $distID
|
176 | * @param integer $distID
|
170 | * @return array
|
177 | * @return array
|
171 | */
|
178 | */
|
172 | public function getDistName($distID) { |
179 | public function getDistName($distID) { |
173 | $result = array(); |
180 | $result = array(); |
174 | $query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'"; |
181 | $query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'"; |
175 | $rq =& $this->db->query($query); |
182 | $rq =& $this->db->query($query); |
176 | if (PEAR::isError($this->db)) { |
183 | if (PEAR::isError($this->db)) { |
177 | $result["ERR"] = 1; |
184 | $result["ERR"] = 1; |
178 | $result["ERRINFO"] = $this->db->getMessage(); |
185 | $result["ERRINFO"] = $this->db->getMessage(); |
179 | } else { |
186 | } else { |
180 | $rq->fetchInto($element); |
187 | $rq->fetchInto($element); |
181 | $result["ERR"] = 0; |
188 | $result["ERR"] = 0; |
182 | $result["DistName"] = $this->secure->checkStr($element["distname"],1); |
189 | $result["DistName"] = $this->secure->checkStr($element["distname"],1); |
183 | }
|
190 | }
|
184 | 191 | ||
185 | return $result; |
192 | return $result; |
186 | }
|
193 | }
|
187 | 194 | ||
188 | /**
|
195 | /**
|
189 | * Получение названия программы, ее версии и описания
|
196 | * Получение названия программы, ее версии и описания
|
190 | *
|
197 | *
|
191 | * @author Alexander Wolf
|
198 | * @author Alexander Wolf
|
192 | * @category Core
|
199 | * @category Core
|
193 | *
|
200 | *
|
194 | * @param string $attr
|
201 | * @param string $attr
|
195 | * @return string
|
202 | * @return string
|
196 | */
|
203 | */
|
197 | public function getEngineAttr($attr = 'codename') { |
204 | public function getEngineAttr($attr = 'codename') { |
198 | $cname = $this->getOption($attr); |
205 | $cname = $this->getOption($attr); |
199 | return $this->secure->checkStr($cname["OptValue"],1); |
206 | return $this->secure->checkStr($cname["OptValue"],1); |
200 | }
|
207 | }
|
201 | 208 | ||
202 | /**
|
209 | /**
|
203 | * Получение и отображение списка версий дистрибутива
|
210 | * Получение и отображение списка версий дистрибутива
|
204 | *
|
211 | *
|
205 | * @author Alexander Wolf
|
212 | * @author Alexander Wolf
|
206 | * @category Core
|
213 | * @category Core
|
207 | *
|
214 | *
|
208 | * @param string $name
|
215 | * @param string $name
|
209 | * @param integer $distID
|
216 | * @param integer $distID
|
210 | * @param string $format
|
217 | * @param string $format
|
211 | * @return string
|
218 | * @return string
|
212 | */
|
219 | */
|
213 | public function showDistVersionsList($name, $distID, $format = 'html') { |
220 | public function showDistVersionsList($name, $distID, $format = 'html') { |
214 | $distname = $this->getDistName($distID); |
221 | $distname = $this->getDistName($distID); |
215 | $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
222 | $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
216 | $rq =& $this->db->query($query); |
223 | $rq =& $this->db->query($query); |
217 | switch ($format) { |
224 | switch ($format) { |
218 | case 'html': |
225 | case 'html': |
219 | $show = "<fieldset><legend>Версии ".$distname["DistName"]."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
226 | $show = "<fieldset><legend>Версии ".$distname["DistName"]."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
220 | $show .= "<option value=''>Выбери версию ".$distname["DistName"]."</option>\n"; |
227 | $show .= "<option value=''>Выбери версию ".$distname["DistName"]."</option>\n"; |
221 | while ($rq->fetchInto($element)) { |
228 | 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"; |
229 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["version"],1)." ".$this->secure->checkStr($element["vname"],1)."</option>\n"; |
223 | }
|
230 | }
|
224 | $show .= "</select></fieldset>"; |
231 | $show .= "</select></fieldset>"; |
225 | break; |
232 | break; |
226 | case 'json': |
233 | case 'json': |
227 | $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}'; |
234 | $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}'; |
228 | while ($rq->fetchInto($element)) { |
235 | 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).'"}'; |
236 | $show .= ',{value:"'.$this->secure->checkInt($element["version_id"]).'",text:"'.$this->secure->checkStr($element["version"],1).' '.$this->secure->checkStr($element["vname"],1).'"}'; |
230 | }
|
237 | }
|
231 | $show .= ']'; |
238 | $show .= ']'; |
232 | break; |
239 | break; |
233 | }
|
240 | }
|
234 | return $show; |
241 | return $show; |
235 | }
|
242 | }
|
236 | 243 | ||
237 | /**
|
244 | /**
|
238 | * Получение и отображение списка секций основного (официального) репозитория
|
245 | * Получение и отображение списка секций основного (официального) репозитория
|
239 | *
|
246 | *
|
240 | * @author Alexander Wolf
|
247 | * @author Alexander Wolf
|
241 | * @category Core
|
248 | * @category Core
|
242 | *
|
249 | *
|
243 | * @param integer $version
|
250 | * @param integer $version
|
244 | * @param string $format
|
251 | * @param string $format
|
245 | * @return string
|
252 | * @return string
|
246 | */
|
253 | */
|
247 | public function showBranchesList($version, $format = 'html') { |
254 | public function showBranchesList($version, $format = 'html') { |
248 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
255 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
249 | $rq =& $this->db->query($query); |
256 | $rq =& $this->db->query($query); |
250 | $rq->fetchInto($types); |
257 | $rq->fetchInto($types); |
251 | $query = "SELECT s.*,t.rtype FROM ".$this->prefix."section s "; |
258 | $query = "SELECT s.*,t.rtype FROM ".$this->prefix."section s "; |
252 | $query .= "JOIN ".$this->prefix."sect2rep l ON s.sect_id=l.sect_id "; |
259 | $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 "; |
260 | $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 "; |
261 | $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)."'"; |
262 | $query .= "WHERE t.rtype_id='1' AND r.version='".$this->secure->checkInt($version)."'"; |
256 | $rq =& $this->db->query($query); |
263 | $rq =& $this->db->query($query); |
257 | switch ($format) { |
264 | switch ($format) { |
258 | case 'html': |
265 | case 'html': |
259 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
266 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
260 | while ($rq->fetchInto($element)) { |
267 | 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"; |
268 | $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 | }
|
269 | }
|
263 | $show .= "</fieldset>\n"; |
270 | $show .= "</fieldset>\n"; |
264 | break; |
271 | break; |
265 | case 'json': |
272 | case 'json': |
266 | //TODO Доделать JSON-вывод списка секций основного репозитория
|
273 | //TODO Доделать JSON-вывод списка секций основного репозитория
|
267 | break; |
274 | break; |
268 | }
|
275 | }
|
269 | 276 | ||
270 | return $show; |
277 | return $show; |
271 | }
|
278 | }
|
272 | 279 | ||
273 | /**
|
280 | /**
|
274 | * Получение и отображение списка репозиториев
|
281 | * Получение и отображение списка репозиториев
|
275 | *
|
282 | *
|
276 | * @author Alexander Wolf
|
283 | * @author Alexander Wolf
|
277 | * @category Core
|
284 | * @category Core
|
278 | *
|
285 | *
|
279 | * @param integer $version
|
286 | * @param integer $version
|
280 | * @param integer $reptype
|
287 | * @param integer $reptype
|
281 | * @param string $format
|
288 | * @param string $format
|
282 | * @return string
|
289 | * @return string
|
283 | */
|
290 | */
|
284 | public function showRepList($version, $reptype, $format = 'html') { |
291 | public function showRepList($version, $reptype, $format = 'html') { |
285 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='".$this->secure->checkInt($reptype)."'"; |
292 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='".$this->secure->checkInt($reptype)."'"; |
286 | $rq =& $this->db->query($query); |
293 | $rq =& $this->db->query($query); |
287 | $rq->fetchInto($types); |
294 | $rq->fetchInto($types); |
288 | $query = "SELECT * FROM ".$this->prefix."repository WHERE version='".$this->secure->checkInt($version)."' AND rtype_id='".$this->secure->checkInt($reptype)."'"; |
295 | $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); |
296 | $rq =& $this->db->query($query); |
290 | switch ($format) { |
297 | switch ($format) { |
291 | case 'html': |
298 | case 'html': |
292 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
299 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
293 | while ($rq->fetchInto($types)) { |
300 | 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"; |
301 | $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 | }
|
302 | }
|
296 | $show .= "</fieldset>\n"; |
303 | $show .= "</fieldset>\n"; |
297 | break; |
304 | break; |
298 | case 'json': |
305 | case 'json': |
299 | //TODO Доделать JSON-вывод списка репозиториев
|
306 | //TODO Доделать JSON-вывод списка репозиториев
|
300 | break; |
307 | break; |
301 | }
|
308 | }
|
302 | 309 | ||
303 | return $show; |
310 | return $show; |
304 | }
|
311 | }
|
305 | 312 | ||
306 | /**
|
313 | /**
|
307 | * Добавление поддержки нового apt-дистрибутива
|
314 | * Добавление поддержки нового apt-дистрибутива
|
308 | *
|
315 | *
|
309 | * @author Alexander Wolf
|
316 | * @author Alexander Wolf
|
310 | * @category Core
|
317 | * @category Core
|
311 | *
|
318 | *
|
312 | * @param string $distname
|
319 | * @param string $distname
|
313 | * @param integer $disttype
|
320 | * @param integer $disttype
|
314 | * @param string $distua
|
321 | * @param string $distua
|
315 | * @param byte $distlogo
|
322 | * @param byte $distlogo
|
316 | * @return array
|
323 | * @return array
|
317 | */
|
324 | */
|
318 | public function addDistribution($distname, $disttype, $distua = 1, $distlogo = 0) { |
325 | public function addDistribution($distname, $disttype, $distua = 1, $distlogo = 0) { |
319 | $result = array(); |
326 | $result = array(); |
320 | $sDName = $this->secure->checkStr($distname); |
327 | $sDName = $this->secure->checkStr($distname); |
321 | $sDType = $this->secure->checkInt($disttype); |
328 | $sDType = $this->secure->checkInt($disttype); |
322 | $sDUAgt = $this->secure->checkStr($distua); |
329 | $sDUAgt = $this->secure->checkStr($distua); |
323 | $sDLogo = $this->secure->checkInt($distname); |
330 | $sDLogo = $this->secure->checkInt($distname); |
324 | 331 | ||
325 | $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'"; |
332 | $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'"; |
326 | $rq =& $this->db->query($query); |
333 | $rq =& $this->db->query($query); |
327 | if (PEAR::isError($this->db)) { |
334 | if (PEAR::isError($this->db)) { |
328 | $result["ERR"] = 1; |
335 | $result["ERR"] = 1; |
329 | $result["ERRINFO"] = $this->db->getMessage(); |
336 | $result["ERRINFO"] = $this->db->getMessage(); |
330 | } else { |
337 | } else { |
331 | $rq->fetchInto($element); |
338 | $rq->fetchInto($element); |
332 | $result["ERR"] = 0; |
339 | $result["ERR"] = 0; |
333 | }
|
340 | }
|
334 | 341 | ||
335 | return $result; |
342 | return $result; |
336 | }
|
343 | }
|
337 | 344 | ||
338 | /**
|
345 | /**
|
339 | * Добавление поддержки новой версии apt-дистрибутива
|
346 | * Добавление поддержки новой версии apt-дистрибутива
|
340 | *
|
347 | *
|
341 | * @author Alexander Wolf
|
348 | * @author Alexander Wolf
|
342 | * @category Core
|
349 | * @category Core
|
343 | *
|
350 | *
|
344 | * @param integer $distID
|
351 | * @param integer $distID
|
345 | * @param integer $version
|
352 | * @param integer $version
|
346 | * @param string $vname
|
353 | * @param string $vname
|
347 | * @param integer $vcodename
|
354 | * @param integer $vcodename
|
348 | * @return array
|
355 | * @return array
|
349 | */
|
356 | */
|
350 | public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
357 | public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
351 | $result = array(); |
358 | $result = array(); |
352 | $sDistID = $this->secure->checkInt($distID); |
359 | $sDistID = $this->secure->checkInt($distID); |
353 | $sDVersion = $this->secure->checkStr($version); |
360 | $sDVersion = $this->secure->checkStr($version); |
354 | $sDVName = $this->secure->checkStr($vname); |
361 | $sDVName = $this->secure->checkStr($vname); |
355 | $sDVCName = $this->secure->checkInt($vcodename); |
362 | $sDVCName = $this->secure->checkInt($vcodename); |
356 | 363 | ||
357 | $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'"; |
364 | $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'"; |
358 | $rq =& $this->db->query($query); |
365 | $rq =& $this->db->query($query); |
359 | if (PEAR::isError($this->db)) { |
366 | if (PEAR::isError($this->db)) { |
360 | $result["ERR"] = 1; |
367 | $result["ERR"] = 1; |
361 | $result["ERRINFO"] = $this->db->getMessage(); |
368 | $result["ERRINFO"] = $this->db->getMessage(); |
362 | } else { |
369 | } else { |
363 | $rq->fetchInto($element); |
370 | $rq->fetchInto($element); |
364 | $result["ERR"] = 0; |
371 | $result["ERR"] = 0; |
365 | }
|
372 | }
|
366 | 373 | ||
367 | return $result; |
374 | return $result; |
368 | }
|
375 | }
|
369 | 376 | ||
370 | /**
|
377 | /**
|
371 | * Отображение типа дистрибутива
|
378 | * Отображение типа дистрибутива
|
372 | *
|
379 | *
|
373 | * @author Alexander Wolf
|
380 | * @author Alexander Wolf
|
374 | * @category Core
|
381 | * @category Core
|
375 | *
|
382 | *
|
376 | * @param string $name
|
383 | * @param string $name
|
377 | * @param byte $type
|
384 | * @param byte $type
|
378 | * @return string
|
385 | * @return string
|
379 | */
|
386 | */
|
380 | public function showDistTypeForm($name = "dtype",$type = 0) { |
387 | public function showDistTypeForm($name = "dtype",$type = 0) { |
381 | $query = "SELECT * FROM ".$this->prefix."dtype"; |
388 | $query = "SELECT * FROM ".$this->prefix."dtype"; |
382 | $rq =& $this->db->query($query); |
389 | $rq =& $this->db->query($query); |
383 | $show = "<select name='".$name."' id='".$name."'>\n"; |
390 | $show = "<select name='".$name."' id='".$name."'>\n"; |
384 | while ($rq->fetchInto($element)) { |
391 | while ($rq->fetchInto($element)) { |
385 | if ($element["type_id"] == $type) { |
392 | if ($element["type_id"] == $type) { |
386 | $show .= "<option value='".$element["type_id"]."' selected>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
393 | $show .= "<option value='".$element["type_id"]."' selected>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
387 | } else { |
394 | } else { |
388 | $show .= "<option value='".$element["type_id"]."'>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
395 | $show .= "<option value='".$element["type_id"]."'>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
389 | }
|
396 | }
|
390 | }
|
397 | }
|
391 | $show .= "</select>"; |
398 | $show .= "</select>"; |
392 | 399 | ||
393 | return $show; |
400 | return $show; |
394 | }
|
401 | }
|
395 | 402 | ||
396 | /**
|
403 | /**
|
397 | * Отображение формы создания и редактирования apt-дистрибутива
|
404 | * Отображение формы создания и редактирования apt-дистрибутива
|
398 | *
|
405 | *
|
399 | * @author Alexander Wolf
|
406 | * @author Alexander Wolf
|
400 | * @category Core
|
407 | * @category Core
|
401 | *
|
408 | *
|
402 | * @param integer $distID
|
409 | * @param integer $distID
|
403 | * @return string
|
410 | * @return string
|
404 | */
|
411 | */
|
405 | public function showDistributionForm($distID = 0) { |
412 | public function showDistributionForm($distID = 0) { |
406 | $sDistID = $this->secure->checkInt($distID); |
413 | $sDistID = $this->secure->checkInt($distID); |
407 | if ($sDistID != 0) { |
414 | if ($sDistID != 0) { |
408 | // Режим редактирования
|
415 | // Режим редактирования
|
409 | $query = "SELECT * FROM ".$this->prefix."distribution WHERE dist_id='".$sDistID."'"; |
416 | $query = "SELECT * FROM ".$this->prefix."distribution WHERE dist_id='".$sDistID."'"; |
410 | $rq =& $this->db->query($query); |
417 | $rq =& $this->db->query($query); |
411 | $rq->fetchInto($element); |
418 | $rq->fetchInto($element); |
412 | }
|
419 | }
|
413 | 420 | ||
414 | if ($element["distlogo"] == 1) { |
421 | 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)."'>"; |
422 | $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 { |
423 | } else { |
417 | $image = "<img src='./img/d/empty-logo.png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива' title='Логотип дистрибутива не загружен'>"; |
424 | $image = "<img src='./img/d/empty-logo.png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива' title='Логотип дистрибутива не загружен'>"; |
418 | }
|
425 | }
|
419 | 426 | ||
420 | $show = "<fieldset><legend>Дистрибутив</legend>\n"; |
427 | $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"; |
428 | $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"; |
429 | $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"; |
430 | $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"; |
431 | $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"; |
432 | $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"; |
433 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
427 | 434 | ||
428 | return $show; |
435 | return $show; |
429 | }
|
436 | }
|
430 | 437 | ||
431 | // sourses.list
|
438 | // sourses.list
|
432 | public function showSourcesList($distID,$versID,$sectIDs,$repIDs) { |
439 | public function showSourcesList($distID,$versID,$sectIDs,$repIDs) { |
433 | //TODO Написать генератор sources.list
|
440 | //TODO Написать генератор sources.list
|
434 | }
|
441 | }
|
435 | 442 | ||
436 | /**
|
443 | /**
|
437 | * Проверка пароля (из формы авторизации)
|
444 | * Проверка пароля (из формы авторизации)
|
438 | *
|
445 | *
|
439 | * @author Alexander Wolf
|
446 | * @author Alexander Wolf
|
440 | * @category Core
|
447 | * @category Core
|
441 | *
|
448 | *
|
442 | * @param string $word
|
449 | * @param string $word
|
443 | * @return array
|
450 | * @return array
|
444 | */
|
451 | */
|
445 | public function checkSign($word) { |
452 | public function checkSign($word) { |
446 | $result = array(); |
453 | $result = array(); |
447 | 454 | ||
448 | $sHash = $this->secure->encryptStr($word); |
455 | $sHash = $this->secure->encryptStr($word); |
449 | $pwd = $this->getOption("passwd"); |
456 | $pwd = $this->getOption("passwd"); |
450 | if ($sHash == $pwd["OptValue"]) { |
457 | if ($sHash == $pwd["OptValue"]) { |
451 | $result["ERR"] = 0; |
458 | $result["ERR"] = 0; |
452 | $result["Location"] = "manager.php"; |
459 | $result["Location"] = "manager.php"; |
453 | setcookie($this->cookie, $sHash); |
460 | setcookie($this->cookie, $sHash); |
454 | } else { |
461 | } else { |
455 | $result["ERR"] = 1; |
462 | $result["ERR"] = 1; |
456 | $result["ERRINFO"] = "Password not valid"; |
463 | $result["ERRINFO"] = "Password not valid"; |
457 | $result["Location"] = "manager.php?error=1"; |
464 | $result["Location"] = "manager.php?error=1"; |
458 | }
|
465 | }
|
459 | 466 | ||
460 | return $result; |
467 | return $result; |
461 | }
|
468 | }
|
462 | 469 | ||
463 | /**
|
470 | /**
|
464 | * Проверка пароля (из cookies)
|
471 | * Проверка пароля (из cookies)
|
465 | *
|
472 | *
|
466 | * @author Alexander Wolf
|
473 | * @author Alexander Wolf
|
467 | * @category Core
|
474 | * @category Core
|
468 | *
|
475 | *
|
469 | * @param string $hash
|
476 | * @param string $hash
|
470 | * @return array
|
477 | * @return array
|
471 | */
|
478 | */
|
472 | public function checkCookieSign($hash) { |
479 | public function checkCookieSign($hash) { |
473 | $result = array(); |
480 | $result = array(); |
474 | 481 | ||
475 | $pwd = $this->getOption("passwd"); |
482 | $pwd = $this->getOption("passwd"); |
476 | if ($hash == $pwd["OptValue"]) { |
483 | if ($hash == $pwd["OptValue"]) { |
477 | $result["ERR"] = 0; |
484 | $result["ERR"] = 0; |
478 | } else { |
485 | } else { |
479 | $result["ERR"] = 1; |
486 | $result["ERR"] = 1; |
480 | $result["ERRINFO"] = "Hash not valid"; |
487 | $result["ERRINFO"] = "Hash not valid"; |
481 | $result["Location"] = "manager.php"; |
488 | $result["Location"] = "manager.php"; |
482 | }
|
489 | }
|
483 | 490 | ||
484 | return $result; |
491 | return $result; |
485 | }
|
492 | }
|
486 | 493 | ||
487 | /**
|
494 | /**
|
488 | * Форма ввода пароля
|
495 | * Форма ввода пароля
|
489 | *
|
496 | *
|
490 | * @author Alexander Wolf
|
497 | * @author Alexander Wolf
|
491 | * @category Core
|
498 | * @category Core
|
492 | *
|
499 | *
|
493 | * @return string
|
500 | * @return string
|
494 | */
|
501 | */
|
495 | public function showSigninForm() { |
502 | public function showSigninForm() { |
496 | $show = "<div id='regform'>"; |
503 | $show = "<div id='regform'>"; |
497 | $show .= "<form action='process.php' method='post'>\n"; |
504 | $show .= "<form action='process.php' method='post'>\n"; |
498 | $show .= "<fieldset><legend>Пароль</legend>\n"; |
505 | $show .= "<fieldset><legend>Пароль</legend>\n"; |
499 | $show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
506 | $show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
500 | $show .= "<input type='password' name='word' value=''>\n"; |
507 | $show .= "<input type='password' name='word' value=''>\n"; |
501 | $show .= "<input type='submit' value=' Войти '>\n"; |
508 | $show .= "<input type='submit' value=' Войти '>\n"; |
502 | $show .= "</fieldset>\n</form></div>\n"; |
509 | $show .= "</fieldset>\n</form></div>\n"; |
503 | 510 | ||
504 | return $show; |
511 | return $show; |
505 | }
|
512 | }
|
506 | 513 | ||
507 | /**
|
514 | /**
|
508 | * Обновление пароля
|
515 | * Обновление пароля
|
509 | *
|
516 | *
|
510 | * @author Alexander Wolf
|
517 | * @author Alexander Wolf
|
511 | * @category Core
|
518 | * @category Core
|
512 | *
|
519 | *
|
513 | * @param string $word1
|
520 | * @param string $word1
|
514 | * @param string $word2
|
521 | * @param string $word2
|
515 | * @return array
|
522 | * @return array
|
516 | */
|
523 | */
|
517 | public function updatePassword($word1, $word2) { |
524 | public function updatePassword($word1, $word2) { |
518 | $result = array(); |
525 | $result = array(); |
519 | 526 | ||
520 | if ($word1 == $word2) { |
527 | if ($word1 == $word2) { |
521 | $sWord = $this->secure->encryptStr($word1); |
528 | $sWord = $this->secure->encryptStr($word1); |
522 | $r = $this->setOption("passwd", $sWord); |
529 | $r = $this->setOption("passwd", $sWord); |
523 | $result = $r; |
530 | $result = $r; |
524 | } else { |
531 | } else { |
525 | $result["ERR"] = 1; |
532 | $result["ERR"] = 1; |
526 | $result["ERRINFO"] = "Passwords is mismatch"; |
533 | $result["ERRINFO"] = "Passwords is mismatch"; |
527 | }
|
534 | }
|
528 | 535 | ||
529 | return $result; |
536 | return $result; |
530 | }
|
537 | }
|
531 | 538 | ||
532 | /**
|
539 | /**
|
533 | * Показ формы редактирования версии дистрибутива или его списка
|
540 | * Показ формы редактирования версии дистрибутива или его списка
|
534 | *
|
541 | *
|
535 | * @author Alexander Wolf
|
542 | * @author Alexander Wolf
|
536 | * @category Core
|
543 | * @category Core
|
537 | *
|
544 | *
|
538 | * @param string $name
|
545 | * @param string $name
|
539 | * @param string $actor
|
546 | * @param string $actor
|
540 | * @param integer $versionID
|
547 | * @param integer $versionID
|
541 | * @return string
|
548 | * @return string
|
542 | */
|
549 | */
|
543 | public function showDistVersionsEditor($name, $actor, $versionID = 0) { |
550 | public function showDistVersionsEditor($name, $actor, $versionID = 0) { |
544 | if ($versionID == 0) { |
551 | 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"; |
552 | $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); |
553 | $rq =& $this->db->query($query); |
547 | $show = "<ul>\n"; |
554 | $show = "<ul>\n"; |
548 | while ($rq->fetchInto($element)) { |
555 | 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"; |
556 | $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 | }
|
557 | }
|
551 | $show .= "</ul>"; |
558 | $show .= "</ul>"; |
552 | } else { |
559 | } 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."'"; |
560 | $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); |
561 | $rq =& $this->db->query($query); |
555 | $rq->fetchInto($element); |
562 | $rq->fetchInto($element); |
556 | $show = "<form action='".$actor."' method='post'>\n"; |
563 | $show = "<form action='".$actor."' method='post'>\n"; |
557 | $show .= "<fieldset><legend>Редактирование описания версии дистрибутива</legend>\n"; |
564 | $show .= "<fieldset><legend>Редактирование описания версии дистрибутива</legend>\n"; |
558 | $show .= "<input type='hidden' name='mode' value='".$name."-edit'>\n"; |
565 | $show .= "<input type='hidden' name='mode' value='".$name."-edit'>\n"; |
559 | $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\n"; |
566 | $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"; |
567 | $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"; |
568 | $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"; |
569 | $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"; |
570 | $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"; |
571 | $show .= "<div class='inputbox'><input type='submit' value=' Править '></div></fieldset></form>\n"; |
565 | }
|
572 | }
|
566 | return $show; |
573 | return $show; |
567 | }
|
574 | }
|
568 | 575 | ||
- | 576 | /**
|
|
- | 577 | * Вывод формы добавления и удаления версии дистрибутива
|
|
- | 578 | *
|
|
- | 579 | * @author Alexander Wolf
|
|
- | 580 | * @category Core
|
|
- | 581 | *
|
|
- | 582 | * @param string $name
|
|
- | 583 | * @param string $actor
|
|
- | 584 | * @param integer $versionID
|
|
- | 585 | * @return string
|
|
- | 586 | */
|
|
569 | public function showDistVersionsForm($name, $actor, $versionID = 0) { |
587 | public function showDistVersionsForm($name, $actor, $versionID = 0) { |
570 | $show = "<form action='".$actor."' method='post'>"; |
588 | $show = "<form action='".$actor."' method='post'>"; |
571 | if ($versionID == 0) { |
589 | if ($versionID == 0) { |
572 | $show .= "<fieldset><legend>Добавить описание новой версии дистрибутива</legend>\n"; |
590 | $show .= "<fieldset><legend>Добавить описание новой версии дистрибутива</legend>\n"; |
573 | $show .= "<input type='hidden' name='mode' value='".$name."-add'>\n"; |
591 | $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"; |
592 | $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"; |
593 | $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"; |
594 | $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"; |
595 | $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"; |
596 | $show .= "<div class='inputbox'><input type='submit' value=' Добавить '></div></fieldset>\n"; |
579 | } else { |
597 | } 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."'"; |
598 | $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); |
599 | $rq =& $this->db->query($query); |
582 | $rq->fetchInto($element); |
600 | $rq->fetchInto($element); |
583 | $show .= "<fieldset><legend>Удалить описание существующей версии дистрибутива</legend>\n"; |
601 | $show .= "<fieldset><legend>Удалить описание существующей версии дистрибутива</legend>\n"; |
584 | $show .= "<input type='hidden' name='mode' value='".$name."-delete'>\n"; |
602 | $show .= "<input type='hidden' name='mode' value='".$name."-delete'>\n"; |
585 | $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\n"; |
603 | $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\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"; |
604 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],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"; |
605 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],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"; |
606 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],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"; |
607 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."' readonly='readonly'></div>\n"; |
590 | $show .= "<div class='inputbox'><input type='submit' value=' Удалить '></div></fieldset>\n"; |
608 | $show .= "<div class='inputbox'><input type='submit' value=' Удалить '></div></fieldset>\n"; |
591 | }
|
609 | }
|
592 | $show .= "</form>"; |
610 | $show .= "</form>"; |
593 | 611 | ||
594 | return $show; |
612 | return $show; |
595 | }
|
613 | }
|
596 | 614 | ||
597 | }
|
615 | }
|
598 | 616 | ||
599 | ?>
|
617 | ?>
|