Редакция 672 | Редакция 676 | К новейшей редакции | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 672 | Редакция 675 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | /**
|
3 | /**
|
4 | *
|
4 | *
|
5 | * Codename: ant-ng - generator of sources.list for apt-distributives
|
5 | * Codename: ant-ng - generator of sources.list for apt-distributives
|
6 | * http://alex-w.org.ru/p/antng/
|
6 | * http://alex-w.org.ru/p/antng/
|
7 | *
|
7 | *
|
8 | * Copyright (c) 2009 Alexander Wolf
|
8 | * Copyright (c) 2009 Alexander Wolf
|
9 | * Dual licensed under the MIT and GNU LGPL licenses.
|
9 | * Dual licensed under the MIT and GNU LGPL licenses.
|
10 | * http://alex-w.org.ru/p/antng/license
|
10 | * http://alex-w.org.ru/p/antng/license
|
11 | *
|
11 | *
|
12 | */
|
12 | */
|
13 | 13 | ||
14 | class Core { |
14 | class Core { |
15 | protected $db = NULL; |
15 | protected $db = NULL; |
16 | protected $prefix = NULL; |
16 | protected $prefix = NULL; |
17 | protected $secure = NULL; |
17 | protected $secure = NULL; |
18 | protected $cookie = NULL; |
18 | protected $cookie = NULL; |
19 | 19 | ||
20 | /**
|
20 | /**
|
21 | * Конструктор класса Core - ядро генератора
|
21 | * Конструктор класса Core - ядро генератора
|
22 | *
|
22 | *
|
23 | * @author Alexander Wolf
|
23 | * @author Alexander Wolf
|
24 | * @category Core
|
24 | * @category Core
|
25 | *
|
25 | *
|
26 | * @param string $database
|
26 | * @param string $database
|
27 | * @param string $prefix
|
27 | * @param string $prefix
|
28 | * @param object $secure
|
28 | * @param object $secure
|
29 | * @param string $cookie
|
29 | * @param string $cookie
|
30 | */
|
30 | */
|
31 | public function __construct($database, $prefix, $secure, $cookie) { |
31 | public function __construct($database, $prefix, $secure, $cookie) { |
32 | $this->db = $database; |
32 | $this->db = $database; |
33 | $this->prefix = $prefix; |
33 | $this->prefix = $prefix; |
34 | $this->secure = $secure; |
34 | $this->secure = $secure; |
35 | $this->cookie = $cookie; |
35 | $this->cookie = $cookie; |
36 | }
|
36 | }
|
37 | 37 | ||
38 | /**
|
38 | /**
|
39 | * Получение данных о настройке
|
39 | * Получение данных о настройке
|
40 | *
|
40 | *
|
41 | * @author Alexander Wolf
|
41 | * @author Alexander Wolf
|
42 | * @category Core
|
42 | * @category Core
|
43 | *
|
43 | *
|
44 | * @param string $attr
|
44 | * @param string $attr
|
45 | * @return array
|
45 | * @return array
|
46 | */
|
46 | */
|
47 | public function getOption($attr) { |
47 | public function getOption($attr) { |
48 | $result = array(); |
48 | $result = array(); |
49 | $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkStr($attr)."'"; |
49 | $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkStr($attr)."'"; |
50 | $rq =& $this->db->query($query); |
50 | $rq =& $this->db->query($query); |
51 | if ($rq->numRows()!=0) { |
51 | if ($rq->numRows()!=0) { |
52 | $rq->fetchInto($element); |
52 | $rq->fetchInto($element); |
53 | $result["ERR"] = 0; |
53 | $result["ERR"] = 0; |
54 | $result["OptValue"] = $element["optvalue"]; |
54 | $result["OptValue"] = $element["optvalue"]; |
55 | } else { |
55 | } else { |
56 | $result["ERR"] = 1; |
56 | $result["ERR"] = 1; |
57 | $result["ERRINFO"] = "Empty result"; |
57 | $result["ERRINFO"] = "Empty result"; |
58 | }
|
58 | }
|
59 | return $result; |
59 | return $result; |
60 | }
|
60 | }
|
61 | 61 | ||
62 | /**
|
62 | /**
|
63 | * Установка данных о настройке
|
63 | * Установка данных о настройке
|
64 | *
|
64 | *
|
65 | * @author Alexander Wolf
|
65 | * @author Alexander Wolf
|
66 | * @category Core
|
66 | * @category Core
|
67 | *
|
67 | *
|
68 | * @param string $attr
|
68 | * @param string $attr
|
69 | * @param string $value
|
69 | * @param string $value
|
70 | * @return array
|
70 | * @return array
|
71 | */
|
71 | */
|
72 | public function setOption($attr, $value) { |
72 | public function setOption($attr, $value) { |
73 | $result = array(); |
73 | $result = array(); |
74 | 74 | ||
75 | if ($attr != "passwd") { |
75 | if ($attr != "passwd") { |
76 | $sValue = $this->secure->checkStr($value); |
76 | $sValue = $this->secure->checkStr($value); |
77 | } else { |
77 | } else { |
78 | $sValue = $value; |
78 | $sValue = $value; |
79 | }
|
79 | }
|
80 | 80 | ||
81 | $query = "UPDATE ".$this->prefix."settings SET optvalue='".$sValue."' WHERE opt='".$attr."'"; |
81 | $query = "UPDATE ".$this->prefix."settings SET optvalue='".$sValue."' WHERE opt='".$attr."'"; |
82 | $rq =& $this->db->query($query); |
82 | $rq =& $this->db->query($query); |
83 | if (PEAR::isError($this->db)) { |
83 | if (PEAR::isError($this->db)) { |
84 | $result["ERR"] = 1; |
84 | $result["ERR"] = 1; |
85 | $result["ERRINFO"] = $this->db->getMessage(); |
85 | $result["ERRINFO"] = $this->db->getMessage(); |
86 | } else { |
86 | } else { |
87 | $result["ERR"] = 0; |
87 | $result["ERR"] = 0; |
88 | }
|
88 | }
|
89 | 89 | ||
90 | return $result; |
90 | return $result; |
91 | }
|
91 | }
|
92 | 92 | ||
93 | /**
|
93 | /**
|
94 | * Создание настройки
|
94 | * Создание настройки
|
95 | *
|
95 | *
|
96 | * @author Alexander Wolf
|
96 | * @author Alexander Wolf
|
97 | * @category Core
|
97 | * @category Core
|
98 | *
|
98 | *
|
99 | * @param string $attr
|
99 | * @param string $attr
|
100 | * @param string $value
|
100 | * @param string $value
|
101 | * @return array
|
101 | * @return array
|
102 | */
|
102 | */
|
103 | public function addOption($attr, $value) { |
103 | public function addOption($attr, $value) { |
104 | $result = array(); |
104 | $result = array(); |
105 | $sValue = $this->secure->checkStr($value); |
105 | $sValue = $this->secure->checkStr($value); |
106 | 106 | ||
107 | $query = "INSERT INTO ".$this->prefix."settings SET opt='".$attr."', optvalue='".$sValue."'"; |
107 | $query = "INSERT INTO ".$this->prefix."settings SET opt='".$attr."', optvalue='".$sValue."'"; |
108 | $rq =& $this->db->query($query); |
108 | $rq =& $this->db->query($query); |
109 | if (PEAR::isError($this->db)) { |
109 | if (PEAR::isError($this->db)) { |
110 | $result["ERR"] = 1; |
110 | $result["ERR"] = 1; |
111 | $result["ERRINFO"] = $this->db->getMessage(); |
111 | $result["ERRINFO"] = $this->db->getMessage(); |
112 | } else { |
112 | } else { |
113 | $result["ERR"] = 0; |
113 | $result["ERR"] = 0; |
114 | }
|
114 | }
|
115 | 115 | ||
116 | return $result; |
116 | return $result; |
117 | }
|
117 | }
|
118 | 118 | ||
119 | /**
|
119 | /**
|
120 | * Получение и отображение списка дистрибутвов
|
120 | * Получение и отображение списка дистрибутвов
|
121 | *
|
121 | *
|
122 | * @author Alexander Wolf
|
122 | * @author Alexander Wolf
|
123 | * @category Core
|
123 | * @category Core
|
124 | * @deprecated may be deprecated XXX
|
124 | * @deprecated may be deprecated XXX
|
125 | *
|
125 | *
|
126 | * @param string $name
|
126 | * @param string $name
|
127 | * @param string $heads
|
127 | * @param string $heads
|
128 | * @param string $info
|
128 | * @param string $info
|
129 | * @param string $format
|
129 | * @param string $format
|
130 | * @return string
|
130 | * @return string
|
131 | */
|
131 | */
|
132 | public function showDistributionList($name, $heads = "", $info = "", $format = 'html') { |
132 | public function showDistributionList($name, $heads = "", $info = "", $format = 'html') { |
133 | $query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC"; |
133 | $query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC"; |
134 | $rq =& $this->db->query($query); |
134 | $rq =& $this->db->query($query); |
135 | switch ($format) { |
135 | switch ($format) { |
136 | case 'html': |
136 | case 'html': |
137 | $show = "<fieldset><legend>".$heads."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
137 | $show = "<fieldset><legend>".$heads."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
138 | $show .= "<option value=''>".$info."</option>\n"; |
138 | $show .= "<option value=''>".$info."</option>\n"; |
139 | while ($rq->fetchInto($element)) { |
139 | while ($rq->fetchInto($element)) { |
140 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
140 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
141 | }
|
141 | }
|
142 | $show .= "</select></fieldset>"; |
142 | $show .= "</select></fieldset>"; |
143 | break; |
143 | break; |
144 | case 'json': |
144 | case 'json': |
145 | $show = '[{value:"",text:"'.$info.'"}'; |
145 | $show = '[{value:"",text:"'.$info.'"}'; |
146 | while ($rq->fetchInto($element)) { |
146 | while ($rq->fetchInto($element)) { |
147 | $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}'; |
147 | $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}'; |
148 | }
|
148 | }
|
149 | $show .= ']'; |
149 | $show .= ']'; |
150 | break; |
150 | break; |
151 | case 'innerhtml': |
151 | case 'innerhtml': |
152 | $show = "<select id='".$name."' name='".$name."'>\n"; |
152 | $show = "<select id='".$name."' name='".$name."'>\n"; |
153 | while ($rq->fetchInto($element)) { |
153 | while ($rq->fetchInto($element)) { |
154 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
154 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
155 | }
|
155 | }
|
156 | $show .= "</select>"; |
156 | $show .= "</select>"; |
157 | break; |
157 | break; |
158 | case 'list': |
158 | case 'list': |
159 | $show = "<ul>"; |
159 | $show = "<ul>"; |
160 | while ($rq->fetchInto($element)) { |
160 | while ($rq->fetchInto($element)) { |
161 | $show .= "<li>[<a href='".$heads."?mode=".$name."&action=edit&uuid=".$this->secure->checkInt($element["dist_id"])."' class='edit'>править</a>][<a href='".$heads."?mode=".$name."&action=delete&uuid=".$this->secure->checkInt($element["dist_id"])."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["distname"],1)."</li>\n"; |
161 | $show .= "<li>[<a href='".$heads."?mode=".$name."&action=edit&uuid=".$this->secure->checkInt($element["dist_id"])."' class='edit'>править</a>][<a href='".$heads."?mode=".$name."&action=delete&uuid=".$this->secure->checkInt($element["dist_id"])."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["distname"],1)."</li>\n"; |
162 | }
|
162 | }
|
163 | $show .= "</ul>"; |
163 | $show .= "</ul>"; |
164 | break; |
164 | break; |
165 | }
|
165 | }
|
166 | return $show; |
166 | return $show; |
167 | }
|
167 | }
|
168 | 168 | ||
169 | /**
|
169 | /**
|
170 | * Получение названия дистрибутива
|
170 | * Получение названия дистрибутива
|
171 | *
|
171 | *
|
172 | * @author Alexander Wolf
|
172 | * @author Alexander Wolf
|
173 | * @category Core
|
173 | * @category Core
|
174 | *
|
174 | *
|
175 | * @param integer $distID
|
175 | * @param integer $distID
|
176 | * @return array
|
176 | * @return array
|
177 | */
|
177 | */
|
178 | public function getDistName($distID) { |
178 | public function getDistName($distID) { |
179 | $result = array(); |
179 | $result = array(); |
180 | $query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'"; |
180 | $query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'"; |
181 | $rq =& $this->db->query($query); |
181 | $rq =& $this->db->query($query); |
182 | if (PEAR::isError($this->db)) { |
182 | if (PEAR::isError($this->db)) { |
183 | $result["ERR"] = 1; |
183 | $result["ERR"] = 1; |
184 | $result["ERRINFO"] = $this->db->getMessage(); |
184 | $result["ERRINFO"] = $this->db->getMessage(); |
185 | } else { |
185 | } else { |
186 | $rq->fetchInto($element); |
186 | $rq->fetchInto($element); |
187 | $result["ERR"] = 0; |
187 | $result["ERR"] = 0; |
188 | $result["DistName"] = $this->secure->checkStr($element["distname"],1); |
188 | $result["DistName"] = $this->secure->checkStr($element["distname"],1); |
189 | }
|
189 | }
|
190 | 190 | ||
191 | return $result; |
191 | return $result; |
192 | }
|
192 | }
|
193 | 193 | ||
194 | /**
|
194 | /**
|
195 | * Получение названия программы, ее версии и описания
|
195 | * Получение названия программы, ее версии и описания
|
196 | *
|
196 | *
|
197 | * @author Alexander Wolf
|
197 | * @author Alexander Wolf
|
198 | * @category Core
|
198 | * @category Core
|
199 | *
|
199 | *
|
200 | * @param string $attr
|
200 | * @param string $attr
|
201 | * @return string
|
201 | * @return string
|
202 | */
|
202 | */
|
203 | public function getEngineAttr($attr = 'codename') { |
203 | public function getEngineAttr($attr = 'codename') { |
204 | $cname = $this->getOption($attr); |
204 | $cname = $this->getOption($attr); |
205 | return $this->secure->checkStr($cname["OptValue"],1); |
205 | return $this->secure->checkStr($cname["OptValue"],1); |
206 | }
|
206 | }
|
207 | 207 | ||
208 | /**
|
208 | /**
|
209 | * Получение и отображение списка версий дистрибутива
|
209 | * Получение и отображение списка версий дистрибутива
|
210 | *
|
210 | *
|
211 | * @author Alexander Wolf
|
211 | * @author Alexander Wolf
|
212 | * @category Core
|
212 | * @category Core
|
213 | *
|
213 | *
|
214 | * @param string $name
|
214 | * @param string $name
|
215 | * @param integer $distID
|
215 | * @param integer $distID
|
216 | * @param string $format
|
216 | * @param string $format
|
217 | * @return string
|
217 | * @return string
|
218 | */
|
218 | */
|
219 | public function showDistVersionsList($name, $distID, $format = 'html', $actor = '') { |
219 | public function showDistVersionsList($name, $distID, $format = 'html', $actor = '') { |
220 | $distname = $this->getDistName($distID); |
220 | $distname = $this->getDistName($distID); |
221 | if ($distID == 0) { |
221 | if ($distID == 0) { |
222 | $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"; |
222 | $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"; |
223 | } else { |
223 | } else { |
224 | $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
224 | $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
225 | }
|
225 | }
|
226 | $rq =& $this->db->query($query); |
226 | $rq =& $this->db->query($query); |
227 | switch ($format) { |
227 | switch ($format) { |
228 | case 'html': |
228 | case 'html': |
229 | $show = "<fieldset><legend>Версии ".$distname["DistName"]."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
229 | $show = "<fieldset><legend>Версии ".$distname["DistName"]."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
230 | $show .= "<option value=''>Выбери версию ".$distname["DistName"]."</option>\n"; |
230 | $show .= "<option value=''>Выбери версию ".$distname["DistName"]."</option>\n"; |
231 | while ($rq->fetchInto($element)) { |
231 | while ($rq->fetchInto($element)) { |
232 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["version"],1)." ".$this->secure->checkStr($element["vname"],1)."</option>\n"; |
232 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["version"],1)." ".$this->secure->checkStr($element["vname"],1)."</option>\n"; |
233 | }
|
233 | }
|
234 | $show .= "</select></fieldset>"; |
234 | $show .= "</select></fieldset>"; |
235 | break; |
235 | break; |
236 | case 'json': |
236 | case 'json': |
237 | $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}'; |
237 | $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}'; |
238 | while ($rq->fetchInto($element)) { |
238 | while ($rq->fetchInto($element)) { |
239 | $show .= ',{value:"'.$this->secure->checkInt($element["version_id"]).'",text:"'.$this->secure->checkStr($element["version"],1).' '.$this->secure->checkStr($element["vname"],1).'"}'; |
239 | $show .= ',{value:"'.$this->secure->checkInt($element["version_id"]).'",text:"'.$this->secure->checkStr($element["version"],1).' '.$this->secure->checkStr($element["vname"],1).'"}'; |
240 | }
|
240 | }
|
241 | $show .= ']'; |
241 | $show .= ']'; |
242 | break; |
242 | break; |
243 | case 'list': |
243 | case 'list': |
244 | $show = "<ul>\n"; |
244 | $show = "<ul>\n"; |
245 | while ($rq->fetchInto($element)) { |
245 | while ($rq->fetchInto($element)) { |
246 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$this->secure->checkInt($element["version_id"])."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$this->secure->checkInt($element["version_id"])."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["distname"],1)." ".$this->secure->checkStr($element["version"],1)." “<em>".$this->secure->checkStr($element["vname"],1)."</em>”</li>\n"; |
246 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$this->secure->checkInt($element["version_id"])."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$this->secure->checkInt($element["version_id"])."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["distname"],1)." ".$this->secure->checkStr($element["version"],1)." “<em>".$this->secure->checkStr($element["vname"],1)."</em>”</li>\n"; |
247 | }
|
247 | }
|
248 | $show .= "</ul>"; |
248 | $show .= "</ul>"; |
249 | break; |
249 | break; |
250 | }
|
250 | }
|
251 | return $show; |
251 | return $show; |
252 | }
|
252 | }
|
253 | 253 | ||
254 | /**
|
254 | /**
|
255 | * Получение и отображение списка секций основного (официального) репозитория
|
255 | * Получение и отображение списка секций основного (официального) репозитория
|
256 | *
|
256 | *
|
257 | * @author Alexander Wolf
|
257 | * @author Alexander Wolf
|
258 | * @category Core
|
258 | * @category Core
|
259 | *
|
259 | *
|
260 | * @param integer $version
|
260 | * @param integer $version
|
261 | * @param string $format
|
261 | * @param string $format
|
262 | * @return string
|
262 | * @return string
|
263 | */
|
263 | */
|
264 | public function showBranchesList($version, $format = 'html') { |
264 | public function showBranchesList($version, $format = 'html') { |
265 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
265 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
266 | $rq =& $this->db->query($query); |
266 | $rq =& $this->db->query($query); |
267 | $rq->fetchInto($types); |
267 | $rq->fetchInto($types); |
268 | $query = "SELECT s.*,t.rtype FROM ".$this->prefix."section s "; |
268 | $query = "SELECT s.*,t.rtype FROM ".$this->prefix."section s "; |
269 | $query .= "JOIN ".$this->prefix."sect2rep l ON s.sect_id=l.sect_id "; |
269 | $query .= "JOIN ".$this->prefix."sect2rep l ON s.sect_id=l.sect_id "; |
270 | $query .= "JOIN ".$this->prefix."repository r ON r.rep_id=l.rep_id "; |
270 | $query .= "JOIN ".$this->prefix."repository r ON r.rep_id=l.rep_id "; |
271 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
271 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
272 | $query .= "WHERE t.rtype_id='1' AND r.version='".$this->secure->checkInt($version)."' "; |
272 | $query .= "WHERE t.rtype_id='1' AND r.version='".$this->secure->checkInt($version)."' "; |
273 | $query .= "ORDER BY s.sect_id ASC"; |
273 | $query .= "ORDER BY s.sect_id ASC"; |
274 | $rq =& $this->db->query($query); |
274 | $rq =& $this->db->query($query); |
275 | switch ($format) { |
275 | switch ($format) { |
276 | case 'html': |
276 | case 'html': |
277 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
277 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
278 | while ($rq->fetchInto($element)) { |
278 | while ($rq->fetchInto($element)) { |
279 | $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"; |
279 | $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"; |
280 | }
|
280 | }
|
281 | $show .= "</fieldset>\n"; |
281 | $show .= "</fieldset>\n"; |
282 | break; |
282 | break; |
283 | case 'json': |
283 | case 'json': |
284 | //TODO Доделать JSON-вывод списка секций основного репозитория
|
284 | //TODO Доделать JSON-вывод списка секций основного репозитория
|
285 | break; |
285 | break; |
286 | }
|
286 | }
|
287 | 287 | ||
288 | return $show; |
288 | return $show; |
289 | }
|
289 | }
|
290 | 290 | ||
291 | /**
|
291 | /**
|
292 | * Получение и отображение списка репозиториев
|
292 | * Получение и отображение списка репозиториев
|
293 | *
|
293 | *
|
294 | * @author Alexander Wolf
|
294 | * @author Alexander Wolf
|
295 | * @category Core
|
295 | * @category Core
|
296 | *
|
296 | *
|
297 | * @param integer $version
|
297 | * @param integer $version
|
298 | * @param integer $reptype
|
298 | * @param integer $reptype
|
299 | * @param string $format
|
299 | * @param string $format
|
300 | * @return string
|
300 | * @return string
|
301 | */
|
301 | */
|
302 | public function showRepList($version, $reptype, $format = 'html') { |
302 | public function showRepList($version, $reptype, $format = 'html') { |
303 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='".$this->secure->checkInt($reptype)."'"; |
303 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='".$this->secure->checkInt($reptype)."'"; |
304 | $rq =& $this->db->query($query); |
304 | $rq =& $this->db->query($query); |
305 | $rq->fetchInto($types); |
305 | $rq->fetchInto($types); |
306 | $query = "SELECT * FROM ".$this->prefix."repository WHERE version='".$this->secure->checkInt($version)."' AND rtype_id='".$this->secure->checkInt($reptype)."'"; |
306 | $query = "SELECT * FROM ".$this->prefix."repository WHERE version='".$this->secure->checkInt($version)."' AND rtype_id='".$this->secure->checkInt($reptype)."'"; |
307 | $rq =& $this->db->query($query); |
307 | $rq =& $this->db->query($query); |
308 | switch ($format) { |
308 | switch ($format) { |
309 | case 'html': |
309 | case 'html': |
310 | if ($rq->numRows()>0) { |
310 | if ($rq->numRows()>0) { |
311 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
311 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
312 | while ($rq->fetchInto($element)) { |
312 | while ($rq->fetchInto($element)) { |
313 | $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"; |
313 | $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"; |
314 | }
|
314 | }
|
315 | $show .= "</fieldset>\n"; |
315 | $show .= "</fieldset>\n"; |
316 | }
|
316 | }
|
317 | break; |
317 | break; |
318 | case 'json': |
318 | case 'json': |
319 | //TODO Доделать JSON-вывод списка репозиториев
|
319 | //TODO Доделать JSON-вывод списка репозиториев
|
320 | break; |
320 | break; |
321 | }
|
321 | }
|
322 | 322 | ||
323 | return $show; |
323 | return $show; |
324 | }
|
324 | }
|
325 | 325 | ||
326 | /**
|
326 | /**
|
327 | * Добавление поддержки нового apt-дистрибутива
|
327 | * Добавление поддержки нового apt-дистрибутива
|
328 | *
|
328 | *
|
329 | * @author Alexander Wolf
|
329 | * @author Alexander Wolf
|
330 | * @category Core
|
330 | * @category Core
|
331 | *
|
331 | *
|
332 | * @param string $distname
|
332 | * @param string $distname
|
333 | * @param integer $disttype
|
333 | * @param integer $disttype
|
334 | * @param string $distua
|
334 | * @param string $distua
|
335 | * @param byte $distlogo
|
335 | * @param byte $distlogo
|
336 | * @return array
|
336 | * @return array
|
337 | */
|
337 | */
|
338 | public function addDistribution($distname, $disttype, $distua = '', $distlogo = 0) { |
338 | public function addDistribution($distname, $disttype, $distua = '', $distlogo = 0) { |
339 | $result = array(); |
339 | $result = array(); |
340 | $sDName = $this->secure->checkStr($distname); |
340 | $sDName = $this->secure->checkStr($distname); |
341 | $sDType = $this->secure->checkInt($disttype); |
341 | $sDType = $this->secure->checkInt($disttype); |
342 | $sDUAgt = $this->secure->checkStr($distua); |
342 | $sDUAgt = $this->secure->checkStr($distua); |
343 | $sDLogo = $this->secure->checkInt($distlogo); |
343 | $sDLogo = $this->secure->checkInt($distlogo); |
344 | 344 | ||
345 | $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'"; |
345 | $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'"; |
346 | $rq =& $this->db->query($query); |
346 | $rq =& $this->db->query($query); |
347 | if (PEAR::isError($this->db)) { |
347 | if (PEAR::isError($this->db)) { |
348 | $result["ERR"] = 1; |
348 | $result["ERR"] = 1; |
349 | $result["ERRINFO"] = $this->db->getMessage(); |
349 | $result["ERRINFO"] = $this->db->getMessage(); |
350 | } else { |
350 | } else { |
351 | $result["ERR"] = 0; |
351 | $result["ERR"] = 0; |
352 | }
|
352 | }
|
353 | 353 | ||
354 | return $result; |
354 | return $result; |
355 | }
|
355 | }
|
356 | 356 | ||
357 | /**
|
357 | /**
|
358 | * Обновление информации о дистрибутиве
|
358 | * Обновление информации о дистрибутиве
|
359 | *
|
359 | *
|
360 | * @author Alexander Wolf
|
360 | * @author Alexander Wolf
|
361 | * @category Core
|
361 | * @category Core
|
362 | *
|
362 | *
|
363 | * @param integer $distID
|
363 | * @param integer $distID
|
364 | * @param string $distname
|
364 | * @param string $distname
|
365 | * @param integer $disttype
|
365 | * @param integer $disttype
|
366 | * @param string $distua
|
366 | * @param string $distua
|
367 | * @param integer $distlogo
|
367 | * @param integer $distlogo
|
368 | * @return array
|
368 | * @return array
|
369 | */
|
369 | */
|
370 | public function updateDistribution($distID, $distname, $disttype, $distua, $distlogo = 0) { |
370 | public function updateDistribution($distID, $distname, $disttype, $distua, $distlogo = 0) { |
371 | $result = array(); |
371 | $result = array(); |
372 | $sDID = $this->secure->checkInt($distID); |
372 | $sDID = $this->secure->checkInt($distID); |
373 | $sDName = $this->secure->checkStr($distname); |
373 | $sDName = $this->secure->checkStr($distname); |
374 | $sDType = $this->secure->checkInt($disttype); |
374 | $sDType = $this->secure->checkInt($disttype); |
375 | $sDUAgt = $this->secure->checkStr($distua); |
375 | $sDUAgt = $this->secure->checkStr($distua); |
376 | $sDLogo = $this->secure->checkInt($distlogo); |
376 | $sDLogo = $this->secure->checkInt($distlogo); |
377 | 377 | ||
378 | if ($sDLogo!=0) { |
378 | if ($sDLogo!=0) { |
379 | $query = "UPDATE ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."' WHERE dist_id='".$sDID."'"; |
379 | $query = "UPDATE ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."' WHERE dist_id='".$sDID."'"; |
380 | } else { |
380 | } else { |
381 | $query = "UPDATE ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."' WHERE dist_id='".$sDID."'"; |
381 | $query = "UPDATE ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."' WHERE dist_id='".$sDID."'"; |
382 | }
|
382 | }
|
383 | $rq =& $this->db->query($query); |
383 | $rq =& $this->db->query($query); |
384 | if (PEAR::isError($this->db)) { |
384 | if (PEAR::isError($this->db)) { |
385 | $result["ERR"] = 1; |
385 | $result["ERR"] = 1; |
386 | $result["ERRINFO"] = $this->db->getMessage(); |
386 | $result["ERRINFO"] = $this->db->getMessage(); |
387 | } else { |
387 | } else { |
388 | $result["ERR"] = 0; |
388 | $result["ERR"] = 0; |
389 | }
|
389 | }
|
390 | 390 | ||
391 | return $result; |
391 | return $result; |
392 | }
|
392 | }
|
393 | 393 | ||
394 | /**
|
394 | /**
|
395 | * Удаление информации о дистрибутиве
|
395 | * Удаление информации о дистрибутиве
|
396 | *
|
396 | *
|
397 | * @author Alexander Wolf
|
397 | * @author Alexander Wolf
|
398 | * @category Core
|
398 | * @category Core
|
399 | *
|
399 | *
|
400 | * @param integer $distID
|
400 | * @param integer $distID
|
401 | * @return array
|
401 | * @return array
|
402 | */
|
402 | */
|
403 | public function dropDistribution($distID) { |
403 | public function dropDistribution($distID) { |
404 | $result = array(); |
404 | $result = array(); |
405 | $sDID = $this->secure->checkInt($distID); |
405 | $sDID = $this->secure->checkInt($distID); |
406 | 406 | ||
407 | // Удаление дистрибутива
|
407 | // Удаление дистрибутива
|
408 | $query = "DELETE FROM ".$this->prefix."distribution WHERE dist_id='".$sDID."'"; |
408 | $query = "DELETE FROM ".$this->prefix."distribution WHERE dist_id='".$sDID."'"; |
409 | $rq =& $this->db->query($query); |
409 | $rq =& $this->db->query($query); |
410 | if (PEAR::isError($this->db)) { |
410 | if (PEAR::isError($this->db)) { |
411 | $result["ERR"] = 1; |
411 | $result["ERR"] = 1; |
412 | $result["ERRINFO"] = $this->db->getMessage(); |
412 | $result["ERRINFO"] = $this->db->getMessage(); |
413 | } else { |
413 | } else { |
414 | $result["ERR"] = 0; |
414 | $result["ERR"] = 0; |
415 | }
|
415 | }
|
416 | 416 | ||
417 | // Удаление версий дистрибутива
|
417 | // Удаление версий дистрибутива
|
418 | $query = "DELETE FROM ".$this->prefix."version WHERE dist_id='".$sDID."'"; |
418 | $query = "DELETE FROM ".$this->prefix."version WHERE dist_id='".$sDID."'"; |
419 | $rq =& $this->db->query($query); |
419 | $rq =& $this->db->query($query); |
420 | if (PEAR::isError($this->db)) { |
420 | if (PEAR::isError($this->db)) { |
421 | $result["ERR"] = 1; |
421 | $result["ERR"] = 1; |
422 | $result["ERRINFO"] = $this->db->getMessage(); |
422 | $result["ERRINFO"] = $this->db->getMessage(); |
423 | } else { |
423 | } else { |
424 | $result["ERR"] = 0; |
424 | $result["ERR"] = 0; |
425 | }
|
425 | }
|
426 | 426 | ||
427 | return $result; |
427 | return $result; |
428 | }
|
428 | }
|
429 | 429 | ||
430 | /**
|
430 | /**
|
431 | * Добавление поддержки новой версии apt-дистрибутива
|
431 | * Добавление поддержки новой версии apt-дистрибутива
|
432 | *
|
432 | *
|
433 | * @author Alexander Wolf
|
433 | * @author Alexander Wolf
|
434 | * @category Core
|
434 | * @category Core
|
435 | *
|
435 | *
|
436 | * @param integer $distID
|
436 | * @param integer $distID
|
437 | * @param integer $version
|
437 | * @param integer $version
|
438 | * @param string $vname
|
438 | * @param string $vname
|
439 | * @param integer $vcodename
|
439 | * @param integer $vcodename
|
440 | * @return array
|
440 | * @return array
|
441 | */
|
441 | */
|
442 | public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
442 | public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
443 | $result = array(); |
443 | $result = array(); |
444 | $sDistID = $this->secure->checkInt($distID); |
444 | $sDistID = $this->secure->checkInt($distID); |
445 | $sDVersion = $this->secure->checkStr($version); |
445 | $sDVersion = $this->secure->checkStr($version); |
446 | $sDVName = $this->secure->checkStr($vname); |
446 | $sDVName = $this->secure->checkStr($vname); |
447 | $sDVCName = $this->secure->checkStr($vcodename); |
447 | $sDVCName = $this->secure->checkStr($vcodename); |
448 | 448 | ||
449 | $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'"; |
449 | $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'"; |
450 | $rq =& $this->db->query($query); |
450 | $rq =& $this->db->query($query); |
451 | if (PEAR::isError($this->db)) { |
451 | if (PEAR::isError($this->db)) { |
452 | $result["ERR"] = 1; |
452 | $result["ERR"] = 1; |
453 | $result["ERRINFO"] = $this->db->getMessage(); |
453 | $result["ERRINFO"] = $this->db->getMessage(); |
454 | } else { |
454 | } else { |
455 | $result["ERR"] = 0; |
455 | $result["ERR"] = 0; |
456 | }
|
456 | }
|
457 | 457 | ||
458 | return $result; |
458 | return $result; |
459 | }
|
459 | }
|
460 | 460 | ||
461 | /**
|
461 | /**
|
462 | * Редактирование информации о версии дистрибутива
|
462 | * Редактирование информации о версии дистрибутива
|
463 | *
|
463 | *
|
464 | * @author Alexander Wolf
|
464 | * @author Alexander Wolf
|
465 | * @category Core
|
465 | * @category Core
|
466 | *
|
466 | *
|
467 | * @param integer $versionID
|
467 | * @param integer $versionID
|
468 | * @param string $version
|
468 | * @param string $version
|
469 | * @param string $vname
|
469 | * @param string $vname
|
470 | * @param string $vcodename
|
470 | * @param string $vcodename
|
471 | * @return array
|
471 | * @return array
|
472 | */
|
472 | */
|
473 | public function updateDistVersion($versionID, $version, $vname = "", $vcodename = "") { |
473 | public function updateDistVersion($versionID, $version, $vname = "", $vcodename = "") { |
474 | $result = array(); |
474 | $result = array(); |
475 | $sVersID = $this->secure->checkInt($versionID); |
475 | $sVersID = $this->secure->checkInt($versionID); |
476 | $sDVersion = $this->secure->checkStr($version,1); |
476 | $sDVersion = $this->secure->checkStr($version,1); |
477 | $sDVName = $this->secure->checkStr($vname,1); |
477 | $sDVName = $this->secure->checkStr($vname,1); |
478 | $sDVCName = $this->secure->checkStr($vcodename,1); |
478 | $sDVCName = $this->secure->checkStr($vcodename,1); |
479 | 479 | ||
480 | $query = "UPDATE ".$this->prefix."version SET vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."' WHERE version_id='".$sVersID."'"; |
480 | $query = "UPDATE ".$this->prefix."version SET vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."' WHERE version_id='".$sVersID."'"; |
481 | $rq =& $this->db->query($query); |
481 | $rq =& $this->db->query($query); |
482 | if (PEAR::isError($this->db)) { |
482 | if (PEAR::isError($this->db)) { |
483 | $result["ERR"] = 1; |
483 | $result["ERR"] = 1; |
484 | $result["ERRINFO"] = $this->db->getMessage(); |
484 | $result["ERRINFO"] = $this->db->getMessage(); |
485 | } else { |
485 | } else { |
486 | $result["ERR"] = 0; |
486 | $result["ERR"] = 0; |
487 | }
|
487 | }
|
488 | 488 | ||
489 | return $result; |
489 | return $result; |
490 | }
|
490 | }
|
491 | 491 | ||
492 | /**
|
492 | /**
|
493 | * Удаление информации о версии дистрибутива
|
493 | * Удаление информации о версии дистрибутива
|
494 | *
|
494 | *
|
495 | * @author Alexander Wolf
|
495 | * @author Alexander Wolf
|
496 | * @category Core
|
496 | * @category Core
|
497 | *
|
497 | *
|
498 | * @param integer $versionID
|
498 | * @param integer $versionID
|
499 | * @return array
|
499 | * @return array
|
500 | */
|
500 | */
|
501 | public function dropDistVersion($versionID) { |
501 | public function dropDistVersion($versionID) { |
502 | $result = array(); |
502 | $result = array(); |
503 | $sVersID = $this->secure->checkInt($versionID); |
503 | $sVersID = $this->secure->checkInt($versionID); |
504 | 504 | ||
505 | // Удаление версии дистрибутива
|
505 | // Удаление версии дистрибутива
|
506 | $query = "DELETE FROM ".$this->prefix."version WHERE version_id='".$sVersID."'"; |
506 | $query = "DELETE FROM ".$this->prefix."version WHERE version_id='".$sVersID."'"; |
507 | $rq =& $this->db->query($query); |
507 | $rq =& $this->db->query($query); |
508 | if (PEAR::isError($this->db)) { |
508 | if (PEAR::isError($this->db)) { |
509 | $result["ERR"] = 1; |
509 | $result["ERR"] = 1; |
510 | $result["ERRINFO"] = $this->db->getMessage(); |
510 | $result["ERRINFO"] = $this->db->getMessage(); |
511 | } else { |
511 | } else { |
512 | $result["ERR"] = 0; |
512 | $result["ERR"] = 0; |
513 | }
|
513 | }
|
514 | 514 | ||
515 | // Удаление репозиториев этой версии дистрибутива
|
515 | // Удаление репозиториев этой версии дистрибутива
|
516 | $query = "DELETE FROM ".$this->prefix."repository WHERE version='".$sVersID."'"; |
516 | $query = "DELETE FROM ".$this->prefix."repository WHERE version='".$sVersID."'"; |
517 | $rq =& $this->db->query($query); |
517 | $rq =& $this->db->query($query); |
518 | if (PEAR::isError($this->db)) { |
518 | if (PEAR::isError($this->db)) { |
519 | $result["ERR"] = 1; |
519 | $result["ERR"] = 1; |
520 | $result["ERRINFO"] = $this->db->getMessage(); |
520 | $result["ERRINFO"] = $this->db->getMessage(); |
521 | } else { |
521 | } else { |
522 | $result["ERR"] = 0; |
522 | $result["ERR"] = 0; |
523 | }
|
523 | }
|
524 | 524 | ||
525 | return $result; |
525 | return $result; |
526 | }
|
526 | }
|
527 | 527 | ||
528 | /**
|
528 | /**
|
529 | * Отображение типа дистрибутива
|
529 | * Отображение типа дистрибутива
|
530 | *
|
530 | *
|
531 | * @author Alexander Wolf
|
531 | * @author Alexander Wolf
|
532 | * @category Core
|
532 | * @category Core
|
533 | *
|
533 | *
|
534 | * @param string $name
|
534 | * @param string $name
|
535 | * @param byte $type
|
535 | * @param byte $type
|
536 | * @return string
|
536 | * @return string
|
537 | */
|
537 | */
|
538 | public function showDistTypeForm($name = "dtype",$type = 0) { |
538 | public function showDistTypeForm($name = "dtype",$type = 0) { |
539 | $query = "SELECT * FROM ".$this->prefix."dtype"; |
539 | $query = "SELECT * FROM ".$this->prefix."dtype"; |
540 | $rq =& $this->db->query($query); |
540 | $rq =& $this->db->query($query); |
541 | $show = "<select name='".$name."' id='".$name."'>\n"; |
541 | $show = "<select name='".$name."' id='".$name."'>\n"; |
542 | while ($rq->fetchInto($element)) { |
542 | while ($rq->fetchInto($element)) { |
543 | if ($element["type_id"] == $type) { |
543 | if ($element["type_id"] == $type) { |
544 | $show .= "<option value='".$element["type_id"]."' selected>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
544 | $show .= "<option value='".$element["type_id"]."' selected>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
545 | } else { |
545 | } else { |
546 | $show .= "<option value='".$element["type_id"]."'>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
546 | $show .= "<option value='".$element["type_id"]."'>".$this->secure->checkStr($element["type"],1)."</option>\n"; |
547 | }
|
547 | }
|
548 | }
|
548 | }
|
549 | $show .= "</select>"; |
549 | $show .= "</select>"; |
550 | 550 | ||
551 | return $show; |
551 | return $show; |
552 | }
|
552 | }
|
553 | 553 | ||
554 | /**
|
554 | /**
|
555 | * Отображение формы создания и редактирования apt-дистрибутива
|
555 | * Отображение формы создания и редактирования apt-дистрибутива
|
556 | *
|
556 | *
|
557 | * @author Alexander Wolf
|
557 | * @author Alexander Wolf
|
558 | * @category Core
|
558 | * @category Core
|
559 | *
|
559 | *
|
560 | * @param integer $distID
|
560 | * @param integer $distID
|
561 | * @return string
|
561 | * @return string
|
562 | */
|
562 | */
|
563 | public function showDistributionForm($distID = 0, $info = '') { |
563 | public function showDistributionForm($distID = 0, $info = '') { |
564 | $sDistID = $this->secure->checkInt($distID); |
564 | $sDistID = $this->secure->checkInt($distID); |
565 | $sInfo = $this->secure->checkStr($info, 1); |
565 | $sInfo = $this->secure->checkStr($info, 1); |
566 | if ($sInfo == "") { |
566 | if ($sInfo == "") { |
567 | $sInfo = "Дистрибутив"; |
567 | $sInfo = "Дистрибутив"; |
568 | }
|
568 | }
|
569 | if ($sDistID != 0) { |
569 | if ($sDistID != 0) { |
570 | // Режим редактирования
|
570 | // Режим редактирования
|
571 | $query = "SELECT * FROM ".$this->prefix."distribution WHERE dist_id='".$sDistID."'"; |
571 | $query = "SELECT * FROM ".$this->prefix."distribution WHERE dist_id='".$sDistID."'"; |
572 | $rq =& $this->db->query($query); |
572 | $rq =& $this->db->query($query); |
573 | $rq->fetchInto($element); |
573 | $rq->fetchInto($element); |
574 | }
|
574 | }
|
575 | 575 | ||
576 | if ($element["distlogo"] == 1) { |
576 | if ($element["distlogo"] == 1) { |
577 | $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)."'>"; |
577 | $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)."'>"; |
578 | } else { |
578 | } else { |
579 | $image = "<img src='./img/d/empty-logo.png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива' title='Логотип дистрибутива не загружен'>"; |
579 | $image = "<img src='./img/d/empty-logo.png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива' title='Логотип дистрибутива не загружен'>"; |
580 | }
|
580 | }
|
581 | 581 | ||
582 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
582 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
583 | $show .= "<div class='inputbox'><label for='dname'>Название дистрибутива:</label> <input type='text' name='dname' id='dname' value='".$this->secure->checkStr($element["distname"],1)."'></div>\n"; |
583 | $show .= "<div class='inputbox'><label for='dname'>Название дистрибутива:</label> <input type='text' name='dname' id='dname' value='".$this->secure->checkStr($element["distname"],1)."'></div>\n"; |
584 | $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"; |
584 | $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"; |
585 | $show .= "<div class='inputbox'><label for='dtype'>Тип дистрибутива:</label> ".$this->showDistTypeForm("dtype",$element["disttype"])."</div>\n"; |
585 | $show .= "<div class='inputbox'><label for='dtype'>Тип дистрибутива:</label> ".$this->showDistTypeForm("dtype",$element["disttype"])."</div>\n"; |
586 | $show .= "<div class='inputbox'><table><tr><td class='td-name'>Логотип дистрибутива:</td>\n"; |
586 | $show .= "<div class='inputbox'><table><tr><td class='td-name'>Логотип дистрибутива:</td>\n"; |
587 | $show .= "<td>".$image."</td>\n<td><input type='file' name='distlogo'></td>\n</tr></table>\n</div>\n"; |
587 | $show .= "<td>".$image."</td>\n<td><input type='file' name='distlogo'></td>\n</tr></table>\n</div>\n"; |
588 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
588 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
589 | 589 | ||
590 | return $show; |
590 | return $show; |
591 | }
|
591 | }
|
592 | 592 | ||
593 | /**
|
593 | /**
|
594 | * Генератор sources.list
|
594 | * Генератор sources.list
|
595 | *
|
595 | *
|
596 | * @author Alexander Wolf
|
596 | * @author Alexander Wolf
|
597 | * @category Core
|
597 | * @category Core
|
598 | * @version 1.0
|
598 | * @version 1.0
|
599 | *
|
599 | *
|
600 | * @param array $data
|
600 | * @param array $data
|
601 | * @return string
|
601 | * @return string
|
602 | */
|
602 | */
|
603 | public function showSourcesList($data) { |
603 | public function showSourcesList($data) { |
604 | // Извлекаем информацию о дистрибутиве и его версии
|
604 | // Извлекаем информацию о дистрибутиве и его версии
|
605 | $query = "SELECT * FROM ".$this->prefix."distribution d "; |
605 | $query = "SELECT * FROM ".$this->prefix."distribution d "; |
606 | $query .= "JOIN ".$this->prefix."version v ON v.dist_id=d.dist_id "; |
606 | $query .= "JOIN ".$this->prefix."version v ON v.dist_id=d.dist_id "; |
607 | $query .= "JOIN ".$this->prefix."dtype t ON d.disttype=t.type_id "; |
607 | $query .= "JOIN ".$this->prefix."dtype t ON d.disttype=t.type_id "; |
608 | $query .= "WHERE d.dist_id='".$data["dist_id"]."' AND v.version_id='".$data["version_id"]."'"; |
608 | $query .= "WHERE d.dist_id='".$data["dist_id"]."' AND v.version_id='".$data["version_id"]."'"; |
609 | $rq =& $this->db->query($query); |
609 | $rq =& $this->db->query($query); |
610 | $rq->fetchInto($dist); |
610 | $rq->fetchInto($dist); |
611 | 611 | ||
612 | $show = "# Список репозиториев для ".$this->secure->checkStr($dist["distname"],1)." ".$this->secure->checkStr($dist["version"],1)." ".$this->secure->checkStr($dist["vname"],1)."\n\n"; |
612 | $show = "# Список репозиториев для ".$this->secure->checkStr($dist["distname"],1)." ".$this->secure->checkStr($dist["version"],1)." ".$this->secure->checkStr($dist["vname"],1)."\n\n"; |
613 | 613 | ||
614 | // Извлекаем информацию о репозиториях и строим sources.list
|
614 | // Извлекаем информацию о репозиториях и строим sources.list
|
615 | if ($dist["type"]=="deb") { |
615 | if ($dist["type"]=="deb") { |
616 | // Базовый репозиторий
|
616 | // Базовый репозиторий
|
617 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
617 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
618 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
618 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
619 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
619 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
620 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
620 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
621 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
621 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
622 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
622 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
623 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
623 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
624 | $query .= "WHERE v.version_id='".$data["version_id"]."' AND r.rtype_id='1'"; |
624 | $query .= "WHERE v.version_id='".$data["version_id"]."' AND r.rtype_id='1'"; |
625 | $rq =& $this->db->query($query); |
625 | $rq =& $this->db->query($query); |
- | 626 | if ($rq->numRows()>0) { |
|
626 | $rq->fetchInto($base); |
627 | $rq->fetchInto($base); |
627 | // Формируем type proto://host/folder
|
628 | // Формируем type proto://host/folder
|
628 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
629 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
629 | if ($base["repkey"]!="") { |
630 | if ($base["repkey"]!="") { |
630 | $show .= "# Установка ключа: ".$this->secure->checkStr($base["repkey"],1)."\n"; |
631 | $show .= "# Установка ключа: ".$this->secure->checkStr($base["repkey"],1)."\n"; |
631 | }
|
632 | }
|
632 | $show .= $this->secure->checkStr($dist["type"],1)." ".$this->secure->checkStr($base["proto"],1).$this->secure->checkStr($base["rhost"],1).$this->secure->checkStr($base["rfolder"],1); |
633 | $show .= $this->secure->checkStr($dist["type"],1)." ".$this->secure->checkStr($base["proto"],1).$this->secure->checkStr($base["rhost"],1).$this->secure->checkStr($base["rfolder"],1); |
633 | $dvname = str_replace("{DIST}",$this->secure->checkStr($dist["vcodename"],1),$this->secure->checkStr($base["scheme"],1)); |
634 | $dvname = str_replace("{DIST}",$this->secure->checkStr($dist["vcodename"],1),$this->secure->checkStr($base["scheme"],1)); |
634 | // Формируем distname
|
635 | // Формируем distname
|
635 | $show .= " ".$dvname." "; |
636 | $show .= " ".$dvname." "; |
636 | // Формируем sections
|
637 | // Формируем sections
|
637 | $query = "SELECT * FROM ".$this->prefix."section s "; |
638 | $query = "SELECT * FROM ".$this->prefix."section s "; |
638 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
639 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
639 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
640 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
640 | for($i=0;$i<count($data["section"]);$i++) { |
641 | for($i=0;$i<count($data["section"]);$i++) { |
641 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
642 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
642 | if ($i<count($data["section"])-1) { |
643 | if ($i<count($data["section"])-1) { |
643 | $query .= " OR "; |
644 | $query .= " OR "; |
644 | }
|
645 | }
|
645 | }
|
646 | }
|
646 | $query .= ")"; |
647 | $query .= ")"; |
647 | $rq =& $this->db->query($query); |
648 | $rq =& $this->db->query($query); |
648 | while ($rq->fetchInto($sections)) { |
649 | while ($rq->fetchInto($sections)) { |
649 | $show .= $sections["secname"]." "; |
650 | $show .= $sections["secname"]." "; |
650 | }
|
651 | }
|
651 | $show .= "\n\n"; |
652 | $show .= "\n\n"; |
- | 653 | }
|
|
652 | 654 | ||
653 | // Репозитории обновлений и третьих лиц
|
655 | // Репозитории обновлений и третьих лиц
|
654 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
656 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
655 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
657 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
656 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
658 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
657 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
659 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
658 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
660 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
659 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
661 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
660 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
662 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
661 | $query .= "WHERE r.rtype_id>'1' AND ("; |
663 | $query .= "WHERE r.rtype_id>'1' AND ("; |
662 | for($i=0;$i<count($data["repository"]);$i++) { |
664 | for($i=0;$i<count($data["repository"]);$i++) { |
663 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
665 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
664 | if ($i<count($data["repository"])-1) { |
666 | if ($i<count($data["repository"])-1) { |
665 | $query .= " OR "; |
667 | $query .= " OR "; |
666 | }
|
668 | }
|
667 | }
|
669 | }
|
668 | $query .= ") ORDER BY r.rtype_id ASC"; |
670 | $query .= ") ORDER BY r.rtype_id ASC"; |
669 | $req =& $this->db->query($query); |
671 | $req =& $this->db->query($query); |
- | 672 | if ($req->numRows()>0) { |
|
670 | while ($req->fetchInto($updates)) { |
673 | while ($req->fetchInto($updates)) { |
671 | // Формируем type proto://host/folder
|
674 | // Формируем type proto://host/folder
|
672 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
675 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
673 | if ($updates["repkey"]!="") { |
676 | if ($updates["repkey"]!="") { |
674 | $show .= "# Установка ключа: ".$this->secure->checkStr($updates["repkey"],1)."\n"; |
677 | $show .= "# Установка ключа: ".$this->secure->checkStr($updates["repkey"],1)."\n"; |
675 | }
|
678 | }
|
676 | $show .= $this->secure->checkStr($dist["type"],1)." ".$this->secure->checkStr($updates["proto"],1).$this->secure->checkStr($updates["rhost"],1).$this->secure->checkStr($updates["rfolder"],1); |
679 | $show .= $this->secure->checkStr($dist["type"],1)." ".$this->secure->checkStr($updates["proto"],1).$this->secure->checkStr($updates["rhost"],1).$this->secure->checkStr($updates["rfolder"],1); |
677 | $dvname = str_replace("{DIST}",$this->secure->checkStr($dist["vcodename"],1),$this->secure->checkStr($updates["scheme"],1)); |
680 | $dvname = str_replace("{DIST}",$this->secure->checkStr($dist["vcodename"],1),$this->secure->checkStr($updates["scheme"],1)); |
678 | // Формируем distname
|
681 | // Формируем distname
|
679 | $show .= " ".$dvname." "; |
682 | $show .= " ".$dvname." "; |
680 | // Формируем sections
|
683 | // Формируем sections
|
681 | $query = "SELECT * FROM ".$this->prefix."section s "; |
684 | $query = "SELECT * FROM ".$this->prefix."section s "; |
682 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
685 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
683 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
686 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
684 | $rq =& $this->db->query($query); |
687 | $rq =& $this->db->query($query); |
685 | while ($rq->fetchInto($sections)) { |
688 | while ($rq->fetchInto($sections)) { |
686 | $show .= $sections["secname"]." "; |
689 | $show .= $sections["secname"]." "; |
687 | }
|
690 | }
|
688 | $show .= "\n\n"; |
691 | $show .= "\n\n"; |
689 | }
|
692 | }
|
690 | $show .= "\n"; |
693 | $show .= "\n"; |
- | 694 | }
|
|
691 | } else { |
695 | } else { |
692 | // Базовый репозиторий
|
696 | // Базовый репозиторий
|
693 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
697 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
694 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
698 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
695 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
699 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
696 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
700 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
697 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
701 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
698 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
702 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
699 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
703 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
700 | $query .= "WHERE v.version_id='".$data["version_id"]."' AND r.rtype_id='1'"; |
704 | $query .= "WHERE v.version_id='".$data["version_id"]."' AND r.rtype_id='1'"; |
701 | $rq =& $this->db->query($query); |
705 | $rq =& $this->db->query($query); |
- | 706 | if ($rq->numRows()>0) { |
|
702 | $rq->fetchInto($base); |
707 | $rq->fetchInto($base); |
703 | // Формируем type proto://host/folder
|
708 | // Формируем type proto://host/folder
|
704 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
709 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
705 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
710 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
706 | if ($base["sign_id"]!=0) { |
711 | if ($base["sign_id"]!=0) { |
707 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
712 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
708 | $rq =& $this->db->query($query); |
713 | $rq =& $this->db->query($query); |
709 | $rq->fetchInto($sign); |
714 | $rq->fetchInto($sign); |
710 | $show .= "[".$this->secure->checkStr($sign["sname"],1)."] "; |
715 | $show .= "[".$this->secure->checkStr($sign["sname"],1)."] "; |
711 | }
|
716 | }
|
712 | $show .= $this->secure->checkStr($base["proto"],1).$this->secure->checkStr($base["rhost"],1).$this->secure->checkStr($base["rfolder"],1)." "; |
717 | $show .= $this->secure->checkStr($base["proto"],1).$this->secure->checkStr($base["rhost"],1).$this->secure->checkStr($base["rfolder"],1)." "; |
713 | $show .= $this->secure->checkStr($base["scheme"],1)." "; |
718 | $show .= $this->secure->checkStr($base["scheme"],1)." "; |
714 | 719 | ||
715 | // Формируем sections
|
720 | // Формируем sections
|
716 | $query = "SELECT * FROM ".$this->prefix."section s "; |
721 | $query = "SELECT * FROM ".$this->prefix."section s "; |
717 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
722 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
718 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
723 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
719 | for($i=0;$i<count($data["section"]);$i++) { |
724 | for($i=0;$i<count($data["section"]);$i++) { |
720 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
725 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
721 | if ($i<count($data["section"])-1) { |
726 | if ($i<count($data["section"])-1) { |
722 | $query .= " OR "; |
727 | $query .= " OR "; |
723 | }
|
728 | }
|
724 | }
|
729 | }
|
725 | $query .= ")"; |
730 | $query .= ")"; |
726 | $rq =& $this->db->query($query); |
731 | $rq =& $this->db->query($query); |
727 | while ($rq->fetchInto($sections)) { |
732 | while ($rq->fetchInto($sections)) { |
728 | $show .= $sections["secname"]." "; |
733 | $show .= $sections["secname"]." "; |
729 | }
|
734 | }
|
730 | $show .= "\n\n"; |
735 | $show .= "\n\n"; |
- | 736 | }
|
|
731 | 737 | ||
732 | // Репозитории обновлений и третьих лиц
|
738 | // Репозитории обновлений и третьих лиц
|
733 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
739 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
734 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
740 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
735 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
741 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
736 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
742 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
737 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
743 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
738 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
744 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
739 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
745 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
740 | $query .= "WHERE r.rtype_id>'1' AND ("; |
746 | $query .= "WHERE r.rtype_id>'1' AND ("; |
741 | for($i=0;$i<count($data["repository"]);$i++) { |
747 | for($i=0;$i<count($data["repository"]);$i++) { |
742 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
748 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
743 | if ($i<count($data["repository"])-1) { |
749 | if ($i<count($data["repository"])-1) { |
744 | $query .= " OR "; |
750 | $query .= " OR "; |
745 | }
|
751 | }
|
746 | }
|
752 | }
|
747 | $query .= ") ORDER BY r.rtype_id ASC"; |
753 | $query .= ") ORDER BY r.rtype_id ASC"; |
748 | $req =& $this->db->query($query); |
754 | $req =& $this->db->query($query); |
- | 755 | if ($req->numRows()>0) { |
|
749 | while ($req->fetchInto($updates)) { |
756 | while ($req->fetchInto($updates)) { |
750 | // Формируем type proto://host/folder
|
757 | // Формируем type proto://host/folder
|
751 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
758 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
752 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
759 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
753 | if ($updates["sign_id"]!=0) { |
760 | if ($updates["sign_id"]!=0) { |
754 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
761 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
755 | $rqs =& $this->db->query($query); |
762 | $rqs =& $this->db->query($query); |
756 | $rqs->fetchInto($sign); |
763 | $rqs->fetchInto($sign); |
757 | $show .= "[".$this->secure->checkStr($sign["sname"],1)."] "; |
764 | $show .= "[".$this->secure->checkStr($sign["sname"],1)."] "; |
758 | }
|
765 | }
|
759 | $show .= $this->secure->checkStr($updates["proto"],1).$this->secure->checkStr($updates["rhost"],1).$this->secure->checkStr($updates["rfolder"],1)." "; |
766 | $show .= $this->secure->checkStr($updates["proto"],1).$this->secure->checkStr($updates["rhost"],1).$this->secure->checkStr($updates["rfolder"],1)." "; |
760 | $show .= $this->secure->checkStr($updates["scheme"],1)." "; |
767 | $show .= $this->secure->checkStr($updates["scheme"],1)." "; |
761 | // Формируем sections
|
768 | // Формируем sections
|
762 | $query = "SELECT * FROM ".$this->prefix."section s "; |
769 | $query = "SELECT * FROM ".$this->prefix."section s "; |
763 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
770 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
764 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
771 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
765 | $rq =& $this->db->query($query); |
772 | $rq =& $this->db->query($query); |
766 | while ($rq->fetchInto($sections)) { |
773 | while ($rq->fetchInto($sections)) { |
767 | $show .= $sections["secname"]." "; |
774 | $show .= $sections["secname"]." "; |
768 | }
|
775 | }
|
769 | $show .= "\n\n"; |
776 | $show .= "\n\n"; |
770 | }
|
777 | }
|
771 | $show .= "\n"; |
778 | $show .= "\n"; |
772 | }
|
779 | }
|
- | 780 | }
|
|
773 | 781 | ||
774 | $HTTPHeader1 = "Content-length: ".strlen($show); |
782 | $HTTPHeader1 = "Content-length: ".strlen($show); |
775 | $HTTPHeader2 = "Content-disposition: attachment; filename=sources.list\n\n"; |
783 | $HTTPHeader2 = "Content-disposition: attachment; filename=sources.list\n\n"; |
776 | 784 | ||
777 | header($HTTPHeader1); |
785 | header($HTTPHeader1); |
778 | header($HTTPHeader2); |
786 | header($HTTPHeader2); |
779 | return $show; |
787 | return $show; |
780 | }
|
788 | }
|
781 | 789 | ||
782 | /**
|
790 | /**
|
783 | * Показывает список секций
|
791 | * Показывает список секций
|
784 | *
|
792 | *
|
785 | * @author Alexander Wolf
|
793 | * @author Alexander Wolf
|
786 | * @category Core
|
794 | * @category Core
|
787 | *
|
795 | *
|
788 | * @param string $name
|
796 | * @param string $name
|
789 | * @param string $actor
|
797 | * @param string $actor
|
790 | * @param string $format
|
798 | * @param string $format
|
791 | * @return string
|
799 | * @return string
|
792 | */
|
800 | */
|
793 | public function showSectionsList($name, $actor, $format = 'html') { |
801 | public function showSectionsList($name, $actor, $format = 'html') { |
794 | switch($format) { |
802 | switch($format) { |
795 | case 'html': |
803 | case 'html': |
796 | $query = "SELECT * FROM ".$this->prefix."section"; |
804 | $query = "SELECT * FROM ".$this->prefix."section"; |
797 | $rq =& $this->db->query($query); |
805 | $rq =& $this->db->query($query); |
798 | $show = "<ul>\n"; |
806 | $show = "<ul>\n"; |
799 | while ($rq->fetchInto($element)) { |
807 | while ($rq->fetchInto($element)) { |
800 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["sect_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["sect_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["secname"],1)."</li>\n"; |
808 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["sect_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["sect_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["secname"],1)."</li>\n"; |
801 | }
|
809 | }
|
802 | $show .= "</ul>"; |
810 | $show .= "</ul>"; |
803 | break; |
811 | break; |
804 | case 'innerhtml': |
812 | case 'innerhtml': |
805 | $show = ""; |
813 | $show = ""; |
806 | $repID = $this->secure->checkInt($actor); |
814 | $repID = $this->secure->checkInt($actor); |
807 | if ($repID==0) { |
815 | if ($repID==0) { |
808 | $query = "SELECT * FROM ".$this->prefix."section"; |
816 | $query = "SELECT * FROM ".$this->prefix."section"; |
809 | $rq =& $this->db->query($query); |
817 | $rq =& $this->db->query($query); |
810 | while ($rq->fetchInto($element)) { |
818 | while ($rq->fetchInto($element)) { |
811 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." "; |
819 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." "; |
812 | }
|
820 | }
|
813 | } else { |
821 | } else { |
814 | $query = "SELECT * FROM ".$this->prefix."section s JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$repID'"; |
822 | $query = "SELECT * FROM ".$this->prefix."section s JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$repID'"; |
815 | $rq =& $this->db->query($query); |
823 | $rq =& $this->db->query($query); |
816 | while ($rq->fetchInto($element)) { |
824 | while ($rq->fetchInto($element)) { |
817 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."' checked> ".$this->secure->checkStr($element["secname"],1)." "; |
825 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."' checked> ".$this->secure->checkStr($element["secname"],1)." "; |
818 | }
|
826 | }
|
819 | $query = "SELECT s.* FROM ".$this->prefix."section s WHERE s.sect_id NOT IN (SELECT sect_id FROM ".$this->prefix."sect2rep WHERE rep_id='$repID')"; |
827 | $query = "SELECT s.* FROM ".$this->prefix."section s WHERE s.sect_id NOT IN (SELECT sect_id FROM ".$this->prefix."sect2rep WHERE rep_id='$repID')"; |
820 | $rq =& $this->db->query($query); |
828 | $rq =& $this->db->query($query); |
821 | while ($rq->fetchInto($element)) { |
829 | while ($rq->fetchInto($element)) { |
822 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." "; |
830 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." "; |
823 | }
|
831 | }
|
824 | }
|
832 | }
|
825 | 833 | ||
826 | break; |
834 | break; |
827 | }
|
835 | }
|
828 | 836 | ||
829 | return $show; |
837 | return $show; |
830 | }
|
838 | }
|
831 | 839 | ||
832 | /**
|
840 | /**
|
833 | * Вывод формы редактирования/добавления секций
|
841 | * Вывод формы редактирования/добавления секций
|
834 | *
|
842 | *
|
835 | * @author Alexander Wolf
|
843 | * @author Alexander Wolf
|
836 | * @category Core
|
844 | * @category Core
|
837 | *
|
845 | *
|
838 | * @param integer $sectionID
|
846 | * @param integer $sectionID
|
839 | * @param string $info
|
847 | * @param string $info
|
840 | * @return string
|
848 | * @return string
|
841 | */
|
849 | */
|
842 | public function showSectionsForm($sectionID = 0, $info = "") { |
850 | public function showSectionsForm($sectionID = 0, $info = "") { |
843 | $sSectID = $this->secure->checkInt($sectionID); |
851 | $sSectID = $this->secure->checkInt($sectionID); |
844 | $sInfo = $this->secure->checkStr($info, 1); |
852 | $sInfo = $this->secure->checkStr($info, 1); |
845 | if ($sInfo == "") { |
853 | if ($sInfo == "") { |
846 | $sInfo = "Секция"; |
854 | $sInfo = "Секция"; |
847 | }
|
855 | }
|
848 | if ($sSectID != 0) { |
856 | if ($sSectID != 0) { |
849 | // Режим редактирования
|
857 | // Режим редактирования
|
850 | $query = "SELECT * FROM ".$this->prefix."section WHERE sect_id='".$sSectID."'"; |
858 | $query = "SELECT * FROM ".$this->prefix."section WHERE sect_id='".$sSectID."'"; |
851 | $rq =& $this->db->query($query); |
859 | $rq =& $this->db->query($query); |
852 | $rq->fetchInto($element); |
860 | $rq->fetchInto($element); |
853 | }
|
861 | }
|
854 | 862 | ||
855 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
863 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
856 | $show .= "<div class='inputbox'><label for='sname'>Название секции:</label> <input type='text' name='sname' id='sname' value='".$this->secure->checkStr($element["secname"],1)."'></div>\n"; |
864 | $show .= "<div class='inputbox'><label for='sname'>Название секции:</label> <input type='text' name='sname' id='sname' value='".$this->secure->checkStr($element["secname"],1)."'></div>\n"; |
857 | $show .= "<div class='inputbox'><label for='sinfo'>Описание секции:</label> <input type='text' name='sinfo' id='sinfo' value='".$this->secure->checkStr($element["sectinfo"],1)."'></div>\n"; |
865 | $show .= "<div class='inputbox'><label for='sinfo'>Описание секции:</label> <input type='text' name='sinfo' id='sinfo' value='".$this->secure->checkStr($element["sectinfo"],1)."'></div>\n"; |
858 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
866 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
859 | 867 | ||
860 | return $show; |
868 | return $show; |
861 | }
|
869 | }
|
862 | 870 | ||
863 | /**
|
871 | /**
|
864 | * Обновление информации о секции
|
872 | * Обновление информации о секции
|
865 | *
|
873 | *
|
866 | * @author Alexander Wolf
|
874 | * @author Alexander Wolf
|
867 | * @category Core
|
875 | * @category Core
|
868 | *
|
876 | *
|
869 | * @param integer $sectionID
|
877 | * @param integer $sectionID
|
870 | * @param string $sname
|
878 | * @param string $sname
|
871 | * @param string $sinfo
|
879 | * @param string $sinfo
|
872 | * @return array
|
880 | * @return array
|
873 | */
|
881 | */
|
874 | public function updateSection($sectionID, $sname, $sinfo = "") { |
882 | public function updateSection($sectionID, $sname, $sinfo = "") { |
875 | $result = array(); |
883 | $result = array(); |
876 | $sSectID = $this->secure->checkInt($sectionID); |
884 | $sSectID = $this->secure->checkInt($sectionID); |
877 | $sSName = $this->secure->checkStr($sname); |
885 | $sSName = $this->secure->checkStr($sname); |
878 | $sSInfo = $this->secure->checkStr($sinfo); |
886 | $sSInfo = $this->secure->checkStr($sinfo); |
879 | 887 | ||
880 | $query = "UPDATE ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."' WHERE sect_id='".$sSectID."'"; |
888 | $query = "UPDATE ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."' WHERE sect_id='".$sSectID."'"; |
881 | $rq =& $this->db->query($query); |
889 | $rq =& $this->db->query($query); |
882 | if (PEAR::isError($this->db)) { |
890 | if (PEAR::isError($this->db)) { |
883 | $result["ERR"] = 1; |
891 | $result["ERR"] = 1; |
884 | $result["ERRINFO"] = $this->db->getMessage(); |
892 | $result["ERRINFO"] = $this->db->getMessage(); |
885 | } else { |
893 | } else { |
886 | $result["ERR"] = 0; |
894 | $result["ERR"] = 0; |
887 | }
|
895 | }
|
888 | 896 | ||
889 | return $result; |
897 | return $result; |
890 | }
|
898 | }
|
891 | 899 | ||
892 | /**
|
900 | /**
|
893 | * Удаление информации о секции
|
901 | * Удаление информации о секции
|
894 | *
|
902 | *
|
895 | * @author Alexander Wolf
|
903 | * @author Alexander Wolf
|
896 | * @category Core
|
904 | * @category Core
|
897 | *
|
905 | *
|
898 | * @param integer $sectionID
|
906 | * @param integer $sectionID
|
899 | * @return array
|
907 | * @return array
|
900 | */
|
908 | */
|
901 | public function dropSection($sectionID) { |
909 | public function dropSection($sectionID) { |
902 | $result = array(); |
910 | $result = array(); |
903 | $sSectID = $this->secure->checkInt($sectionID); |
911 | $sSectID = $this->secure->checkInt($sectionID); |
904 | 912 | ||
905 | // Удаление секции
|
913 | // Удаление секции
|
906 | $query = "DELETE FROM ".$this->prefix."section WHERE sect_id='".$sSectID."'"; |
914 | $query = "DELETE FROM ".$this->prefix."section WHERE sect_id='".$sSectID."'"; |
907 | $rq =& $this->db->query($query); |
915 | $rq =& $this->db->query($query); |
908 | if (PEAR::isError($this->db)) { |
916 | if (PEAR::isError($this->db)) { |
909 | $result["ERR"] = 1; |
917 | $result["ERR"] = 1; |
910 | $result["ERRINFO"] = $this->db->getMessage(); |
918 | $result["ERRINFO"] = $this->db->getMessage(); |
911 | } else { |
919 | } else { |
912 | $result["ERR"] = 0; |
920 | $result["ERR"] = 0; |
913 | }
|
921 | }
|
914 | 922 | ||
915 | return $result; |
923 | return $result; |
916 | }
|
924 | }
|
917 | 925 | ||
918 | /**
|
926 | /**
|
919 | * Добавление новой секции
|
927 | * Добавление новой секции
|
920 | *
|
928 | *
|
921 | * @author Alexander Wolf
|
929 | * @author Alexander Wolf
|
922 | * @category Core
|
930 | * @category Core
|
923 | *
|
931 | *
|
924 | * @param string $sname
|
932 | * @param string $sname
|
925 | * @param string $sinfo
|
933 | * @param string $sinfo
|
926 | * @return array
|
934 | * @return array
|
927 | */
|
935 | */
|
928 | public function addSection($sname, $sinfo = "") { |
936 | public function addSection($sname, $sinfo = "") { |
929 | $result = array(); |
937 | $result = array(); |
930 | $sSName = $this->secure->checkStr($sname); |
938 | $sSName = $this->secure->checkStr($sname); |
931 | $sSInfo = $this->secure->checkStr($sinfo); |
939 | $sSInfo = $this->secure->checkStr($sinfo); |
932 | 940 | ||
933 | $query = "INSERT INTO ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."'"; |
941 | $query = "INSERT INTO ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."'"; |
934 | $rq =& $this->db->query($query); |
942 | $rq =& $this->db->query($query); |
935 | if (PEAR::isError($this->db)) { |
943 | if (PEAR::isError($this->db)) { |
936 | $result["ERR"] = 1; |
944 | $result["ERR"] = 1; |
937 | $result["ERRINFO"] = $this->db->getMessage(); |
945 | $result["ERRINFO"] = $this->db->getMessage(); |
938 | } else { |
946 | } else { |
939 | $result["ERR"] = 0; |
947 | $result["ERR"] = 0; |
940 | }
|
948 | }
|
941 | 949 | ||
942 | return $result; |
950 | return $result; |
943 | }
|
951 | }
|
944 | 952 | ||
945 | /**
|
953 | /**
|
946 | * Вывод списка поддерживаемых архитектур
|
954 | * Вывод списка поддерживаемых архитектур
|
947 | *
|
955 | *
|
948 | * @author Alexander Wolf
|
956 | * @author Alexander Wolf
|
949 | * @category Core
|
957 | * @category Core
|
950 | *
|
958 | *
|
951 | * @param string $name
|
959 | * @param string $name
|
952 | * @param string $actor
|
960 | * @param string $actor
|
953 | * @param string $format
|
961 | * @param string $format
|
954 | * @return string
|
962 | * @return string
|
955 | */
|
963 | */
|
956 | public function showArchList($name, $actor, $format = 'list') { |
964 | public function showArchList($name, $actor, $format = 'list') { |
957 | switch($format) { |
965 | switch($format) { |
958 | case 'list': |
966 | case 'list': |
959 | $query = "SELECT * FROM ".$this->prefix."arch"; |
967 | $query = "SELECT * FROM ".$this->prefix."arch"; |
960 | $rq =& $this->db->query($query); |
968 | $rq =& $this->db->query($query); |
961 | $show = "<ul>\n"; |
969 | $show = "<ul>\n"; |
962 | while ($rq->fetchInto($element)) { |
970 | while ($rq->fetchInto($element)) { |
963 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["arch_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["arch_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["arch"],1)."</li>\n"; |
971 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["arch_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["arch_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["arch"],1)."</li>\n"; |
964 | }
|
972 | }
|
965 | $show .= "</ul>"; |
973 | $show .= "</ul>"; |
966 | break; |
974 | break; |
967 | case 'innerhtml': |
975 | case 'innerhtml': |
968 | $show = ""; |
976 | $show = ""; |
969 | $repID = $this->secure->checkInt($actor); |
977 | $repID = $this->secure->checkInt($actor); |
970 | if ($repID==0) { |
978 | if ($repID==0) { |
971 | $query = "SELECT * FROM ".$this->prefix."arch"; |
979 | $query = "SELECT * FROM ".$this->prefix."arch"; |
972 | $rq =& $this->db->query($query); |
980 | $rq =& $this->db->query($query); |
973 | while ($rq->fetchInto($element)) { |
981 | while ($rq->fetchInto($element)) { |
974 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."'> ".$this->secure->checkStr($element["arch"],1)." "; |
982 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."'> ".$this->secure->checkStr($element["arch"],1)." "; |
975 | }
|
983 | }
|
976 | } else { |
984 | } else { |
977 | $query = "SELECT * FROM ".$this->prefix."arch a JOIN ".$this->prefix."arch2rep r ON a.arch_id=r.arch_id WHERE r.rep_id='$repID'"; |
985 | $query = "SELECT * FROM ".$this->prefix."arch a JOIN ".$this->prefix."arch2rep r ON a.arch_id=r.arch_id WHERE r.rep_id='$repID'"; |
978 | $rq =& $this->db->query($query); |
986 | $rq =& $this->db->query($query); |
979 | while ($rq->fetchInto($element)) { |
987 | while ($rq->fetchInto($element)) { |
980 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."' checked> ".$this->secure->checkStr($element["arch"],1)." "; |
988 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."' checked> ".$this->secure->checkStr($element["arch"],1)." "; |
981 | }
|
989 | }
|
982 | $query = "SELECT a.* FROM ".$this->prefix."arch a WHERE a.arch_id NOT IN (SELECT arch_id FROM ".$this->prefix."arch2rep WHERE rep_id='$repID')"; |
990 | $query = "SELECT a.* FROM ".$this->prefix."arch a WHERE a.arch_id NOT IN (SELECT arch_id FROM ".$this->prefix."arch2rep WHERE rep_id='$repID')"; |
983 | $rq =& $this->db->query($query); |
991 | $rq =& $this->db->query($query); |
984 | if ($rq->numRows()>0) { |
992 | if ($rq->numRows()>0) { |
985 | while ($rq->fetchInto($element)) { |
993 | while ($rq->fetchInto($element)) { |
986 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."'> ".$this->secure->checkStr($element["arch"],1)." "; |
994 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."'> ".$this->secure->checkStr($element["arch"],1)." "; |
987 | }
|
995 | }
|
988 | }
|
996 | }
|
989 | }
|
997 | }
|
990 | break; |
998 | break; |
991 | }
|
999 | }
|
992 | return $show; |
1000 | return $show; |
993 | }
|
1001 | }
|
994 | 1002 | ||
995 | /**
|
1003 | /**
|
996 | * Добавление новой архитектуры
|
1004 | * Добавление новой архитектуры
|
997 | *
|
1005 | *
|
998 | * @author Alexander Wolf
|
1006 | * @author Alexander Wolf
|
999 | * @category Core
|
1007 | * @category Core
|
1000 | *
|
1008 | *
|
1001 | * @param string $arch
|
1009 | * @param string $arch
|
1002 | * @return array
|
1010 | * @return array
|
1003 | */
|
1011 | */
|
1004 | public function addArch($arch) { |
1012 | public function addArch($arch) { |
1005 | $result = array(); |
1013 | $result = array(); |
1006 | $sArch = $this->secure->checkStr($arch); |
1014 | $sArch = $this->secure->checkStr($arch); |
1007 | 1015 | ||
1008 | $query = "INSERT INTO ".$this->prefix."arch SET arch='".$sArch."'"; |
1016 | $query = "INSERT INTO ".$this->prefix."arch SET arch='".$sArch."'"; |
1009 | $rq =& $this->db->query($query); |
1017 | $rq =& $this->db->query($query); |
1010 | if (PEAR::isError($this->db)) { |
1018 | if (PEAR::isError($this->db)) { |
1011 | $result["ERR"] = 1; |
1019 | $result["ERR"] = 1; |
1012 | $result["ERRINFO"] = $this->db->getMessage(); |
1020 | $result["ERRINFO"] = $this->db->getMessage(); |
1013 | } else { |
1021 | } else { |
1014 | $result["ERR"] = 0; |
1022 | $result["ERR"] = 0; |
1015 | }
|
1023 | }
|
1016 | 1024 | ||
1017 | return $result; |
1025 | return $result; |
1018 | }
|
1026 | }
|
1019 | 1027 | ||
1020 | /**
|
1028 | /**
|
1021 | * Удаление информации об архитектуре
|
1029 | * Удаление информации об архитектуре
|
1022 | *
|
1030 | *
|
1023 | * @author Alexander Wolf
|
1031 | * @author Alexander Wolf
|
1024 | * @category Core
|
1032 | * @category Core
|
1025 | *
|
1033 | *
|
1026 | * @param integer $archID
|
1034 | * @param integer $archID
|
1027 | * @return array
|
1035 | * @return array
|
1028 | */
|
1036 | */
|
1029 | public function dropArch($archID) { |
1037 | public function dropArch($archID) { |
1030 | $result = array(); |
1038 | $result = array(); |
1031 | $sArchID = $this->secure->checkInt($archID); |
1039 | $sArchID = $this->secure->checkInt($archID); |
1032 | 1040 | ||
1033 | // Удаление архитектуры
|
1041 | // Удаление архитектуры
|
1034 | $query = "DELETE FROM ".$this->prefix."arch WHERE arch_id='".$sArchID."'"; |
1042 | $query = "DELETE FROM ".$this->prefix."arch WHERE arch_id='".$sArchID."'"; |
1035 | $rq =& $this->db->query($query); |
1043 | $rq =& $this->db->query($query); |
1036 | if (PEAR::isError($this->db)) { |
1044 | if (PEAR::isError($this->db)) { |
1037 | $result["ERR"] = 1; |
1045 | $result["ERR"] = 1; |
1038 | $result["ERRINFO"] = $this->db->getMessage(); |
1046 | $result["ERRINFO"] = $this->db->getMessage(); |
1039 | } else { |
1047 | } else { |
1040 | $result["ERR"] = 0; |
1048 | $result["ERR"] = 0; |
1041 | }
|
1049 | }
|
1042 | 1050 | ||
1043 | // Удаление архитектуры из списка репозиториев
|
1051 | // Удаление архитектуры из списка репозиториев
|
1044 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE arch_id='".$sArchID."'"; |
1052 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE arch_id='".$sArchID."'"; |
1045 | $rq =& $this->db->query($query); |
1053 | $rq =& $this->db->query($query); |
1046 | if (PEAR::isError($this->db)) { |
1054 | if (PEAR::isError($this->db)) { |
1047 | $result["ERR"] = 1; |
1055 | $result["ERR"] = 1; |
1048 | $result["ERRINFO"] = $this->db->getMessage(); |
1056 | $result["ERRINFO"] = $this->db->getMessage(); |
1049 | } else { |
1057 | } else { |
1050 | $result["ERR"] = 0; |
1058 | $result["ERR"] = 0; |
1051 | }
|
1059 | }
|
1052 | return $result; |
1060 | return $result; |
1053 | }
|
1061 | }
|
1054 | 1062 | ||
1055 | /**
|
1063 | /**
|
1056 | * Обновление информации об архитектуре
|
1064 | * Обновление информации об архитектуре
|
1057 | *
|
1065 | *
|
1058 | * @author Alexander Wolf
|
1066 | * @author Alexander Wolf
|
1059 | * @category Core
|
1067 | * @category Core
|
1060 | *
|
1068 | *
|
1061 | * @param integer $archID
|
1069 | * @param integer $archID
|
1062 | * @param string $arch
|
1070 | * @param string $arch
|
1063 | * @return array
|
1071 | * @return array
|
1064 | */
|
1072 | */
|
1065 | public function updateArch($archID, $arch) { |
1073 | public function updateArch($archID, $arch) { |
1066 | $result = array(); |
1074 | $result = array(); |
1067 | $sArchID = $this->secure->checkInt($archID); |
1075 | $sArchID = $this->secure->checkInt($archID); |
1068 | $sArch = $this->secure->checkStr($arch); |
1076 | $sArch = $this->secure->checkStr($arch); |
1069 | 1077 | ||
1070 | $query = "UPDATE ".$this->prefix."arch SET arch='".$sArch."' WHERE arch_id='".$sArchID."'"; |
1078 | $query = "UPDATE ".$this->prefix."arch SET arch='".$sArch."' WHERE arch_id='".$sArchID."'"; |
1071 | $rq =& $this->db->query($query); |
1079 | $rq =& $this->db->query($query); |
1072 | if (PEAR::isError($this->db)) { |
1080 | if (PEAR::isError($this->db)) { |
1073 | $result["ERR"] = 1; |
1081 | $result["ERR"] = 1; |
1074 | $result["ERRINFO"] = $this->db->getMessage(); |
1082 | $result["ERRINFO"] = $this->db->getMessage(); |
1075 | } else { |
1083 | } else { |
1076 | $result["ERR"] = 0; |
1084 | $result["ERR"] = 0; |
1077 | }
|
1085 | }
|
1078 | 1086 | ||
1079 | return $result; |
1087 | return $result; |
1080 | }
|
1088 | }
|
1081 | 1089 | ||
1082 | /**
|
1090 | /**
|
1083 | * Вывод формы редактирования/добавления архитектур
|
1091 | * Вывод формы редактирования/добавления архитектур
|
1084 | *
|
1092 | *
|
1085 | * @author Alexander Wolf
|
1093 | * @author Alexander Wolf
|
1086 | * @category Core
|
1094 | * @category Core
|
1087 | *
|
1095 | *
|
1088 | * @param integer $archID
|
1096 | * @param integer $archID
|
1089 | * @param string $info
|
1097 | * @param string $info
|
1090 | * @return string
|
1098 | * @return string
|
1091 | */
|
1099 | */
|
1092 | public function showArchForm($archID = 0, $info = "") { |
1100 | public function showArchForm($archID = 0, $info = "") { |
1093 | $sArchID = $this->secure->checkInt($archID); |
1101 | $sArchID = $this->secure->checkInt($archID); |
1094 | $sInfo = $this->secure->checkStr($info, 1); |
1102 | $sInfo = $this->secure->checkStr($info, 1); |
1095 | if ($sInfo == "") { |
1103 | if ($sInfo == "") { |
1096 | $sInfo = "Архитектура"; |
1104 | $sInfo = "Архитектура"; |
1097 | }
|
1105 | }
|
1098 | if ($sArchID != 0) { |
1106 | if ($sArchID != 0) { |
1099 | // Режим редактирования
|
1107 | // Режим редактирования
|
1100 | $query = "SELECT * FROM ".$this->prefix."arch WHERE arch_id='".$sArchID."'"; |
1108 | $query = "SELECT * FROM ".$this->prefix."arch WHERE arch_id='".$sArchID."'"; |
1101 | $rq =& $this->db->query($query); |
1109 | $rq =& $this->db->query($query); |
1102 | $rq->fetchInto($element); |
1110 | $rq->fetchInto($element); |
1103 | }
|
1111 | }
|
1104 | 1112 | ||
1105 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1113 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1106 | $show .= "<div class='inputbox'><label for='arch'>Архитектура:</label> <input type='text' name='arch' id='arch' value='".$this->secure->checkStr($element["arch"],1)."'></div>\n"; |
1114 | $show .= "<div class='inputbox'><label for='arch'>Архитектура:</label> <input type='text' name='arch' id='arch' value='".$this->secure->checkStr($element["arch"],1)."'></div>\n"; |
1107 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1115 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1108 | 1116 | ||
1109 | return $show; |
1117 | return $show; |
1110 | }
|
1118 | }
|
1111 | 1119 | ||
1112 | /**
|
1120 | /**
|
1113 | * Вывод списка схем репозиториев
|
1121 | * Вывод списка схем репозиториев
|
1114 | *
|
1122 | *
|
1115 | * @author Alexander Wolf
|
1123 | * @author Alexander Wolf
|
1116 | * @category Core
|
1124 | * @category Core
|
1117 | *
|
1125 | *
|
1118 | * @param string $name
|
1126 | * @param string $name
|
1119 | * @param string $actor
|
1127 | * @param string $actor
|
1120 | * @param string $format
|
1128 | * @param string $format
|
1121 | * @return string
|
1129 | * @return string
|
1122 | */
|
1130 | */
|
1123 | public function showSchemeList($name, $actor, $format = 'list') { |
1131 | public function showSchemeList($name, $actor, $format = 'list') { |
1124 | switch($format) { |
1132 | switch($format) { |
1125 | case 'list': |
1133 | case 'list': |
1126 | $query = "SELECT * FROM ".$this->prefix."repscheme"; |
1134 | $query = "SELECT * FROM ".$this->prefix."repscheme"; |
1127 | $rq =& $this->db->query($query); |
1135 | $rq =& $this->db->query($query); |
1128 | $show = "<ul>\n"; |
1136 | $show = "<ul>\n"; |
1129 | while ($rq->fetchInto($element)) { |
1137 | while ($rq->fetchInto($element)) { |
1130 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["scheme_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["scheme_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["scheme"],1)."</li>\n"; |
1138 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["scheme_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["scheme_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["scheme"],1)."</li>\n"; |
1131 | }
|
1139 | }
|
1132 | $show .= "</ul>"; |
1140 | $show .= "</ul>"; |
1133 | break; |
1141 | break; |
1134 | case 'innerhtml': |
1142 | case 'innerhtml': |
1135 | $schemeID = $this->secure->checkInt($actor); |
1143 | $schemeID = $this->secure->checkInt($actor); |
1136 | $query = "SELECT * FROM ".$this->prefix."repscheme"; |
1144 | $query = "SELECT * FROM ".$this->prefix."repscheme"; |
1137 | $rq =& $this->db->query($query); |
1145 | $rq =& $this->db->query($query); |
1138 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1146 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1139 | while ($rq->fetchInto($element)) { |
1147 | while ($rq->fetchInto($element)) { |
1140 | if ($element["scheme_id"]==$schemeID) { |
1148 | if ($element["scheme_id"]==$schemeID) { |
1141 | $show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."' selected>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
1149 | $show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."' selected>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
1142 | } else { |
1150 | } else { |
1143 | $show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."'>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
1151 | $show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."'>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
1144 | }
|
1152 | }
|
1145 | }
|
1153 | }
|
1146 | $show .= "</select>"; |
1154 | $show .= "</select>"; |
1147 | break; |
1155 | break; |
1148 | }
|
1156 | }
|
1149 | return $show; |
1157 | return $show; |
1150 | }
|
1158 | }
|
1151 | 1159 | ||
1152 | /**
|
1160 | /**
|
1153 | * Добавление новой схемы репозитория
|
1161 | * Добавление новой схемы репозитория
|
1154 | *
|
1162 | *
|
1155 | * @author Alexander Wolf
|
1163 | * @author Alexander Wolf
|
1156 | * @category Core
|
1164 | * @category Core
|
1157 | *
|
1165 | *
|
1158 | * @param string $scheme
|
1166 | * @param string $scheme
|
1159 | * @return array
|
1167 | * @return array
|
1160 | */
|
1168 | */
|
1161 | public function addScheme($scheme) { |
1169 | public function addScheme($scheme) { |
1162 | $result = array(); |
1170 | $result = array(); |
1163 | $sScheme = $this->secure->checkStr($scheme); |
1171 | $sScheme = $this->secure->checkStr($scheme); |
1164 | 1172 | ||
1165 | $query = "INSERT INTO ".$this->prefix."repscheme SET scheme='".$sScheme."'"; |
1173 | $query = "INSERT INTO ".$this->prefix."repscheme SET scheme='".$sScheme."'"; |
1166 | $rq =& $this->db->query($query); |
1174 | $rq =& $this->db->query($query); |
1167 | if (PEAR::isError($this->db)) { |
1175 | if (PEAR::isError($this->db)) { |
1168 | $result["ERR"] = 1; |
1176 | $result["ERR"] = 1; |
1169 | $result["ERRINFO"] = $this->db->getMessage(); |
1177 | $result["ERRINFO"] = $this->db->getMessage(); |
1170 | } else { |
1178 | } else { |
1171 | $result["ERR"] = 0; |
1179 | $result["ERR"] = 0; |
1172 | }
|
1180 | }
|
1173 | 1181 | ||
1174 | return $result; |
1182 | return $result; |
1175 | }
|
1183 | }
|
1176 | 1184 | ||
1177 | /**
|
1185 | /**
|
1178 | * Удаление информации о схеме репозитория
|
1186 | * Удаление информации о схеме репозитория
|
1179 | *
|
1187 | *
|
1180 | * @author Alexander Wolf
|
1188 | * @author Alexander Wolf
|
1181 | * @category Core
|
1189 | * @category Core
|
1182 | *
|
1190 | *
|
1183 | * @param integer $schemeID
|
1191 | * @param integer $schemeID
|
1184 | * @return array
|
1192 | * @return array
|
1185 | */
|
1193 | */
|
1186 | public function dropScheme($schemeID) { |
1194 | public function dropScheme($schemeID) { |
1187 | $result = array(); |
1195 | $result = array(); |
1188 | $sSchemeID = $this->secure->checkInt($schemeID); |
1196 | $sSchemeID = $this->secure->checkInt($schemeID); |
1189 | 1197 | ||
1190 | // Удаление схемы
|
1198 | // Удаление схемы
|
1191 | $query = "DELETE FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'"; |
1199 | $query = "DELETE FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'"; |
1192 | $rq =& $this->db->query($query); |
1200 | $rq =& $this->db->query($query); |
1193 | if (PEAR::isError($this->db)) { |
1201 | if (PEAR::isError($this->db)) { |
1194 | $result["ERR"] = 1; |
1202 | $result["ERR"] = 1; |
1195 | $result["ERRINFO"] = $this->db->getMessage(); |
1203 | $result["ERRINFO"] = $this->db->getMessage(); |
1196 | } else { |
1204 | } else { |
1197 | $result["ERR"] = 0; |
1205 | $result["ERR"] = 0; |
1198 | }
|
1206 | }
|
1199 | 1207 | ||
1200 | return $result; |
1208 | return $result; |
1201 | }
|
1209 | }
|
1202 | 1210 | ||
1203 | /**
|
1211 | /**
|
1204 | * Обновление информации о схеме репозитория
|
1212 | * Обновление информации о схеме репозитория
|
1205 | *
|
1213 | *
|
1206 | * @author Alexander Wolf
|
1214 | * @author Alexander Wolf
|
1207 | * @category Core
|
1215 | * @category Core
|
1208 | *
|
1216 | *
|
1209 | * @param integer $schemeID
|
1217 | * @param integer $schemeID
|
1210 | * @param string $info
|
1218 | * @param string $info
|
1211 | * @return array
|
1219 | * @return array
|
1212 | */
|
1220 | */
|
1213 | public function updateScheme($schemeID, $info) { |
1221 | public function updateScheme($schemeID, $info) { |
1214 | $result = array(); |
1222 | $result = array(); |
1215 | $sSchemeID = $this->secure->checkInt($schemeID); |
1223 | $sSchemeID = $this->secure->checkInt($schemeID); |
1216 | $sScheme = $this->secure->checkStr($info); |
1224 | $sScheme = $this->secure->checkStr($info); |
1217 | 1225 | ||
1218 | $query = "UPDATE ".$this->prefix."repscheme SET scheme='".$sScheme."' WHERE scheme_id='".$sSchemeID."'"; |
1226 | $query = "UPDATE ".$this->prefix."repscheme SET scheme='".$sScheme."' WHERE scheme_id='".$sSchemeID."'"; |
1219 | $rq =& $this->db->query($query); |
1227 | $rq =& $this->db->query($query); |
1220 | if (PEAR::isError($this->db)) { |
1228 | if (PEAR::isError($this->db)) { |
1221 | $result["ERR"] = 1; |
1229 | $result["ERR"] = 1; |
1222 | $result["ERRINFO"] = $this->db->getMessage(); |
1230 | $result["ERRINFO"] = $this->db->getMessage(); |
1223 | } else { |
1231 | } else { |
1224 | $result["ERR"] = 0; |
1232 | $result["ERR"] = 0; |
1225 | }
|
1233 | }
|
1226 | 1234 | ||
1227 | return $result; |
1235 | return $result; |
1228 | }
|
1236 | }
|
1229 | 1237 | ||
1230 | /**
|
1238 | /**
|
1231 | * Вывод формы редактирования/добавления схем репозиториев
|
1239 | * Вывод формы редактирования/добавления схем репозиториев
|
1232 | *
|
1240 | *
|
1233 | * @author Alexander Wolf
|
1241 | * @author Alexander Wolf
|
1234 | * @category Core
|
1242 | * @category Core
|
1235 | *
|
1243 | *
|
1236 | * @param integer $schemeID
|
1244 | * @param integer $schemeID
|
1237 | * @param string $info
|
1245 | * @param string $info
|
1238 | * @return string
|
1246 | * @return string
|
1239 | */
|
1247 | */
|
1240 | public function showSchemeForm($schemeID = 0, $info = "") { |
1248 | public function showSchemeForm($schemeID = 0, $info = "") { |
1241 | $sSchemeID = $this->secure->checkInt($schemeID); |
1249 | $sSchemeID = $this->secure->checkInt($schemeID); |
1242 | $sInfo = $this->secure->checkStr($info, 1); |
1250 | $sInfo = $this->secure->checkStr($info, 1); |
1243 | if ($sInfo == "") { |
1251 | if ($sInfo == "") { |
1244 | $sInfo = "Схема репозитория"; |
1252 | $sInfo = "Схема репозитория"; |
1245 | }
|
1253 | }
|
1246 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1254 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1247 | if ($sSchemeID != 0) { |
1255 | if ($sSchemeID != 0) { |
1248 | // Режим редактирования
|
1256 | // Режим редактирования
|
1249 | $query = "SELECT * FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'"; |
1257 | $query = "SELECT * FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'"; |
1250 | $rq =& $this->db->query($query); |
1258 | $rq =& $this->db->query($query); |
1251 | $rq->fetchInto($element); |
1259 | $rq->fetchInto($element); |
1252 | }
|
1260 | }
|
1253 | 1261 | ||
1254 | $show .= "<div class='inputbox'><label for='scheme'>Схема репозитория:</label> <input type='text' name='scheme' id='scheme' value='".$this->secure->checkStr($element["scheme"],1)."'></div>\n"; |
1262 | $show .= "<div class='inputbox'><label for='scheme'>Схема репозитория:</label> <input type='text' name='scheme' id='scheme' value='".$this->secure->checkStr($element["scheme"],1)."'></div>\n"; |
1255 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1263 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1256 | 1264 | ||
1257 | return $show; |
1265 | return $show; |
1258 | }
|
1266 | }
|
1259 | 1267 | ||
1260 | /**
|
1268 | /**
|
1261 | * Вывод списка протоколов
|
1269 | * Вывод списка протоколов
|
1262 | *
|
1270 | *
|
1263 | * @author Alexander Wolf
|
1271 | * @author Alexander Wolf
|
1264 | * @category Core
|
1272 | * @category Core
|
1265 | *
|
1273 | *
|
1266 | * @param string $name
|
1274 | * @param string $name
|
1267 | * @param string $actor
|
1275 | * @param string $actor
|
1268 | * @param string $format
|
1276 | * @param string $format
|
1269 | * @return string
|
1277 | * @return string
|
1270 | */
|
1278 | */
|
1271 | public function showProtoList($name, $actor, $format = 'list') { |
1279 | public function showProtoList($name, $actor, $format = 'list') { |
1272 | switch($format) { |
1280 | switch($format) { |
1273 | case 'list': |
1281 | case 'list': |
1274 | $query = "SELECT * FROM ".$this->prefix."protos"; |
1282 | $query = "SELECT * FROM ".$this->prefix."protos"; |
1275 | $rq =& $this->db->query($query); |
1283 | $rq =& $this->db->query($query); |
1276 | $show = "<ul>\n"; |
1284 | $show = "<ul>\n"; |
1277 | while ($rq->fetchInto($element)) { |
1285 | while ($rq->fetchInto($element)) { |
1278 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["proto_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["proto_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["proto"],1)."</li>\n"; |
1286 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["proto_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["proto_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["proto"],1)."</li>\n"; |
1279 | }
|
1287 | }
|
1280 | $show .= "</ul>"; |
1288 | $show .= "</ul>"; |
1281 | break; |
1289 | break; |
1282 | case 'innerhtml': |
1290 | case 'innerhtml': |
1283 | $protoID = $this->secure->checkInt($actor); |
1291 | $protoID = $this->secure->checkInt($actor); |
1284 | $query = "SELECT * FROM ".$this->prefix."protos"; |
1292 | $query = "SELECT * FROM ".$this->prefix."protos"; |
1285 | $rq =& $this->db->query($query); |
1293 | $rq =& $this->db->query($query); |
1286 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1294 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1287 | while ($rq->fetchInto($element)) { |
1295 | while ($rq->fetchInto($element)) { |
1288 | if ($element["proto_id"]==$protoID) { |
1296 | if ($element["proto_id"]==$protoID) { |
1289 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."' selected>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
1297 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."' selected>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
1290 | } else { |
1298 | } else { |
1291 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."'>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
1299 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."'>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
1292 | }
|
1300 | }
|
1293 | }
|
1301 | }
|
1294 | $show .= "</select>"; |
1302 | $show .= "</select>"; |
1295 | break; |
1303 | break; |
1296 | }
|
1304 | }
|
1297 | return $show; |
1305 | return $show; |
1298 | }
|
1306 | }
|
1299 | 1307 | ||
1300 | /**
|
1308 | /**
|
1301 | * Добавление нового протокола
|
1309 | * Добавление нового протокола
|
1302 | *
|
1310 | *
|
1303 | * @author Alexander Wolf
|
1311 | * @author Alexander Wolf
|
1304 | * @category Core
|
1312 | * @category Core
|
1305 | *
|
1313 | *
|
1306 | * @param string $proto
|
1314 | * @param string $proto
|
1307 | * @return array
|
1315 | * @return array
|
1308 | */
|
1316 | */
|
1309 | public function addProto($proto) { |
1317 | public function addProto($proto) { |
1310 | $result = array(); |
1318 | $result = array(); |
1311 | $sProto = $this->secure->checkStr($proto); |
1319 | $sProto = $this->secure->checkStr($proto); |
1312 | 1320 | ||
1313 | $query = "INSERT INTO ".$this->prefix."protos SET proto='".$sProto."'"; |
1321 | $query = "INSERT INTO ".$this->prefix."protos SET proto='".$sProto."'"; |
1314 | $rq =& $this->db->query($query); |
1322 | $rq =& $this->db->query($query); |
1315 | if (PEAR::isError($this->db)) { |
1323 | if (PEAR::isError($this->db)) { |
1316 | $result["ERR"] = 1; |
1324 | $result["ERR"] = 1; |
1317 | $result["ERRINFO"] = $this->db->getMessage(); |
1325 | $result["ERRINFO"] = $this->db->getMessage(); |
1318 | } else { |
1326 | } else { |
1319 | $result["ERR"] = 0; |
1327 | $result["ERR"] = 0; |
1320 | }
|
1328 | }
|
1321 | 1329 | ||
1322 | return $result; |
1330 | return $result; |
1323 | }
|
1331 | }
|
1324 | 1332 | ||
1325 | /**
|
1333 | /**
|
1326 | * Удаление информации о протоколе
|
1334 | * Удаление информации о протоколе
|
1327 | *
|
1335 | *
|
1328 | * @author Alexander Wolf
|
1336 | * @author Alexander Wolf
|
1329 | * @category Core
|
1337 | * @category Core
|
1330 | *
|
1338 | *
|
1331 | * @param integer $protoID
|
1339 | * @param integer $protoID
|
1332 | * @return array
|
1340 | * @return array
|
1333 | */
|
1341 | */
|
1334 | public function dropProto($protoID) { |
1342 | public function dropProto($protoID) { |
1335 | $result = array(); |
1343 | $result = array(); |
1336 | $sProtoID = $this->secure->checkInt($protoID); |
1344 | $sProtoID = $this->secure->checkInt($protoID); |
1337 | 1345 | ||
1338 | // Удаление протокола
|
1346 | // Удаление протокола
|
1339 | $query = "DELETE FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
1347 | $query = "DELETE FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
1340 | $rq =& $this->db->query($query); |
1348 | $rq =& $this->db->query($query); |
1341 | if (PEAR::isError($this->db)) { |
1349 | if (PEAR::isError($this->db)) { |
1342 | $result["ERR"] = 1; |
1350 | $result["ERR"] = 1; |
1343 | $result["ERRINFO"] = $this->db->getMessage(); |
1351 | $result["ERRINFO"] = $this->db->getMessage(); |
1344 | } else { |
1352 | } else { |
1345 | $result["ERR"] = 0; |
1353 | $result["ERR"] = 0; |
1346 | }
|
1354 | }
|
1347 | 1355 | ||
1348 | return $result; |
1356 | return $result; |
1349 | }
|
1357 | }
|
1350 | 1358 | ||
1351 | /**
|
1359 | /**
|
1352 | * Обновление информации о протоколе
|
1360 | * Обновление информации о протоколе
|
1353 | *
|
1361 | *
|
1354 | * @author Alexander Wolf
|
1362 | * @author Alexander Wolf
|
1355 | * @category Core
|
1363 | * @category Core
|
1356 | *
|
1364 | *
|
1357 | * @param integer $protoID
|
1365 | * @param integer $protoID
|
1358 | * @param string $info
|
1366 | * @param string $info
|
1359 | * @return array
|
1367 | * @return array
|
1360 | */
|
1368 | */
|
1361 | public function updateProto($protoID, $info) { |
1369 | public function updateProto($protoID, $info) { |
1362 | $result = array(); |
1370 | $result = array(); |
1363 | $sProtoID = $this->secure->checkInt($protoID); |
1371 | $sProtoID = $this->secure->checkInt($protoID); |
1364 | $sProto = $this->secure->checkStr($info); |
1372 | $sProto = $this->secure->checkStr($info); |
1365 | 1373 | ||
1366 | $query = "UPDATE ".$this->prefix."protos SET proto='".$sProto."' WHERE proto_id='".$sProtoID."'"; |
1374 | $query = "UPDATE ".$this->prefix."protos SET proto='".$sProto."' WHERE proto_id='".$sProtoID."'"; |
1367 | $rq =& $this->db->query($query); |
1375 | $rq =& $this->db->query($query); |
1368 | if (PEAR::isError($this->db)) { |
1376 | if (PEAR::isError($this->db)) { |
1369 | $result["ERR"] = 1; |
1377 | $result["ERR"] = 1; |
1370 | $result["ERRINFO"] = $this->db->getMessage(); |
1378 | $result["ERRINFO"] = $this->db->getMessage(); |
1371 | } else { |
1379 | } else { |
1372 | $result["ERR"] = 0; |
1380 | $result["ERR"] = 0; |
1373 | }
|
1381 | }
|
1374 | 1382 | ||
1375 | return $result; |
1383 | return $result; |
1376 | }
|
1384 | }
|
1377 | 1385 | ||
1378 | /**
|
1386 | /**
|
1379 | * Вывод формы редактирования/добавления протоколов
|
1387 | * Вывод формы редактирования/добавления протоколов
|
1380 | *
|
1388 | *
|
1381 | * @author Alexander Wolf
|
1389 | * @author Alexander Wolf
|
1382 | * @category Core
|
1390 | * @category Core
|
1383 | *
|
1391 | *
|
1384 | * @param integer $protoID
|
1392 | * @param integer $protoID
|
1385 | * @param string $info
|
1393 | * @param string $info
|
1386 | * @return string
|
1394 | * @return string
|
1387 | */
|
1395 | */
|
1388 | public function showProtoForm($protoID = 0, $info = "") { |
1396 | public function showProtoForm($protoID = 0, $info = "") { |
1389 | $sProtoID = $this->secure->checkInt($protoID); |
1397 | $sProtoID = $this->secure->checkInt($protoID); |
1390 | $sInfo = $this->secure->checkStr($info, 1); |
1398 | $sInfo = $this->secure->checkStr($info, 1); |
1391 | if ($sInfo == "") { |
1399 | if ($sInfo == "") { |
1392 | $sInfo = "Протокол доступа"; |
1400 | $sInfo = "Протокол доступа"; |
1393 | }
|
1401 | }
|
1394 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1402 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1395 | if ($sProtoID != 0) { |
1403 | if ($sProtoID != 0) { |
1396 | // Режим редактирования
|
1404 | // Режим редактирования
|
1397 | $query = "SELECT * FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
1405 | $query = "SELECT * FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
1398 | $rq =& $this->db->query($query); |
1406 | $rq =& $this->db->query($query); |
1399 | $rq->fetchInto($element); |
1407 | $rq->fetchInto($element); |
1400 | }
|
1408 | }
|
1401 | 1409 | ||
1402 | $show .= "<div class='inputbox'><label for='proto'>Протокол доступа:</label> <input type='text' name='proto' id='proto' value='".$this->secure->checkStr($element["proto"],1)."'></div>\n"; |
1410 | $show .= "<div class='inputbox'><label for='proto'>Протокол доступа:</label> <input type='text' name='proto' id='proto' value='".$this->secure->checkStr($element["proto"],1)."'></div>\n"; |
1403 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1411 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1404 | 1412 | ||
1405 | return $show; |
1413 | return $show; |
1406 | }
|
1414 | }
|
1407 | 1415 | ||
1408 | /**
|
1416 | /**
|
1409 | * Вывод списка хостов
|
1417 | * Вывод списка хостов
|
1410 | *
|
1418 | *
|
1411 | * @author Alexander Wolf
|
1419 | * @author Alexander Wolf
|
1412 | * @category Core
|
1420 | * @category Core
|
1413 | *
|
1421 | *
|
1414 | * @param string $name
|
1422 | * @param string $name
|
1415 | * @param string $actor
|
1423 | * @param string $actor
|
1416 | * @param string $format
|
1424 | * @param string $format
|
1417 | * @return string
|
1425 | * @return string
|
1418 | */
|
1426 | */
|
1419 | public function showHostsList($name, $actor, $format = 'list') { |
1427 | public function showHostsList($name, $actor, $format = 'list') { |
1420 | switch($format) { |
1428 | switch($format) { |
1421 | case 'list': |
1429 | case 'list': |
1422 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
1430 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
1423 | $rq =& $this->db->query($query); |
1431 | $rq =& $this->db->query($query); |
1424 | $show = "<ul>\n"; |
1432 | $show = "<ul>\n"; |
1425 | while ($rq->fetchInto($element)) { |
1433 | while ($rq->fetchInto($element)) { |
1426 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["rhost_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["rhost_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["rhost"],1)."</li>\n"; |
1434 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["rhost_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["rhost_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["rhost"],1)."</li>\n"; |
1427 | }
|
1435 | }
|
1428 | $show .= "</ul>"; |
1436 | $show .= "</ul>"; |
1429 | break; |
1437 | break; |
1430 | case 'innerhtml': |
1438 | case 'innerhtml': |
1431 | $hostID = $this->secure->checkInt($actor); |
1439 | $hostID = $this->secure->checkInt($actor); |
1432 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
1440 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
1433 | $rq =& $this->db->query($query); |
1441 | $rq =& $this->db->query($query); |
1434 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1442 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1435 | while ($rq->fetchInto($element)) { |
1443 | while ($rq->fetchInto($element)) { |
1436 | if ($element["rhost_id"]==$hostID) { |
1444 | if ($element["rhost_id"]==$hostID) { |
1437 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."' selected>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
1445 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."' selected>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
1438 | } else { |
1446 | } else { |
1439 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."'>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
1447 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."'>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
1440 | }
|
1448 | }
|
1441 | }
|
1449 | }
|
1442 | $show .= "</select>"; |
1450 | $show .= "</select>"; |
1443 | break; |
1451 | break; |
1444 | }
|
1452 | }
|
1445 | return $show; |
1453 | return $show; |
1446 | }
|
1454 | }
|
1447 | 1455 | ||
1448 | /**
|
1456 | /**
|
1449 | * Добавление нового хоста
|
1457 | * Добавление нового хоста
|
1450 | *
|
1458 | *
|
1451 | * @author Alexander Wolf
|
1459 | * @author Alexander Wolf
|
1452 | * @category Core
|
1460 | * @category Core
|
1453 | *
|
1461 | *
|
1454 | * @param string $host
|
1462 | * @param string $host
|
1455 | * @return array
|
1463 | * @return array
|
1456 | */
|
1464 | */
|
1457 | public function addHost($host) { |
1465 | public function addHost($host) { |
1458 | $result = array(); |
1466 | $result = array(); |
1459 | $sHost = $this->secure->checkStr($host); |
1467 | $sHost = $this->secure->checkStr($host); |
1460 | 1468 | ||
1461 | $query = "INSERT INTO ".$this->prefix."rephost SET rhost='".$sHost."'"; |
1469 | $query = "INSERT INTO ".$this->prefix."rephost SET rhost='".$sHost."'"; |
1462 | $rq =& $this->db->query($query); |
1470 | $rq =& $this->db->query($query); |
1463 | if (PEAR::isError($this->db)) { |
1471 | if (PEAR::isError($this->db)) { |
1464 | $result["ERR"] = 1; |
1472 | $result["ERR"] = 1; |
1465 | $result["ERRINFO"] = $this->db->getMessage(); |
1473 | $result["ERRINFO"] = $this->db->getMessage(); |
1466 | } else { |
1474 | } else { |
1467 | $result["ERR"] = 0; |
1475 | $result["ERR"] = 0; |
1468 | }
|
1476 | }
|
1469 | 1477 | ||
1470 | return $result; |
1478 | return $result; |
1471 | }
|
1479 | }
|
1472 | 1480 | ||
1473 | /**
|
1481 | /**
|
1474 | * Удаление информации о хосте
|
1482 | * Удаление информации о хосте
|
1475 | *
|
1483 | *
|
1476 | * @author Alexander Wolf
|
1484 | * @author Alexander Wolf
|
1477 | * @category Core
|
1485 | * @category Core
|
1478 | *
|
1486 | *
|
1479 | * @param integer $hostID
|
1487 | * @param integer $hostID
|
1480 | * @return array
|
1488 | * @return array
|
1481 | */
|
1489 | */
|
1482 | public function dropHost($hostID) { |
1490 | public function dropHost($hostID) { |
1483 | $result = array(); |
1491 | $result = array(); |
1484 | $sHostID = $this->secure->checkInt($hostID); |
1492 | $sHostID = $this->secure->checkInt($hostID); |
1485 | 1493 | ||
1486 | // Удаление хоста
|
1494 | // Удаление хоста
|
1487 | $query = "DELETE FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
1495 | $query = "DELETE FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
1488 | $rq =& $this->db->query($query); |
1496 | $rq =& $this->db->query($query); |
1489 | if (PEAR::isError($this->db)) { |
1497 | if (PEAR::isError($this->db)) { |
1490 | $result["ERR"] = 1; |
1498 | $result["ERR"] = 1; |
1491 | $result["ERRINFO"] = $this->db->getMessage(); |
1499 | $result["ERRINFO"] = $this->db->getMessage(); |
1492 | } else { |
1500 | } else { |
1493 | $result["ERR"] = 0; |
1501 | $result["ERR"] = 0; |
1494 | }
|
1502 | }
|
1495 | 1503 | ||
1496 | return $result; |
1504 | return $result; |
1497 | }
|
1505 | }
|
1498 | 1506 | ||
1499 | /**
|
1507 | /**
|
1500 | * Обновление информации о хосте
|
1508 | * Обновление информации о хосте
|
1501 | *
|
1509 | *
|
1502 | * @author Alexander Wolf
|
1510 | * @author Alexander Wolf
|
1503 | * @category Core
|
1511 | * @category Core
|
1504 | *
|
1512 | *
|
1505 | * @param integer $hostID
|
1513 | * @param integer $hostID
|
1506 | * @param string $info
|
1514 | * @param string $info
|
1507 | * @return array
|
1515 | * @return array
|
1508 | */
|
1516 | */
|
1509 | public function updateHost($hostID, $info) { |
1517 | public function updateHost($hostID, $info) { |
1510 | $result = array(); |
1518 | $result = array(); |
1511 | $sHostID = $this->secure->checkInt($hostID); |
1519 | $sHostID = $this->secure->checkInt($hostID); |
1512 | $sHost = $this->secure->checkStr($info); |
1520 | $sHost = $this->secure->checkStr($info); |
1513 | 1521 | ||
1514 | $query = "UPDATE ".$this->prefix."rephost SET rhost='".$sHost."' WHERE rhost_id='".$sHostID."'"; |
1522 | $query = "UPDATE ".$this->prefix."rephost SET rhost='".$sHost."' WHERE rhost_id='".$sHostID."'"; |
1515 | $rq =& $this->db->query($query); |
1523 | $rq =& $this->db->query($query); |
1516 | if (PEAR::isError($this->db)) { |
1524 | if (PEAR::isError($this->db)) { |
1517 | $result["ERR"] = 1; |
1525 | $result["ERR"] = 1; |
1518 | $result["ERRINFO"] = $this->db->getMessage(); |
1526 | $result["ERRINFO"] = $this->db->getMessage(); |
1519 | } else { |
1527 | } else { |
1520 | $result["ERR"] = 0; |
1528 | $result["ERR"] = 0; |
1521 | }
|
1529 | }
|
1522 | 1530 | ||
1523 | return $result; |
1531 | return $result; |
1524 | }
|
1532 | }
|
1525 | 1533 | ||
1526 | /**
|
1534 | /**
|
1527 | * Вывод формы редактирования/добавления хостов
|
1535 | * Вывод формы редактирования/добавления хостов
|
1528 | *
|
1536 | *
|
1529 | * @author Alexander Wolf
|
1537 | * @author Alexander Wolf
|
1530 | * @category Core
|
1538 | * @category Core
|
1531 | *
|
1539 | *
|
1532 | * @param integer $hostID
|
1540 | * @param integer $hostID
|
1533 | * @param string $info
|
1541 | * @param string $info
|
1534 | * @return string
|
1542 | * @return string
|
1535 | */
|
1543 | */
|
1536 | public function showHostForm($hostID = 0, $info = "") { |
1544 | public function showHostForm($hostID = 0, $info = "") { |
1537 | $sHostID = $this->secure->checkInt($hostID); |
1545 | $sHostID = $this->secure->checkInt($hostID); |
1538 | $sInfo = $this->secure->checkStr($info, 1); |
1546 | $sInfo = $this->secure->checkStr($info, 1); |
1539 | if ($sInfo == "") { |
1547 | if ($sInfo == "") { |
1540 | $sInfo = "Хост репозитория"; |
1548 | $sInfo = "Хост репозитория"; |
1541 | }
|
1549 | }
|
1542 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1550 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1543 | if ($sHostID != 0) { |
1551 | if ($sHostID != 0) { |
1544 | // Режим редактирования
|
1552 | // Режим редактирования
|
1545 | $query = "SELECT * FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
1553 | $query = "SELECT * FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
1546 | $rq =& $this->db->query($query); |
1554 | $rq =& $this->db->query($query); |
1547 | $rq->fetchInto($element); |
1555 | $rq->fetchInto($element); |
1548 | }
|
1556 | }
|
1549 | 1557 | ||
1550 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> <input type='text' name='rhost' id='rhost' value='".$this->secure->checkStr($element["rhost"],1)."'></div>\n"; |
1558 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> <input type='text' name='rhost' id='rhost' value='".$this->secure->checkStr($element["rhost"],1)."'></div>\n"; |
1551 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1559 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1552 | 1560 | ||
1553 | return $show; |
1561 | return $show; |
1554 | }
|
1562 | }
|
1555 | 1563 | ||
1556 | /**
|
1564 | /**
|
1557 | * Вывод списка корневых папок
|
1565 | * Вывод списка корневых папок
|
1558 | *
|
1566 | *
|
1559 | * @author Alexander Wolf
|
1567 | * @author Alexander Wolf
|
1560 | * @category Core
|
1568 | * @category Core
|
1561 | *
|
1569 | *
|
1562 | * @param string $name
|
1570 | * @param string $name
|
1563 | * @param string $actor
|
1571 | * @param string $actor
|
1564 | * @param string $format
|
1572 | * @param string $format
|
1565 | * @return string
|
1573 | * @return string
|
1566 | */
|
1574 | */
|
1567 | public function showFoldersList($name, $actor, $format = 'list') { |
1575 | public function showFoldersList($name, $actor, $format = 'list') { |
1568 | switch($format) { |
1576 | switch($format) { |
1569 | case 'list': |
1577 | case 'list': |
1570 | $query = "SELECT * FROM ".$this->prefix."repfolder"; |
1578 | $query = "SELECT * FROM ".$this->prefix."repfolder"; |
1571 | $rq =& $this->db->query($query); |
1579 | $rq =& $this->db->query($query); |
1572 | $show = "<ul>\n"; |
1580 | $show = "<ul>\n"; |
1573 | while ($rq->fetchInto($element)) { |
1581 | while ($rq->fetchInto($element)) { |
1574 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["rfolder_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["rfolder_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["rfolder"],1)."</li>\n"; |
1582 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["rfolder_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["rfolder_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["rfolder"],1)."</li>\n"; |
1575 | }
|
1583 | }
|
1576 | $show .= "</ul>"; |
1584 | $show .= "</ul>"; |
1577 | break; |
1585 | break; |
1578 | case 'innerhtml': |
1586 | case 'innerhtml': |
1579 | $folderID = $this->secure->checkInt($actor); |
1587 | $folderID = $this->secure->checkInt($actor); |
1580 | $query = "SELECT * FROM ".$this->prefix."repfolder"; |
1588 | $query = "SELECT * FROM ".$this->prefix."repfolder"; |
1581 | $rq =& $this->db->query($query); |
1589 | $rq =& $this->db->query($query); |
1582 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1590 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1583 | while ($rq->fetchInto($element)) { |
1591 | while ($rq->fetchInto($element)) { |
1584 | if ($element["rfolder_id"]==$folderID) { |
1592 | if ($element["rfolder_id"]==$folderID) { |
1585 | $show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."' selected>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
1593 | $show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."' selected>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
1586 | } else { |
1594 | } else { |
1587 | $show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."'>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
1595 | $show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."'>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
1588 | }
|
1596 | }
|
1589 | }
|
1597 | }
|
1590 | $show .= "</select>"; |
1598 | $show .= "</select>"; |
1591 | break; |
1599 | break; |
1592 | }
|
1600 | }
|
1593 | return $show; |
1601 | return $show; |
1594 | }
|
1602 | }
|
1595 | 1603 | ||
1596 | /**
|
1604 | /**
|
1597 | * Добавление нового корневого каталога
|
1605 | * Добавление нового корневого каталога
|
1598 | *
|
1606 | *
|
1599 | * @author Alexander Wolf
|
1607 | * @author Alexander Wolf
|
1600 | * @category Core
|
1608 | * @category Core
|
1601 | *
|
1609 | *
|
1602 | * @param string $flder
|
1610 | * @param string $flder
|
1603 | * @return array
|
1611 | * @return array
|
1604 | */
|
1612 | */
|
1605 | public function addFolder($folder) { |
1613 | public function addFolder($folder) { |
1606 | $result = array(); |
1614 | $result = array(); |
1607 | $sFolder = $this->secure->checkStr($folder); |
1615 | $sFolder = $this->secure->checkStr($folder); |
1608 | 1616 | ||
1609 | $query = "INSERT INTO ".$this->prefix."repfolder SET rfolder='".$sFolder."'"; |
1617 | $query = "INSERT INTO ".$this->prefix."repfolder SET rfolder='".$sFolder."'"; |
1610 | $rq =& $this->db->query($query); |
1618 | $rq =& $this->db->query($query); |
1611 | if (PEAR::isError($this->db)) { |
1619 | if (PEAR::isError($this->db)) { |
1612 | $result["ERR"] = 1; |
1620 | $result["ERR"] = 1; |
1613 | $result["ERRINFO"] = $this->db->getMessage(); |
1621 | $result["ERRINFO"] = $this->db->getMessage(); |
1614 | } else { |
1622 | } else { |
1615 | $result["ERR"] = 0; |
1623 | $result["ERR"] = 0; |
1616 | }
|
1624 | }
|
1617 | 1625 | ||
1618 | return $result; |
1626 | return $result; |
1619 | }
|
1627 | }
|
1620 | 1628 | ||
1621 | /**
|
1629 | /**
|
1622 | * Удаление информации о корневой папке
|
1630 | * Удаление информации о корневой папке
|
1623 | *
|
1631 | *
|
1624 | * @author Alexander Wolf
|
1632 | * @author Alexander Wolf
|
1625 | * @category Core
|
1633 | * @category Core
|
1626 | *
|
1634 | *
|
1627 | * @param integer $folderID
|
1635 | * @param integer $folderID
|
1628 | * @return array
|
1636 | * @return array
|
1629 | */
|
1637 | */
|
1630 | public function dropFolder($folderID) { |
1638 | public function dropFolder($folderID) { |
1631 | $result = array(); |
1639 | $result = array(); |
1632 | $sFolderID = $this->secure->checkInt($folderID); |
1640 | $sFolderID = $this->secure->checkInt($folderID); |
1633 | 1641 | ||
1634 | // Удаление корневой папки
|
1642 | // Удаление корневой папки
|
1635 | $query = "DELETE FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
1643 | $query = "DELETE FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
1636 | $rq =& $this->db->query($query); |
1644 | $rq =& $this->db->query($query); |
1637 | if (PEAR::isError($this->db)) { |
1645 | if (PEAR::isError($this->db)) { |
1638 | $result["ERR"] = 1; |
1646 | $result["ERR"] = 1; |
1639 | $result["ERRINFO"] = $this->db->getMessage(); |
1647 | $result["ERRINFO"] = $this->db->getMessage(); |
1640 | } else { |
1648 | } else { |
1641 | $result["ERR"] = 0; |
1649 | $result["ERR"] = 0; |
1642 | }
|
1650 | }
|
1643 | 1651 | ||
1644 | return $result; |
1652 | return $result; |
1645 | }
|
1653 | }
|
1646 | 1654 | ||
1647 | /**
|
1655 | /**
|
1648 | * Обновление информации о корневой папки
|
1656 | * Обновление информации о корневой папки
|
1649 | *
|
1657 | *
|
1650 | * @author Alexander Wolf
|
1658 | * @author Alexander Wolf
|
1651 | * @category Core
|
1659 | * @category Core
|
1652 | *
|
1660 | *
|
1653 | * @param integer $folderID
|
1661 | * @param integer $folderID
|
1654 | * @param string $info
|
1662 | * @param string $info
|
1655 | * @return array
|
1663 | * @return array
|
1656 | */
|
1664 | */
|
1657 | public function updateFolder($folderID, $info) { |
1665 | public function updateFolder($folderID, $info) { |
1658 | $result = array(); |
1666 | $result = array(); |
1659 | $sFolderID = $this->secure->checkInt($folderID); |
1667 | $sFolderID = $this->secure->checkInt($folderID); |
1660 | $sFolder = $this->secure->checkStr($info); |
1668 | $sFolder = $this->secure->checkStr($info); |
1661 | 1669 | ||
1662 | $query = "UPDATE ".$this->prefix."repfolder SET rfolder='".$sFolder."' WHERE rfolder_id='".$sFolderID."'"; |
1670 | $query = "UPDATE ".$this->prefix."repfolder SET rfolder='".$sFolder."' WHERE rfolder_id='".$sFolderID."'"; |
1663 | $rq =& $this->db->query($query); |
1671 | $rq =& $this->db->query($query); |
1664 | if (PEAR::isError($this->db)) { |
1672 | if (PEAR::isError($this->db)) { |
1665 | $result["ERR"] = 1; |
1673 | $result["ERR"] = 1; |
1666 | $result["ERRINFO"] = $this->db->getMessage(); |
1674 | $result["ERRINFO"] = $this->db->getMessage(); |
1667 | } else { |
1675 | } else { |
1668 | $result["ERR"] = 0; |
1676 | $result["ERR"] = 0; |
1669 | }
|
1677 | }
|
1670 | 1678 | ||
1671 | return $result; |
1679 | return $result; |
1672 | }
|
1680 | }
|
1673 | 1681 | ||
1674 | /**
|
1682 | /**
|
1675 | * Вывод формы редактирования/добавления корневых папок
|
1683 | * Вывод формы редактирования/добавления корневых папок
|
1676 | *
|
1684 | *
|
1677 | * @author Alexander Wolf
|
1685 | * @author Alexander Wolf
|
1678 | * @category Core
|
1686 | * @category Core
|
1679 | *
|
1687 | *
|
1680 | * @param integer $folderID
|
1688 | * @param integer $folderID
|
1681 | * @param string $info
|
1689 | * @param string $info
|
1682 | * @return string
|
1690 | * @return string
|
1683 | */
|
1691 | */
|
1684 | public function showFolderForm($folderID = 0, $info = "") { |
1692 | public function showFolderForm($folderID = 0, $info = "") { |
1685 | $sFolderID = $this->secure->checkInt($folderID); |
1693 | $sFolderID = $this->secure->checkInt($folderID); |
1686 | $sInfo = $this->secure->checkStr($info, 1); |
1694 | $sInfo = $this->secure->checkStr($info, 1); |
1687 | if ($sInfo == "") { |
1695 | if ($sInfo == "") { |
1688 | $sInfo = "Корневая папка"; |
1696 | $sInfo = "Корневая папка"; |
1689 | }
|
1697 | }
|
1690 | if ($sFolderID != 0) { |
1698 | if ($sFolderID != 0) { |
1691 | // Режим редактирования
|
1699 | // Режим редактирования
|
1692 | $query = "SELECT * FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
1700 | $query = "SELECT * FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
1693 | $rq =& $this->db->query($query); |
1701 | $rq =& $this->db->query($query); |
1694 | $rq->fetchInto($element); |
1702 | $rq->fetchInto($element); |
1695 | }
|
1703 | }
|
1696 | 1704 | ||
1697 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1705 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1698 | $show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> <input type='text' name='rfolder' id='rfolder' value='".$this->secure->checkStr($element["rfolder"],1)."'></div>\n"; |
1706 | $show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> <input type='text' name='rfolder' id='rfolder' value='".$this->secure->checkStr($element["rfolder"],1)."'></div>\n"; |
1699 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1707 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1700 | 1708 | ||
1701 | return $show; |
1709 | return $show; |
1702 | }
|
1710 | }
|
1703 | 1711 | ||
1704 | /**
|
1712 | /**
|
1705 | * Показывает список подписей
|
1713 | * Показывает список подписей
|
1706 | *
|
1714 | *
|
1707 | * @author Alexander Wolf
|
1715 | * @author Alexander Wolf
|
1708 | * @category Core
|
1716 | * @category Core
|
1709 | *
|
1717 | *
|
1710 | * @param string $name
|
1718 | * @param string $name
|
1711 | * @param string $actor
|
1719 | * @param string $actor
|
1712 | * @param string $format
|
1720 | * @param string $format
|
1713 | * @return string
|
1721 | * @return string
|
1714 | */
|
1722 | */
|
1715 | public function showSignsList($name, $actor, $format = 'list') { |
1723 | public function showSignsList($name, $actor, $format = 'list') { |
1716 | $query = "SELECT * FROM ".$this->prefix."signs"; |
1724 | $query = "SELECT * FROM ".$this->prefix."signs"; |
1717 | $rq =& $this->db->query($query); |
1725 | $rq =& $this->db->query($query); |
1718 | switch ($format) { |
1726 | switch ($format) { |
1719 | case 'list': |
1727 | case 'list': |
1720 | $show = "<ul>\n"; |
1728 | $show = "<ul>\n"; |
1721 | while ($rq->fetchInto($element)) { |
1729 | while ($rq->fetchInto($element)) { |
1722 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["sign_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["sign_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["sname"],1)."</li>\n"; |
1730 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["sign_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["sign_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["sname"],1)."</li>\n"; |
1723 | }
|
1731 | }
|
1724 | $show .= "</ul>"; |
1732 | $show .= "</ul>"; |
1725 | break; |
1733 | break; |
1726 | case 'innerhtml': |
1734 | case 'innerhtml': |
1727 | $signID = $this->secure->checkInt($actor); |
1735 | $signID = $this->secure->checkInt($actor); |
1728 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1736 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1729 | $show .= "<option value='0'>Подписи нет</option>\n"; |
1737 | $show .= "<option value='0'>Подписи нет</option>\n"; |
1730 | while ($rq->fetchInto($element)) { |
1738 | while ($rq->fetchInto($element)) { |
1731 | if ($element["sign_id"]==$signID) { |
1739 | if ($element["sign_id"]==$signID) { |
1732 | $show .= "<option value='".$this->secure->checkInt($element["sign_id"])."' selected>".$this->secure->checkStr($element["sname"],1)."</option>\n"; |
1740 | $show .= "<option value='".$this->secure->checkInt($element["sign_id"])."' selected>".$this->secure->checkStr($element["sname"],1)."</option>\n"; |
1733 | } else { |
1741 | } else { |
1734 | $show .= "<option value='".$this->secure->checkInt($element["sign_id"])."'>".$this->secure->checkStr($element["sname"],1)."</option>\n"; |
1742 | $show .= "<option value='".$this->secure->checkInt($element["sign_id"])."'>".$this->secure->checkStr($element["sname"],1)."</option>\n"; |
1735 | }
|
1743 | }
|
1736 | }
|
1744 | }
|
1737 | $show .= "</select>\n"; |
1745 | $show .= "</select>\n"; |
1738 | break; |
1746 | break; |
1739 | }
|
1747 | }
|
1740 | 1748 | ||
1741 | return $show; |
1749 | return $show; |
1742 | }
|
1750 | }
|
1743 | 1751 | ||
1744 | /**
|
1752 | /**
|
1745 | * Вывод формы редактирования/добавления подписей
|
1753 | * Вывод формы редактирования/добавления подписей
|
1746 | *
|
1754 | *
|
1747 | * @author Alexander Wolf
|
1755 | * @author Alexander Wolf
|
1748 | * @category Core
|
1756 | * @category Core
|
1749 | *
|
1757 | *
|
1750 | * @param integer $sectionID
|
1758 | * @param integer $sectionID
|
1751 | * @param string $info
|
1759 | * @param string $info
|
1752 | * @return string
|
1760 | * @return string
|
1753 | */
|
1761 | */
|
1754 | public function showSignsForm($signID = 0, $info = "") { |
1762 | public function showSignsForm($signID = 0, $info = "") { |
1755 | $sSignID = $this->secure->checkInt($signID); |
1763 | $sSignID = $this->secure->checkInt($signID); |
1756 | $sInfo = $this->secure->checkStr($info, 1); |
1764 | $sInfo = $this->secure->checkStr($info, 1); |
1757 | if ($sInfo == "") { |
1765 | if ($sInfo == "") { |
1758 | $sInfo = "Подписи"; |
1766 | $sInfo = "Подписи"; |
1759 | }
|
1767 | }
|
1760 | if ($sSignID != 0) { |
1768 | if ($sSignID != 0) { |
1761 | // Режим редактирования
|
1769 | // Режим редактирования
|
1762 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$sSignID."'"; |
1770 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$sSignID."'"; |
1763 | $rq =& $this->db->query($query); |
1771 | $rq =& $this->db->query($query); |
1764 | $rq->fetchInto($element); |
1772 | $rq->fetchInto($element); |
1765 | }
|
1773 | }
|
1766 | 1774 | ||
1767 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1775 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1768 | $show .= "<div class='inputbox'><label for='sname'>Название подписи:</label> <input type='text' name='sname' id='sname' value='".$this->secure->checkStr($element["sname"],1)."'></div>\n"; |
1776 | $show .= "<div class='inputbox'><label for='sname'>Название подписи:</label> <input type='text' name='sname' id='sname' value='".$this->secure->checkStr($element["sname"],1)."'></div>\n"; |
1769 | $show .= "<div class='inputbox'><label for='sinfo'>Описание подписи:</label> <input type='text' name='sinfo' id='sinfo' value='".$this->secure->checkStr($element["sinfo"],1)."'></div>\n"; |
1777 | $show .= "<div class='inputbox'><label for='sinfo'>Описание подписи:</label> <input type='text' name='sinfo' id='sinfo' value='".$this->secure->checkStr($element["sinfo"],1)."'></div>\n"; |
1770 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1778 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1771 | 1779 | ||
1772 | return $show; |
1780 | return $show; |
1773 | }
|
1781 | }
|
1774 | 1782 | ||
1775 | /**
|
1783 | /**
|
1776 | * Обновление информации о секции
|
1784 | * Обновление информации о секции
|
1777 | *
|
1785 | *
|
1778 | * @author Alexander Wolf
|
1786 | * @author Alexander Wolf
|
1779 | * @category Core
|
1787 | * @category Core
|
1780 | *
|
1788 | *
|
1781 | * @param integer $sectionID
|
1789 | * @param integer $sectionID
|
1782 | * @param string $sname
|
1790 | * @param string $sname
|
1783 | * @param string $sinfo
|
1791 | * @param string $sinfo
|
1784 | * @return array
|
1792 | * @return array
|
1785 | */
|
1793 | */
|
1786 | public function updateSign($signID, $sname, $sinfo = "") { |
1794 | public function updateSign($signID, $sname, $sinfo = "") { |
1787 | $result = array(); |
1795 | $result = array(); |
1788 | $sSignID = $this->secure->checkInt($signID); |
1796 | $sSignID = $this->secure->checkInt($signID); |
1789 | $sSName = $this->secure->checkStr($sname); |
1797 | $sSName = $this->secure->checkStr($sname); |
1790 | $sSInfo = $this->secure->checkStr($sinfo); |
1798 | $sSInfo = $this->secure->checkStr($sinfo); |
1791 | 1799 | ||
1792 | $query = "UPDATE ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."' WHERE sign_id='".$sSignID."'"; |
1800 | $query = "UPDATE ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."' WHERE sign_id='".$sSignID."'"; |
1793 | $rq =& $this->db->query($query); |
1801 | $rq =& $this->db->query($query); |
1794 | if (PEAR::isError($this->db)) { |
1802 | if (PEAR::isError($this->db)) { |
1795 | $result["ERR"] = 1; |
1803 | $result["ERR"] = 1; |
1796 | $result["ERRINFO"] = $this->db->getMessage(); |
1804 | $result["ERRINFO"] = $this->db->getMessage(); |
1797 | } else { |
1805 | } else { |
1798 | $result["ERR"] = 0; |
1806 | $result["ERR"] = 0; |
1799 | }
|
1807 | }
|
1800 | 1808 | ||
1801 | return $result; |
1809 | return $result; |
1802 | }
|
1810 | }
|
1803 | 1811 | ||
1804 | /**
|
1812 | /**
|
1805 | * Удаление информации о подписи
|
1813 | * Удаление информации о подписи
|
1806 | *
|
1814 | *
|
1807 | * @author Alexander Wolf
|
1815 | * @author Alexander Wolf
|
1808 | * @category Core
|
1816 | * @category Core
|
1809 | *
|
1817 | *
|
1810 | * @param integer $sectionID
|
1818 | * @param integer $sectionID
|
1811 | * @return array
|
1819 | * @return array
|
1812 | */
|
1820 | */
|
1813 | public function dropSign($signID) { |
1821 | public function dropSign($signID) { |
1814 | $result = array(); |
1822 | $result = array(); |
1815 | $sSignID = $this->secure->checkInt($signID); |
1823 | $sSignID = $this->secure->checkInt($signID); |
1816 | 1824 | ||
1817 | // Удаление подписи
|
1825 | // Удаление подписи
|
1818 | $query = "DELETE FROM ".$this->prefix."signs WHERE sign_id='".$sSignID."'"; |
1826 | $query = "DELETE FROM ".$this->prefix."signs WHERE sign_id='".$sSignID."'"; |
1819 | $rq =& $this->db->query($query); |
1827 | $rq =& $this->db->query($query); |
1820 | if (PEAR::isError($this->db)) { |
1828 | if (PEAR::isError($this->db)) { |
1821 | $result["ERR"] = 1; |
1829 | $result["ERR"] = 1; |
1822 | $result["ERRINFO"] = $this->db->getMessage(); |
1830 | $result["ERRINFO"] = $this->db->getMessage(); |
1823 | } else { |
1831 | } else { |
1824 | $result["ERR"] = 0; |
1832 | $result["ERR"] = 0; |
1825 | }
|
1833 | }
|
1826 | 1834 | ||
1827 | return $result; |
1835 | return $result; |
1828 | }
|
1836 | }
|
1829 | 1837 | ||
1830 | /**
|
1838 | /**
|
1831 | * Добавление новой подписи
|
1839 | * Добавление новой подписи
|
1832 | *
|
1840 | *
|
1833 | * @author Alexander Wolf
|
1841 | * @author Alexander Wolf
|
1834 | * @category Core
|
1842 | * @category Core
|
1835 | *
|
1843 | *
|
1836 | * @param string $sname
|
1844 | * @param string $sname
|
1837 | * @param string $sinfo
|
1845 | * @param string $sinfo
|
1838 | * @return array
|
1846 | * @return array
|
1839 | */
|
1847 | */
|
1840 | public function addSign($sname, $sinfo = "") { |
1848 | public function addSign($sname, $sinfo = "") { |
1841 | $result = array(); |
1849 | $result = array(); |
1842 | $sSName = $this->secure->checkStr($sname); |
1850 | $sSName = $this->secure->checkStr($sname); |
1843 | $sSInfo = $this->secure->checkStr($sinfo); |
1851 | $sSInfo = $this->secure->checkStr($sinfo); |
1844 | 1852 | ||
1845 | $query = "INSERT INTO ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."'"; |
1853 | $query = "INSERT INTO ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."'"; |
1846 | $rq =& $this->db->query($query); |
1854 | $rq =& $this->db->query($query); |
1847 | if (PEAR::isError($this->db)) { |
1855 | if (PEAR::isError($this->db)) { |
1848 | $result["ERR"] = 1; |
1856 | $result["ERR"] = 1; |
1849 | $result["ERRINFO"] = $this->db->getMessage(); |
1857 | $result["ERRINFO"] = $this->db->getMessage(); |
1850 | } else { |
1858 | } else { |
1851 | $result["ERR"] = 0; |
1859 | $result["ERR"] = 0; |
1852 | }
|
1860 | }
|
1853 | 1861 | ||
1854 | return $result; |
1862 | return $result; |
1855 | }
|
1863 | }
|
1856 | 1864 | ||
1857 | /**
|
1865 | /**
|
1858 | * Проверка пароля (из формы авторизации)
|
1866 | * Проверка пароля (из формы авторизации)
|
1859 | *
|
1867 | *
|
1860 | * @author Alexander Wolf
|
1868 | * @author Alexander Wolf
|
1861 | * @category Core
|
1869 | * @category Core
|
1862 | *
|
1870 | *
|
1863 | * @param string $word
|
1871 | * @param string $word
|
1864 | * @return array
|
1872 | * @return array
|
1865 | */
|
1873 | */
|
1866 | public function checkSign($word) { |
1874 | public function checkSign($word) { |
1867 | $result = array(); |
1875 | $result = array(); |
1868 | 1876 | ||
1869 | $sHash = $this->secure->encryptStr($word); |
1877 | $sHash = $this->secure->encryptStr($word); |
1870 | $pwd = $this->getOption("passwd"); |
1878 | $pwd = $this->getOption("passwd"); |
1871 | if ($sHash == $pwd["OptValue"]) { |
1879 | if ($sHash == $pwd["OptValue"]) { |
1872 | $result["ERR"] = 0; |
1880 | $result["ERR"] = 0; |
1873 | $result["Location"] = "manager.php"; |
1881 | $result["Location"] = "manager.php"; |
1874 | setcookie($this->cookie, $sHash); |
1882 | setcookie($this->cookie, $sHash); |
1875 | } else { |
1883 | } else { |
1876 | $result["ERR"] = 1; |
1884 | $result["ERR"] = 1; |
1877 | $result["ERRINFO"] = "Password not valid"; |
1885 | $result["ERRINFO"] = "Password not valid"; |
1878 | $result["Location"] = "manager.php?error=1"; |
1886 | $result["Location"] = "manager.php?error=1"; |
1879 | }
|
1887 | }
|
1880 | 1888 | ||
1881 | return $result; |
1889 | return $result; |
1882 | }
|
1890 | }
|
1883 | 1891 | ||
1884 | /**
|
1892 | /**
|
1885 | * Проверка пароля (из cookies)
|
1893 | * Проверка пароля (из cookies)
|
1886 | *
|
1894 | *
|
1887 | * @author Alexander Wolf
|
1895 | * @author Alexander Wolf
|
1888 | * @category Core
|
1896 | * @category Core
|
1889 | *
|
1897 | *
|
1890 | * @param string $hash
|
1898 | * @param string $hash
|
1891 | * @return array
|
1899 | * @return array
|
1892 | */
|
1900 | */
|
1893 | public function checkCookieSign($hash) { |
1901 | public function checkCookieSign($hash) { |
1894 | $result = array(); |
1902 | $result = array(); |
1895 | 1903 | ||
1896 | $pwd = $this->getOption("passwd"); |
1904 | $pwd = $this->getOption("passwd"); |
1897 | if ($hash == $pwd["OptValue"]) { |
1905 | if ($hash == $pwd["OptValue"]) { |
1898 | $result["ERR"] = 0; |
1906 | $result["ERR"] = 0; |
1899 | } else { |
1907 | } else { |
1900 | $result["ERR"] = 1; |
1908 | $result["ERR"] = 1; |
1901 | $result["ERRINFO"] = "Hash not valid"; |
1909 | $result["ERRINFO"] = "Hash not valid"; |
1902 | $result["Location"] = "manager.php"; |
1910 | $result["Location"] = "manager.php"; |
1903 | }
|
1911 | }
|
1904 | 1912 | ||
1905 | return $result; |
1913 | return $result; |
1906 | }
|
1914 | }
|
1907 | 1915 | ||
1908 | /**
|
1916 | /**
|
1909 | * Форма ввода пароля
|
1917 | * Форма ввода пароля
|
1910 | *
|
1918 | *
|
1911 | * @author Alexander Wolf
|
1919 | * @author Alexander Wolf
|
1912 | * @category Core
|
1920 | * @category Core
|
1913 | *
|
1921 | *
|
1914 | * @return string
|
1922 | * @return string
|
1915 | */
|
1923 | */
|
1916 | public function showSigninForm() { |
1924 | public function showSigninForm() { |
1917 | $show = "<div id='regform'>"; |
1925 | $show = "<div id='regform'>"; |
1918 | $show .= "<form action='process.php' method='post'>\n"; |
1926 | $show .= "<form action='process.php' method='post'>\n"; |
1919 | $show .= "<fieldset><legend>Пароль</legend>\n"; |
1927 | $show .= "<fieldset><legend>Пароль</legend>\n"; |
1920 | $show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
1928 | $show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
1921 | $show .= "<input type='password' name='word' value=''>\n"; |
1929 | $show .= "<input type='password' name='word' value=''>\n"; |
1922 | $show .= "<input type='submit' value=' Войти '>\n"; |
1930 | $show .= "<input type='submit' value=' Войти '>\n"; |
1923 | $show .= "</fieldset>\n</form></div>\n"; |
1931 | $show .= "</fieldset>\n</form></div>\n"; |
1924 | 1932 | ||
1925 | return $show; |
1933 | return $show; |
1926 | }
|
1934 | }
|
1927 | 1935 | ||
1928 | /**
|
1936 | /**
|
1929 | * Обновление пароля
|
1937 | * Обновление пароля
|
1930 | *
|
1938 | *
|
1931 | * @author Alexander Wolf
|
1939 | * @author Alexander Wolf
|
1932 | * @category Core
|
1940 | * @category Core
|
1933 | *
|
1941 | *
|
1934 | * @param string $word1
|
1942 | * @param string $word1
|
1935 | * @param string $word2
|
1943 | * @param string $word2
|
1936 | * @return array
|
1944 | * @return array
|
1937 | */
|
1945 | */
|
1938 | public function updatePassword($word1, $word2) { |
1946 | public function updatePassword($word1, $word2) { |
1939 | $result = array(); |
1947 | $result = array(); |
1940 | 1948 | ||
1941 | if ($word1 == $word2) { |
1949 | if ($word1 == $word2) { |
1942 | $sWord = $this->secure->encryptStr($word1); |
1950 | $sWord = $this->secure->encryptStr($word1); |
1943 | $r = $this->setOption("passwd", $sWord); |
1951 | $r = $this->setOption("passwd", $sWord); |
1944 | $result = $r; |
1952 | $result = $r; |
1945 | } else { |
1953 | } else { |
1946 | $result["ERR"] = 1; |
1954 | $result["ERR"] = 1; |
1947 | $result["ERRINFO"] = "Passwords is mismatch"; |
1955 | $result["ERRINFO"] = "Passwords is mismatch"; |
1948 | }
|
1956 | }
|
1949 | 1957 | ||
1950 | return $result; |
1958 | return $result; |
1951 | }
|
1959 | }
|
1952 | 1960 | ||
1953 | /**
|
1961 | /**
|
1954 | * Отображение формы создания и редактирования версии apt-дистрибутива
|
1962 | * Отображение формы создания и редактирования версии apt-дистрибутива
|
1955 | *
|
1963 | *
|
1956 | * @author Alexander Wolf
|
1964 | * @author Alexander Wolf
|
1957 | * @category Core
|
1965 | * @category Core
|
1958 | *
|
1966 | *
|
1959 | * @param string $name
|
1967 | * @param string $name
|
1960 | * @param string $actor
|
1968 | * @param string $actor
|
1961 | * @param integer $versionID
|
1969 | * @param integer $versionID
|
1962 | * @return string
|
1970 | * @return string
|
1963 | */
|
1971 | */
|
1964 | public function showDistVersionsForm($versionID = 0, $info = '') { |
1972 | public function showDistVersionsForm($versionID = 0, $info = '') { |
1965 | $sVersionID = $this->secure->checkInt($versionID); |
1973 | $sVersionID = $this->secure->checkInt($versionID); |
1966 | $sInfo = $this->secure->checkStr($info, 1); |
1974 | $sInfo = $this->secure->checkStr($info, 1); |
1967 | if ($sInfo == "") { |
1975 | if ($sInfo == "") { |
1968 | $sInfo = "Версия дистрибутива"; |
1976 | $sInfo = "Версия дистрибутива"; |
1969 | }
|
1977 | }
|
1970 | if ($sVersionID != 0) { |
1978 | if ($sVersionID != 0) { |
1971 | // Режим редактирования
|
1979 | // Режим редактирования
|
1972 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id WHERE v.version_id='".$sVersionID."'"; |
1980 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id WHERE v.version_id='".$sVersionID."'"; |
1973 | $rq =& $this->db->query($query); |
1981 | $rq =& $this->db->query($query); |
1974 | $rq->fetchInto($element); |
1982 | $rq->fetchInto($element); |
1975 | }
|
1983 | }
|
1976 | 1984 | ||
1977 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1985 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1978 | if ($sVersionID != 0) { |
1986 | if ($sVersionID != 0) { |
1979 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n"; |
1987 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n"; |
1980 | } else { |
1988 | } else { |
1981 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> ".$this->showDistributionList("distname", "", "", "innerhtml")."</div>\n"; |
1989 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> ".$this->showDistributionList("distname", "", "", "innerhtml")."</div>\n"; |
1982 | }
|
1990 | }
|
1983 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."'></div>\n"; |
1991 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."'></div>\n"; |
1984 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."'></div>\n"; |
1992 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."'></div>\n"; |
1985 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."'></div>\n"; |
1993 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."'></div>\n"; |
1986 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n"; |
1994 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n"; |
1987 | 1995 | ||
1988 | return $show; |
1996 | return $show; |
1989 | }
|
1997 | }
|
1990 | 1998 | ||
1991 | /**
|
1999 | /**
|
1992 | * Парсер схемы адреса репозитория
|
2000 | * Парсер схемы адреса репозитория
|
1993 | * FIXME Возможно не потребуется
|
2001 | * FIXME Возможно не потребуется
|
1994 | *
|
2002 | *
|
1995 | * @author Alexander Wolf
|
2003 | * @author Alexander Wolf
|
1996 | * @category Core
|
2004 | * @category Core
|
1997 | *
|
2005 | *
|
1998 | * @param string $repstring
|
2006 | * @param string $repstring
|
1999 | * @return integer
|
2007 | * @return integer
|
2000 | */
|
2008 | */
|
2001 | public function repositoryParser($repstring) { |
2009 | public function repositoryParser($repstring) { |
2002 | $tokens = array(); |
2010 | $tokens = array(); |
2003 | $sections = array(); |
2011 | $sections = array(); |
2004 | $tokens = split(" ",$repstring); |
2012 | $tokens = split(" ",$repstring); |
2005 | 2013 | ||
2006 | if ($tokens[0] == "deb") { |
2014 | if ($tokens[0] == "deb") { |
2007 | // debian/ubuntu репозиторий "type proto://host/folder distr sections"
|
2015 | // debian/ubuntu репозиторий "type proto://host/folder distr sections"
|
2008 | $url = parse_url($tokens[1]); |
2016 | $url = parse_url($tokens[1]); |
2009 | $distr = $tokens[2]; |
2017 | $distr = $tokens[2]; |
2010 | 2018 | ||
2011 | for($i=3;$i<count($tokens);$i++) { |
2019 | for($i=3;$i<count($tokens);$i++) { |
2012 | $sections[] = $tokens[$i]; |
2020 | $sections[] = $tokens[$i]; |
2013 | }
|
2021 | }
|
2014 | } else { |
2022 | } else { |
2015 | // altlinux репозиторий "type [sign] proto://host/folder base repname"
|
2023 | // altlinux репозиторий "type [sign] proto://host/folder base repname"
|
2016 | if (stripos($tokens[1],"]")!=0) { |
2024 | if (stripos($tokens[1],"]")!=0) { |
2017 | $sign = $tokens[1]; |
2025 | $sign = $tokens[1]; |
2018 | $url = parse_url($tokens[2]); |
2026 | $url = parse_url($tokens[2]); |
2019 | $base = $tokens[3]; |
2027 | $base = $tokens[3]; |
2020 | $repname = $tokens[4]; |
2028 | $repname = $tokens[4]; |
2021 | } else { |
2029 | } else { |
2022 | $url = parse_url($tokens[1]); |
2030 | $url = parse_url($tokens[1]); |
2023 | $base = $tokens[2]; |
2031 | $base = $tokens[2]; |
2024 | $repname = $tokens[3]; |
2032 | $repname = $tokens[3]; |
2025 | }
|
2033 | }
|
2026 | }
|
2034 | }
|
2027 | 2035 | ||
2028 | $proto = $url["scheme"]."://"; |
2036 | $proto = $url["scheme"]."://"; |
2029 | $addr = $url["host"]; |
2037 | $addr = $url["host"]; |
2030 | if ($url["port"]!="") { |
2038 | if ($url["port"]!="") { |
2031 | $addr .= ":".$url["port"]; |
2039 | $addr .= ":".$url["port"]; |
2032 | }
|
2040 | }
|
2033 | $path = $url["path"]; |
2041 | $path = $url["path"]; |
2034 | 2042 | ||
2035 | return 0; |
2043 | return 0; |
2036 | }
|
2044 | }
|
2037 | 2045 | ||
2038 | /**
|
2046 | /**
|
2039 | * Выгрузка картинок логотипов дистрибутивов
|
2047 | * Выгрузка картинок логотипов дистрибутивов
|
2040 | *
|
2048 | *
|
2041 | * @author Alexander Wolf
|
2049 | * @author Alexander Wolf
|
2042 | * @category Core
|
2050 | * @category Core
|
2043 | *
|
2051 | *
|
2044 | * @param string $path
|
2052 | * @param string $path
|
2045 | * @param string $dist
|
2053 | * @param string $dist
|
2046 | * @param array $datafile
|
2054 | * @param array $datafile
|
2047 | * @return integer
|
2055 | * @return integer
|
2048 | */
|
2056 | */
|
2049 | public function uploadPicture($path, $dist, $datafile) { |
2057 | public function uploadPicture($path, $dist, $datafile) { |
2050 | $folder = $path.$dist."-orig.png"; |
2058 | $folder = $path.$dist."-orig.png"; |
2051 | $folderN = $path.$dist.".png"; |
2059 | $folderN = $path.$dist.".png"; |
2052 | $folderEM = $path.$dist."-em.png"; |
2060 | $folderEM = $path.$dist."-em.png"; |
2053 | 2061 | ||
2054 | $distlogo = 0; |
2062 | $distlogo = 0; |
2055 | if (move_uploaded_file($datafile["distlogo"]["tmp_name"],$folder)) { |
2063 | if (move_uploaded_file($datafile["distlogo"]["tmp_name"],$folder)) { |
2056 | chmod($folder, 0644); |
2064 | chmod($folder, 0644); |
2057 | list($width, $height) = GetImageSize($folder); |
2065 | list($width, $height) = GetImageSize($folder); |
2058 | $percent = 32/$height; |
2066 | $percent = 32/$height; |
2059 | $newwidth = $width * $percent; |
2067 | $newwidth = $width * $percent; |
2060 | $newheight = $height * $percent; |
2068 | $newheight = $height * $percent; |
2061 | 2069 | ||
2062 | $output = ImageCreateTrueColor($newwidth, $newheight); |
2070 | $output = ImageCreateTrueColor($newwidth, $newheight); |
2063 | $source = ImageCreateFromPNG($folder); |
2071 | $source = ImageCreateFromPNG($folder); |
2064 | 2072 | ||
2065 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
2073 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
2066 | ImagePNG($output, $folderEM); |
2074 | ImagePNG($output, $folderEM); |
2067 | 2075 | ||
2068 | $percent = 15/$height; |
2076 | $percent = 15/$height; |
2069 | $newwidth = $width * $percent; |
2077 | $newwidth = $width * $percent; |
2070 | $newheight = $height * $percent; |
2078 | $newheight = $height * $percent; |
2071 | 2079 | ||
2072 | $output = ImageCreateTrueColor($newwidth, $newheight); |
2080 | $output = ImageCreateTrueColor($newwidth, $newheight); |
2073 | 2081 | ||
2074 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
2082 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
2075 | ImagePNG($output, $folderN); |
2083 | ImagePNG($output, $folderN); |
2076 | 2084 | ||
2077 | unlink($folder); |
2085 | unlink($folder); |
2078 | $distlogo = 1; |
2086 | $distlogo = 1; |
2079 | }
|
2087 | }
|
2080 | return $distlogo; |
2088 | return $distlogo; |
2081 | }
|
2089 | }
|
2082 | 2090 | ||
2083 | /**
|
2091 | /**
|
2084 | * Показ списка репозиториев
|
2092 | * Показ списка репозиториев
|
2085 | *
|
2093 | *
|
2086 | * @author Alexander Wolf
|
2094 | * @author Alexander Wolf
|
2087 | * @category Core
|
2095 | * @category Core
|
2088 | *
|
2096 | *
|
2089 | * @param string $name
|
2097 | * @param string $name
|
2090 | * @param string $actor
|
2098 | * @param string $actor
|
2091 | * @param string $format
|
2099 | * @param string $format
|
2092 | * @return string
|
2100 | * @return string
|
2093 | */
|
2101 | */
|
2094 | public function showRepositoriesList($name, $actor, $format = 'list') { |
2102 | public function showRepositoriesList($name, $actor, $format = 'list') { |
2095 | $query = "SELECT r.*,rt.*,v.version_id,CONCAT(d.distname,' ',v.version,' “',v.vname,'”') AS fullname FROM ".$this->prefix."repository r "; |
2103 | $query = "SELECT r.*,rt.*,v.version_id,CONCAT(d.distname,' ',v.version,' “',v.vname,'”') AS fullname FROM ".$this->prefix."repository r "; |
2096 | $query .= "JOIN ".$this->prefix."rtype rt ON rt.rtype_id=r.rtype_id "; |
2104 | $query .= "JOIN ".$this->prefix."rtype rt ON rt.rtype_id=r.rtype_id "; |
2097 | $query .= "JOIN ".$this->prefix."version v ON v.version_id=r.version "; |
2105 | $query .= "JOIN ".$this->prefix."version v ON v.version_id=r.version "; |
2098 | $query .= "JOIN ".$this->prefix."distribution d ON d.dist_id=v.dist_id "; |
2106 | $query .= "JOIN ".$this->prefix."distribution d ON d.dist_id=v.dist_id "; |
2099 | $query .= "ORDER BY v.version_id,r.rep_id ASC"; |
2107 | $query .= "ORDER BY v.version_id,r.rep_id ASC"; |
2100 | $rq =& $this->db->query($query); |
2108 | $rq =& $this->db->query($query); |
2101 | $show = "<ul><li class='nomarker'></li>"; |
2109 | $show = "<ul><li class='nomarker'></li>"; |
2102 | $splitter = 0; |
2110 | $splitter = 0; |
2103 | while ($rq->fetchInto($element)) { |
2111 | while ($rq->fetchInto($element)) { |
2104 | if ($splitter != $this->secure->checkInt($element["version_id"])) { |
2112 | if ($splitter != $this->secure->checkInt($element["version_id"])) { |
2105 | $splitter = $this->secure->checkInt($element["version_id"]); |
2113 | $splitter = $this->secure->checkInt($element["version_id"]); |
2106 | $show .= "</ul><ul><li class='nomarker'><strong>Репозитории для ".$this->secure->checkStr($element["fullname"],1)."</strong></li>"; |
2114 | $show .= "</ul><ul><li class='nomarker'><strong>Репозитории для ".$this->secure->checkStr($element["fullname"],1)."</strong></li>"; |
2107 | }
|
2115 | }
|
2108 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$this->secure->checkInt($element["rep_id"])."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$this->secure->checkInt($element["rep_id"])."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["repname"],1)." (<em>".$this->secure->checkStr($element["rtype"],1)."</em>)</li>\n"; |
2116 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$this->secure->checkInt($element["rep_id"])."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$this->secure->checkInt($element["rep_id"])."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["repname"],1)." (<em>".$this->secure->checkStr($element["rtype"],1)."</em>)</li>\n"; |
2109 | }
|
2117 | }
|
2110 | $show .= "</ul>"; |
2118 | $show .= "</ul>"; |
2111 | return $show; |
2119 | return $show; |
2112 | }
|
2120 | }
|
2113 | 2121 | ||
2114 | /**
|
2122 | /**
|
2115 | * Вывод списка типов репозиториев
|
2123 | * Вывод списка типов репозиториев
|
2116 | *
|
2124 | *
|
2117 | * @author Alexander Wolf
|
2125 | * @author Alexander Wolf
|
2118 | * @category Core
|
2126 | * @category Core
|
2119 | *
|
2127 | *
|
2120 | * @param integer $reptype
|
2128 | * @param integer $reptype
|
2121 | * @param string $name
|
2129 | * @param string $name
|
2122 | * @return string
|
2130 | * @return string
|
2123 | */
|
2131 | */
|
2124 | public function showRepType($reptype = 0, $name = "") { |
2132 | public function showRepType($reptype = 0, $name = "") { |
2125 | $sRT = $this->secure->checkInt($reptype); |
2133 | $sRT = $this->secure->checkInt($reptype); |
2126 | $sNM = $this->secure->checkStr($name,1); |
2134 | $sNM = $this->secure->checkStr($name,1); |
2127 | $query = "SELECT * FROM ".$this->prefix."rtype"; |
2135 | $query = "SELECT * FROM ".$this->prefix."rtype"; |
2128 | $rq =& $this->db->query($query); |
2136 | $rq =& $this->db->query($query); |
2129 | $show = "<select name='".$sNM."' id='".$sNM."'>\n"; |
2137 | $show = "<select name='".$sNM."' id='".$sNM."'>\n"; |
2130 | while ($rq->fetchInto($element)) { |
2138 | while ($rq->fetchInto($element)) { |
2131 | if ($element["rtype_id"]==$sRT) { |
2139 | if ($element["rtype_id"]==$sRT) { |
2132 | $show .= "<option value='".$this->secure->checkInt($element["rtype_id"])."' selected>".$this->secure->checkStr($element["rtype"],1)."</option>\n"; |
2140 | $show .= "<option value='".$this->secure->checkInt($element["rtype_id"])."' selected>".$this->secure->checkStr($element["rtype"],1)."</option>\n"; |
2133 | } else { |
2141 | } else { |
2134 | $show .= "<option value='".$this->secure->checkInt($element["rtype_id"])."'>".$this->secure->checkStr($element["rtype"],1)."</option>\n"; |
2142 | $show .= "<option value='".$this->secure->checkInt($element["rtype_id"])."'>".$this->secure->checkStr($element["rtype"],1)."</option>\n"; |
2135 | }
|
2143 | }
|
2136 | }
|
2144 | }
|
2137 | $show .= "</select>"; |
2145 | $show .= "</select>"; |
2138 | 2146 | ||
2139 | return $show; |
2147 | return $show; |
2140 | }
|
2148 | }
|
2141 | 2149 | ||
2142 | /**
|
2150 | /**
|
2143 | * Вывод списка версий дистрибутивов
|
2151 | * Вывод списка версий дистрибутивов
|
2144 | *
|
2152 | *
|
2145 | * @author Alexander Wolf
|
2153 | * @author Alexander Wolf
|
2146 | * @category Core
|
2154 | * @category Core
|
2147 | *
|
2155 | *
|
2148 | * @param string $name
|
2156 | * @param string $name
|
2149 | * @param integer $versionID
|
2157 | * @param integer $versionID
|
2150 | * @return string
|
2158 | * @return string
|
2151 | */
|
2159 | */
|
2152 | public function showVDList($name, $versionID = 0) { |
2160 | public function showVDList($name, $versionID = 0) { |
2153 | $query = "SELECT v.version_id, CONCAT(d.distname, ' ', v.version, ' ', v.vname) AS fullname FROM ".$this->prefix."version v "; |
2161 | $query = "SELECT v.version_id, CONCAT(d.distname, ' ', v.version, ' ', v.vname) AS fullname FROM ".$this->prefix."version v "; |
2154 | $query .= "JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id"; |
2162 | $query .= "JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id"; |
2155 | $rq =& $this->db->query($query); |
2163 | $rq =& $this->db->query($query); |
2156 | $show = "<select name='".$name."' id='".$name."'>\n"; |
2164 | $show = "<select name='".$name."' id='".$name."'>\n"; |
2157 | while ($rq->fetchInto($element)) { |
2165 | while ($rq->fetchInto($element)) { |
2158 | if ($element["version_id"]==$versionID) { |
2166 | if ($element["version_id"]==$versionID) { |
2159 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."' selected>".$this->secure->checkStr($element["fullname"],1)."</option>\n"; |
2167 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."' selected>".$this->secure->checkStr($element["fullname"],1)."</option>\n"; |
2160 | } else { |
2168 | } else { |
2161 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["fullname"],1)."</option>\n"; |
2169 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["fullname"],1)."</option>\n"; |
2162 | }
|
2170 | }
|
2163 | }
|
2171 | }
|
2164 | $show .= "</select>"; |
2172 | $show .= "</select>"; |
2165 | return $show; |
2173 | return $show; |
2166 | }
|
2174 | }
|
2167 | 2175 | ||
2168 | /**
|
2176 | /**
|
2169 | * Форма создания/редактирвоания репозиториев
|
2177 | * Форма создания/редактирвоания репозиториев
|
2170 | *
|
2178 | *
|
2171 | * @author Alexander Wolf
|
2179 | * @author Alexander Wolf
|
2172 | * @category Core
|
2180 | * @category Core
|
2173 | *
|
2181 | *
|
2174 | * @param integer $repID
|
2182 | * @param integer $repID
|
2175 | * @param string $info
|
2183 | * @param string $info
|
2176 | * @param string $reptype
|
2184 | * @param string $reptype
|
2177 | * @return string
|
2185 | * @return string
|
2178 | */
|
2186 | */
|
2179 | public function showRepositoriesForm($repID = 0, $info = "") { |
2187 | public function showRepositoriesForm($repID = 0, $info = "") { |
2180 | $sRepID = $this->secure->checkInt($repID); |
2188 | $sRepID = $this->secure->checkInt($repID); |
2181 | $sInfo = $this->secure->checkStr($info, 1); |
2189 | $sInfo = $this->secure->checkStr($info, 1); |
2182 | if ($sInfo == "") { |
2190 | if ($sInfo == "") { |
2183 | $sInfo = "Репозиторий"; |
2191 | $sInfo = "Репозиторий"; |
2184 | }
|
2192 | }
|
2185 | if ($sRepID != 0) { |
2193 | if ($sRepID != 0) { |
2186 | // Режим редактирования
|
2194 | // Режим редактирования
|
2187 | $query = "SELECT r.*,v.*,d.dist_id,dt.type FROM ".$this->prefix."repository r "; |
2195 | $query = "SELECT r.*,v.*,d.dist_id,dt.type FROM ".$this->prefix."repository r "; |
2188 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
2196 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
2189 | $query .= "JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id "; |
2197 | $query .= "JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id "; |
2190 | $query .= "JOIN ".$this->prefix."dtype dt ON d.disttype=dt.type_id "; |
2198 | $query .= "JOIN ".$this->prefix."dtype dt ON d.disttype=dt.type_id "; |
2191 | $query .= "WHERE r.rep_id='".$sRepID."'"; |
2199 | $query .= "WHERE r.rep_id='".$sRepID."'"; |
2192 | $rq =& $this->db->query($query); |
2200 | $rq =& $this->db->query($query); |
2193 | $rq->fetchInto($element); |
2201 | $rq->fetchInto($element); |
2194 | }
|
2202 | }
|
2195 | 2203 | ||
2196 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
2204 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
2197 | $show .= "<div class='inputbox'><label for='rdist'>Дистрибутив:</label> ".$this->showVDList("rdist",$this->secure->checkInt($element["version_id"]),"innerhtml")."</div>\n"; |
2205 | $show .= "<div class='inputbox'><label for='rdist'>Дистрибутив:</label> ".$this->showVDList("rdist",$this->secure->checkInt($element["version_id"]),"innerhtml")."</div>\n"; |
2198 | $show .= "<div class='inputbox'><label for='rname'>Название репозитория:</label> <input type='text' name='rname' value=\"".$this->secure->checkStr($element["repname"],1)."\"></div>\n"; |
2206 | $show .= "<div class='inputbox'><label for='rname'>Название репозитория:</label> <input type='text' name='rname' value=\"".$this->secure->checkStr($element["repname"],1)."\"></div>\n"; |
2199 | $show .= "<div class='inputbox'><label for='rinfo'>Описание репозитория:</label> <input type='text' name='rinfo' value=\"".$this->secure->checkStr($element["repinfo"],1)."\"></div>\n"; |
2207 | $show .= "<div class='inputbox'><label for='rinfo'>Описание репозитория:</label> <input type='text' name='rinfo' value=\"".$this->secure->checkStr($element["repinfo"],1)."\"></div>\n"; |
2200 | $show .= "<div class='inputbox'><label for='rkey'>Ключ подписи репозитория:</label> <input type='text' name='rkey' value=\"".$this->secure->checkStr($element["repkey"],1)."\"></div>\n"; |
2208 | $show .= "<div class='inputbox'><label for='rkey'>Ключ подписи репозитория:</label> <input type='text' name='rkey' value=\"".$this->secure->checkStr($element["repkey"],1)."\"></div>\n"; |
2201 | $show .= "<div class='inputbox'><label for='rproto'>Протокол доступа:</label> ".$this->showProtoList("rproto",$this->secure->checkInt($element["proto_id"]),"innerhtml")."</div>\n"; |
2209 | $show .= "<div class='inputbox'><label for='rproto'>Протокол доступа:</label> ".$this->showProtoList("rproto",$this->secure->checkInt($element["proto_id"]),"innerhtml")."</div>\n"; |
2202 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> ".$this->showHostsList("rhost",$this->secure->checkInt($element["rhost_id"]),"innerhtml")."</div>\n"; |
2210 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> ".$this->showHostsList("rhost",$this->secure->checkInt($element["rhost_id"]),"innerhtml")."</div>\n"; |
2203 | $show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> ".$this->showFoldersList("rfolder",$this->secure->checkInt($element["rfolder_id"]),"innerhtml")."</div>\n"; |
2211 | $show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> ".$this->showFoldersList("rfolder",$this->secure->checkInt($element["rfolder_id"]),"innerhtml")."</div>\n"; |
2204 | $show .= "<div class='inputbox'><label for='rtype'>Тип репозитория:</label> ".$this->showRepType($this->secure->checkInt($element["rtype_id"]), "rtype")."</div>\n"; |
2212 | $show .= "<div class='inputbox'><label for='rtype'>Тип репозитория:</label> ".$this->showRepType($this->secure->checkInt($element["rtype_id"]), "rtype")."</div>\n"; |
2205 | $show .= "<div class='inputbox'><label for='rsects'>Секции репозитория:</label> <div class='formwrapper'>".$this->showSectionsList("rsects",$sRepID,"innerhtml")."</div></div>\n"; |
2213 | $show .= "<div class='inputbox'><label for='rsects'>Секции репозитория:</label> <div class='formwrapper'>".$this->showSectionsList("rsects",$sRepID,"innerhtml")."</div></div>\n"; |
2206 | $show .= "<div class='inputbox'><label for='rarchs'>Архитектуры:</label> <div class='formwrapper'>".$this->showArchList("rarchs",$sRepID,"innerhtml")."</div></div>\n"; |
2214 | $show .= "<div class='inputbox'><label for='rarchs'>Архитектуры:</label> <div class='formwrapper'>".$this->showArchList("rarchs",$sRepID,"innerhtml")."</div></div>\n"; |
2207 | $show .= "<div class='inputbox'><label for='rscheme'>Схема репозитория:</label> ".$this->showSchemeList("rscheme",$this->secure->checkInt($element["scheme_id"]),"innerhtml")."</div>\n"; |
2215 | $show .= "<div class='inputbox'><label for='rscheme'>Схема репозитория:</label> ".$this->showSchemeList("rscheme",$this->secure->checkInt($element["scheme_id"]),"innerhtml")."</div>\n"; |
2208 | $show .= "<div class='inputbox'><label for='rsign'>Подпись репозитория:</label> ".$this->showSignsList("rsign",$this->secure->checkInt($element["sign_id"]),"innerhtml")."</div>\n"; |
2216 | $show .= "<div class='inputbox'><label for='rsign'>Подпись репозитория:</label> ".$this->showSignsList("rsign",$this->secure->checkInt($element["sign_id"]),"innerhtml")."</div>\n"; |
2209 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n"; |
2217 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n"; |
2210 | 2218 | ||
2211 | return $show; |
2219 | return $show; |
2212 | }
|
2220 | }
|
2213 | 2221 | ||
2214 | /**
|
2222 | /**
|
2215 | * Добавление нового репозитория
|
2223 | * Добавление нового репозитория
|
2216 | *
|
2224 | *
|
2217 | * @author Alexander Wolf
|
2225 | * @author Alexander Wolf
|
2218 | * @category Core
|
2226 | * @category Core
|
2219 | *
|
2227 | *
|
2220 | * @param integer $verionID
|
2228 | * @param integer $verionID
|
2221 | * @param string $rname
|
2229 | * @param string $rname
|
2222 | * @param string $rinfo
|
2230 | * @param string $rinfo
|
2223 | * @param string $rkey
|
2231 | * @param string $rkey
|
2224 | * @param integer $proto
|
2232 | * @param integer $proto
|
2225 | * @param integer $rhost
|
2233 | * @param integer $rhost
|
2226 | * @param integer $rfolder
|
2234 | * @param integer $rfolder
|
2227 | * @param integer $rtype
|
2235 | * @param integer $rtype
|
2228 | * @param array $sections
|
2236 | * @param array $sections
|
2229 | * @param array $arch
|
2237 | * @param array $arch
|
2230 | * @param integer $scheme
|
2238 | * @param integer $scheme
|
2231 | * @param integer $sign
|
2239 | * @param integer $sign
|
2232 | * @return array
|
2240 | * @return array
|
2233 | */
|
2241 | */
|
2234 | public function addRepository($verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) { |
2242 | public function addRepository($verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) { |
2235 | $result = array(); |
2243 | $result = array(); |
2236 | $sVersionID = $this->secure->checkInt($verionID); |
2244 | $sVersionID = $this->secure->checkInt($verionID); |
2237 | $sRName = $this->secure->checkStr($rname); |
2245 | $sRName = $this->secure->checkStr($rname); |
2238 | $sRInfo = $this->secure->checkStr($rinfo); |
2246 | $sRInfo = $this->secure->checkStr($rinfo); |
2239 | $sRKey = $this->secure->checkStr($rkey); |
2247 | $sRKey = $this->secure->checkStr($rkey); |
2240 | $sProto = $this->secure->checkInt($proto); |
2248 | $sProto = $this->secure->checkInt($proto); |
2241 | $sRHost = $this->secure->checkInt($rhost); |
2249 | $sRHost = $this->secure->checkInt($rhost); |
2242 | $sRFolder = $this->secure->checkInt($rfolder); |
2250 | $sRFolder = $this->secure->checkInt($rfolder); |
2243 | $sRType = $this->secure->checkInt($rtype); |
2251 | $sRType = $this->secure->checkInt($rtype); |
2244 | $sRScheme = $this->secure->checkInt($scheme); |
2252 | $sRScheme = $this->secure->checkInt($scheme); |
2245 | $sRSign = $this->secure->checkInt($sign); |
2253 | $sRSign = $this->secure->checkInt($sign); |
2246 | 2254 | ||
2247 | $query = "INSERT INTO ".$this->prefix."repository SET proto_id='".$sProto."', rhost_id='".$sRHost."', rfolder_id='".$sRFolder."', version='".$sVersionID."', rtype_id='".$sRType."', scheme_id='".$sRScheme."', sign_id='".$sRSign."', repname='".$sRName."', repinfo='".$sRInfo."', repkey='".$sRKey."'"; |
2255 | $query = "INSERT INTO ".$this->prefix."repository SET proto_id='".$sProto."', rhost_id='".$sRHost."', rfolder_id='".$sRFolder."', version='".$sVersionID."', rtype_id='".$sRType."', scheme_id='".$sRScheme."', sign_id='".$sRSign."', repname='".$sRName."', repinfo='".$sRInfo."', repkey='".$sRKey."'"; |
2248 | $rq =& $this->db->query($query); |
2256 | $rq =& $this->db->query($query); |
2249 | 2257 | ||
2250 | $query = "SELECT rep_id FROM ".$this->prefix."repository ORDER BY rep_id DESC LIMIT 0, 1"; |
2258 | $query = "SELECT rep_id FROM ".$this->prefix."repository ORDER BY rep_id DESC LIMIT 0, 1"; |
2251 | $rq =& $this->db->query($query); |
2259 | $rq =& $this->db->query($query); |
2252 | $rq->fetchInto($repository); |
2260 | $rq->fetchInto($repository); |
2253 | 2261 | ||
2254 | for($i=0;$i<count($sections);$i++) { |
2262 | for($i=0;$i<count($sections);$i++) { |
2255 | $query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$repository["rep_id"]."', sect_id='".$sections[$i]."'"; |
2263 | $query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$repository["rep_id"]."', sect_id='".$sections[$i]."'"; |
2256 | $rq =& $this->db->query($query); |
2264 | $rq =& $this->db->query($query); |
2257 | }
|
2265 | }
|
2258 | 2266 | ||
2259 | for($i=0;$i<count($arch);$i++) { |
2267 | for($i=0;$i<count($arch);$i++) { |
2260 | $query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$repository["rep_id"]."', arch_id='".$arch[$i]."'"; |
2268 | $query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$repository["rep_id"]."', arch_id='".$arch[$i]."'"; |
2261 | $rq =& $this->db->query($query); |
2269 | $rq =& $this->db->query($query); |
2262 | }
|
2270 | }
|
2263 | 2271 | ||
2264 | if (PEAR::isError($this->db)) { |
2272 | if (PEAR::isError($this->db)) { |
2265 | $result["ERR"] = 1; |
2273 | $result["ERR"] = 1; |
2266 | $result["ERRINFO"] = $this->db->getMessage(); |
2274 | $result["ERRINFO"] = $this->db->getMessage(); |
2267 | } else { |
2275 | } else { |
2268 | $result["ERR"] = 0; |
2276 | $result["ERR"] = 0; |
2269 | }
|
2277 | }
|
2270 | 2278 | ||
2271 | return $result; |
2279 | return $result; |
2272 | }
|
2280 | }
|
2273 | 2281 | ||
2274 | /**
|
2282 | /**
|
2275 | * Обновление информации о репозитории
|
2283 | * Обновление информации о репозитории
|
2276 | *
|
2284 | *
|
2277 | * @author Alexander Wolf
|
2285 | * @author Alexander Wolf
|
2278 | * @category Core
|
2286 | * @category Core
|
2279 | *
|
2287 | *
|
2280 | * @param integer $repID
|
2288 | * @param integer $repID
|
2281 | * @param integer $verionID
|
2289 | * @param integer $verionID
|
2282 | * @param string $rname
|
2290 | * @param string $rname
|
2283 | * @param string $rinfo
|
2291 | * @param string $rinfo
|
2284 | * @param string $rkey
|
2292 | * @param string $rkey
|
2285 | * @param integer $proto
|
2293 | * @param integer $proto
|
2286 | * @param integer $rhost
|
2294 | * @param integer $rhost
|
2287 | * @param integer $rfolder
|
2295 | * @param integer $rfolder
|
2288 | * @param integer $rtype
|
2296 | * @param integer $rtype
|
2289 | * @param array $sections
|
2297 | * @param array $sections
|
2290 | * @param array $arch
|
2298 | * @param array $arch
|
2291 | * @param integer $scheme
|
2299 | * @param integer $scheme
|
2292 | * @param integer $sign
|
2300 | * @param integer $sign
|
2293 | * @return array
|
2301 | * @return array
|
2294 | */
|
2302 | */
|
2295 | public function updateRepository($repID, $verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) { |
2303 | public function updateRepository($repID, $verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) { |
2296 | $result = array(); |
2304 | $result = array(); |
2297 | $sRepID = $this->secure->checkInt($repID); |
2305 | $sRepID = $this->secure->checkInt($repID); |
2298 | $sVersionID = $this->secure->checkInt($verionID); |
2306 | $sVersionID = $this->secure->checkInt($verionID); |
2299 | $sRName = $this->secure->checkStr($rname); |
2307 | $sRName = $this->secure->checkStr($rname); |
2300 | $sRInfo = $this->secure->checkStr($rinfo); |
2308 | $sRInfo = $this->secure->checkStr($rinfo); |
2301 | $sRKey = $this->secure->checkStr($rkey); |
2309 | $sRKey = $this->secure->checkStr($rkey); |
2302 | $sProto = $this->secure->checkInt($proto); |
2310 | $sProto = $this->secure->checkInt($proto); |
2303 | $sRHost = $this->secure->checkInt($rhost); |
2311 | $sRHost = $this->secure->checkInt($rhost); |
2304 | $sRFolder = $this->secure->checkInt($rfolder); |
2312 | $sRFolder = $this->secure->checkInt($rfolder); |
2305 | $sRType = $this->secure->checkInt($rtype); |
2313 | $sRType = $this->secure->checkInt($rtype); |
2306 | $sRScheme = $this->secure->checkInt($scheme); |
2314 | $sRScheme = $this->secure->checkInt($scheme); |
2307 | $sRSign = $this->secure->checkInt($sign); |
2315 | $sRSign = $this->secure->checkInt($sign); |
2308 | 2316 | ||
2309 | $query = "UPDATE ".$this->prefix."repository SET proto_id='".$sProto."', rhost_id='".$sRHost."', rfolder_id='".$sRFolder."', version='".$sVersionID."', rtype_id='".$sRType."', scheme_id='".$sRScheme."', sign_id='".$sRSign."', repname='".$sRName."', repinfo='".$sRInfo."', repkey='".$sRKey."' WHERE rep_id='".$sRepID."'"; |
2317 | $query = "UPDATE ".$this->prefix."repository SET proto_id='".$sProto."', rhost_id='".$sRHost."', rfolder_id='".$sRFolder."', version='".$sVersionID."', rtype_id='".$sRType."', scheme_id='".$sRScheme."', sign_id='".$sRSign."', repname='".$sRName."', repinfo='".$sRInfo."', repkey='".$sRKey."' WHERE rep_id='".$sRepID."'"; |
2310 | $rq =& $this->db->query($query); |
2318 | $rq =& $this->db->query($query); |
2311 | 2319 | ||
2312 | $query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'"; |
2320 | $query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'"; |
2313 | $rq =& $this->db->query($query); |
2321 | $rq =& $this->db->query($query); |
2314 | for($i=0;$i<count($sections);$i++) { |
2322 | for($i=0;$i<count($sections);$i++) { |
2315 | $query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$sRepID."', sect_id='".$sections[$i]."'"; |
2323 | $query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$sRepID."', sect_id='".$sections[$i]."'"; |
2316 | $rq =& $this->db->query($query); |
2324 | $rq =& $this->db->query($query); |
2317 | }
|
2325 | }
|
2318 | 2326 | ||
2319 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'"; |
2327 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'"; |
2320 | $rq =& $this->db->query($query); |
2328 | $rq =& $this->db->query($query); |
2321 | for($i=0;$i<count($arch);$i++) { |
2329 | for($i=0;$i<count($arch);$i++) { |
2322 | $query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$sRepID."', arch_id='".$arch[$i]."'"; |
2330 | $query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$sRepID."', arch_id='".$arch[$i]."'"; |
2323 | $rq =& $this->db->query($query); |
2331 | $rq =& $this->db->query($query); |
2324 | }
|
2332 | }
|
2325 | 2333 | ||
2326 | if (PEAR::isError($this->db)) { |
2334 | if (PEAR::isError($this->db)) { |
2327 | $result["ERR"] = 1; |
2335 | $result["ERR"] = 1; |
2328 | $result["ERRINFO"] = $this->db->getMessage(); |
2336 | $result["ERRINFO"] = $this->db->getMessage(); |
2329 | } else { |
2337 | } else { |
2330 | $result["ERR"] = 0; |
2338 | $result["ERR"] = 0; |
2331 | }
|
2339 | }
|
2332 | 2340 | ||
2333 | return $result; |
2341 | return $result; |
2334 | }
|
2342 | }
|
2335 | 2343 | ||
2336 | /**
|
2344 | /**
|
2337 | * Удаление информации о репозитории
|
2345 | * Удаление информации о репозитории
|
2338 | *
|
2346 | *
|
2339 | * @author Alexander Wolf
|
2347 | * @author Alexander Wolf
|
2340 | * @category Core
|
2348 | * @category Core
|
2341 | *
|
2349 | *
|
2342 | * @param integer $repID
|
2350 | * @param integer $repID
|
2343 | * @return array
|
2351 | * @return array
|
2344 | */
|
2352 | */
|
2345 | public function dropRepository($repID) { |
2353 | public function dropRepository($repID) { |
2346 | $result = array(); |
2354 | $result = array(); |
2347 | $sRepID = $this->secure->checkInt($repID); |
2355 | $sRepID = $this->secure->checkInt($repID); |
2348 | 2356 | ||
2349 | // Удаление репозитория
|
2357 | // Удаление репозитория
|
2350 | $query = "DELETE FROM ".$this->prefix."repository WHERE rep_id='".$sRepID."'"; |
2358 | $query = "DELETE FROM ".$this->prefix."repository WHERE rep_id='".$sRepID."'"; |
2351 | $rq =& $this->db->query($query); |
2359 | $rq =& $this->db->query($query); |
2352 | if (PEAR::isError($this->db)) { |
2360 | if (PEAR::isError($this->db)) { |
2353 | $result["ERR"] = 1; |
2361 | $result["ERR"] = 1; |
2354 | $result["ERRINFO"] = $this->db->getMessage(); |
2362 | $result["ERRINFO"] = $this->db->getMessage(); |
2355 | } else { |
2363 | } else { |
2356 | $result["ERR"] = 0; |
2364 | $result["ERR"] = 0; |
2357 | }
|
2365 | }
|
2358 | 2366 | ||
2359 | // Удаление секций репозитория
|
2367 | // Удаление секций репозитория
|
2360 | $query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'"; |
2368 | $query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'"; |
2361 | $rq =& $this->db->query($query); |
2369 | $rq =& $this->db->query($query); |
2362 | if (PEAR::isError($this->db)) { |
2370 | if (PEAR::isError($this->db)) { |
2363 | $result["ERR"] = 1; |
2371 | $result["ERR"] = 1; |
2364 | $result["ERRINFO"] = $this->db->getMessage(); |
2372 | $result["ERRINFO"] = $this->db->getMessage(); |
2365 | } else { |
2373 | } else { |
2366 | $result["ERR"] = 0; |
2374 | $result["ERR"] = 0; |
2367 | }
|
2375 | }
|
2368 | 2376 | ||
2369 | // Удаление архитектур репозитория
|
2377 | // Удаление архитектур репозитория
|
2370 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'"; |
2378 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'"; |
2371 | $rq =& $this->db->query($query); |
2379 | $rq =& $this->db->query($query); |
2372 | if (PEAR::isError($this->db)) { |
2380 | if (PEAR::isError($this->db)) { |
2373 | $result["ERR"] = 1; |
2381 | $result["ERR"] = 1; |
2374 | $result["ERRINFO"] = $this->db->getMessage(); |
2382 | $result["ERRINFO"] = $this->db->getMessage(); |
2375 | } else { |
2383 | } else { |
2376 | $result["ERR"] = 0; |
2384 | $result["ERR"] = 0; |
2377 | }
|
2385 | }
|
2378 | 2386 | ||
2379 | return $result; |
2387 | return $result; |
2380 | }
|
2388 | }
|
2381 | 2389 | ||
2382 | }
|
2390 | }
|
2383 | 2391 | ||
2384 | ?>
|
2392 | ?>
|