Редакция 676 | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 676 | Редакция 677 | ||
---|---|---|---|
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 | if ($rq->numRows()>0) { |
627 | $rq->fetchInto($base); |
627 | $rq->fetchInto($base); |
628 | // Формируем type proto://host/folder
|
628 | // Формируем type proto://host/folder
|
629 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
629 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
630 | if ($base["repkey"]!="") { |
630 | if ($base["repkey"]!="") { |
631 | $show .= "# Установка ключа: ".$this->secure->checkStr($base["repkey"],1)."\n"; |
631 | $show .= "# Установка ключа: ".$this->secure->checkStr($base["repkey"],1)."\n"; |
632 | }
|
632 | }
|
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 | $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); |
634 | $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)); |
635 | // Формируем distname
|
635 | // Формируем distname
|
636 | $show .= " ".$dvname." "; |
636 | $show .= " ".$dvname." "; |
637 | // Формируем sections
|
637 | // Формируем sections
|
638 | $query = "SELECT * FROM ".$this->prefix."section s "; |
638 | $query = "SELECT * FROM ".$this->prefix."section s "; |
639 | $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 "; |
640 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
640 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
641 | for($i=0;$i<count($data["section"]);$i++) { |
641 | for($i=0;$i<count($data["section"]);$i++) { |
642 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
642 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
643 | if ($i<count($data["section"])-1) { |
643 | if ($i<count($data["section"])-1) { |
644 | $query .= " OR "; |
644 | $query .= " OR "; |
645 | }
|
645 | }
|
646 | }
|
646 | }
|
647 | $query .= ")"; |
647 | $query .= ")"; |
648 | $rq =& $this->db->query($query); |
648 | $rq =& $this->db->query($query); |
649 | while ($rq->fetchInto($sections)) { |
649 | while ($rq->fetchInto($sections)) { |
650 | $show .= $sections["secname"]." "; |
650 | $show .= $sections["secname"]." "; |
651 | }
|
651 | }
|
652 | $show .= "\n\n"; |
652 | $show .= "\n\n"; |
653 | }
|
653 | }
|
654 | 654 | ||
655 | if (count($data["repository"])>0) { |
655 | if (count($data["repository"])>0) { |
656 | // Репозитории обновлений и третьих лиц
|
656 | // Репозитории обновлений и третьих лиц
|
657 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
657 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
658 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
658 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
659 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
659 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
660 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
660 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
661 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
661 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
662 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
662 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
663 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
663 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
664 | $query .= "WHERE r.rtype_id>'1' AND ("; |
664 | $query .= "WHERE r.rtype_id>'1' AND ("; |
665 | for($i=0;$i<count($data["repository"]);$i++) { |
665 | for($i=0;$i<count($data["repository"]);$i++) { |
666 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
666 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
667 | if ($i<count($data["repository"])-1) { |
667 | if ($i<count($data["repository"])-1) { |
668 | $query .= " OR "; |
668 | $query .= " OR "; |
669 | }
|
669 | }
|
670 | }
|
670 | }
|
671 | $query .= ") ORDER BY r.rtype_id ASC"; |
671 | $query .= ") ORDER BY r.rtype_id ASC"; |
672 | $req =& $this->db->query($query); |
672 | $req =& $this->db->query($query); |
673 | 673 | ||
674 | while ($req->fetchInto($updates)) { |
674 | while ($req->fetchInto($updates)) { |
675 | // Формируем type proto://host/folder
|
675 | // Формируем type proto://host/folder
|
676 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
676 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
677 | if ($updates["repkey"]!="") { |
677 | if ($updates["repkey"]!="") { |
678 | $show .= "# Установка ключа: ".$this->secure->checkStr($updates["repkey"],1)."\n"; |
678 | $show .= "# Установка ключа: ".$this->secure->checkStr($updates["repkey"],1)."\n"; |
679 | }
|
679 | }
|
680 | $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); |
680 | $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); |
681 | $dvname = str_replace("{DIST}",$this->secure->checkStr($dist["vcodename"],1),$this->secure->checkStr($updates["scheme"],1)); |
681 | $dvname = str_replace("{DIST}",$this->secure->checkStr($dist["vcodename"],1),$this->secure->checkStr($updates["scheme"],1)); |
682 | // Формируем distname
|
682 | // Формируем distname
|
683 | $show .= " ".$dvname." "; |
683 | $show .= " ".$dvname." "; |
684 | // Формируем sections
|
684 | // Формируем sections
|
685 | $query = "SELECT * FROM ".$this->prefix."section s "; |
685 | $query = "SELECT * FROM ".$this->prefix."section s "; |
686 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
686 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
687 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
687 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
688 | $rq =& $this->db->query($query); |
688 | $rq =& $this->db->query($query); |
689 | while ($rq->fetchInto($sections)) { |
689 | while ($rq->fetchInto($sections)) { |
690 | $show .= $sections["secname"]." "; |
690 | $show .= $sections["secname"]." "; |
691 | }
|
691 | }
|
692 | $show .= "\n\n"; |
692 | $show .= "\n\n"; |
693 | }
|
693 | }
|
694 | $show .= "\n"; |
694 | $show .= "\n"; |
695 | }
|
695 | }
|
696 | } else { |
696 | } else { |
697 | // Базовый репозиторий
|
697 | // Базовый репозиторий
|
698 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
698 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
699 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
699 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
700 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
700 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
701 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
701 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
702 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
702 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
703 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
703 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
704 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
704 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
705 | $query .= "WHERE v.version_id='".$data["version_id"]."' AND r.rtype_id='1'"; |
705 | $query .= "WHERE v.version_id='".$data["version_id"]."' AND r.rtype_id='1'"; |
706 | $rq =& $this->db->query($query); |
706 | $rq =& $this->db->query($query); |
707 | if ($rq->numRows()>0) { |
707 | if ($rq->numRows()>0) { |
708 | $rq->fetchInto($base); |
708 | $rq->fetchInto($base); |
709 | // Формируем type proto://host/folder
|
709 | // Формируем type proto://host/folder
|
710 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
710 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
711 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
711 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
712 | if ($base["sign_id"]!=0) { |
712 | if ($base["sign_id"]!=0) { |
713 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
713 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
714 | $rq =& $this->db->query($query); |
714 | $rq =& $this->db->query($query); |
715 | $rq->fetchInto($sign); |
715 | $rq->fetchInto($sign); |
716 | $show .= "[".$this->secure->checkStr($sign["sname"],1)."] "; |
716 | $show .= "[".$this->secure->checkStr($sign["sname"],1)."] "; |
717 | }
|
717 | }
|
718 | $show .= $this->secure->checkStr($base["proto"],1).$this->secure->checkStr($base["rhost"],1).$this->secure->checkStr($base["rfolder"],1)." "; |
718 | $show .= $this->secure->checkStr($base["proto"],1).$this->secure->checkStr($base["rhost"],1).$this->secure->checkStr($base["rfolder"],1)." "; |
719 | $show .= $this->secure->checkStr($base["scheme"],1)." "; |
719 | $show .= $this->secure->checkStr($base["scheme"],1)." "; |
720 | 720 | ||
721 | // Формируем sections
|
721 | // Формируем sections
|
722 | $query = "SELECT * FROM ".$this->prefix."section s "; |
722 | $query = "SELECT * FROM ".$this->prefix."section s "; |
723 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
723 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
724 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
724 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
725 | for($i=0;$i<count($data["section"]);$i++) { |
725 | for($i=0;$i<count($data["section"]);$i++) { |
726 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
726 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
727 | if ($i<count($data["section"])-1) { |
727 | if ($i<count($data["section"])-1) { |
728 | $query .= " OR "; |
728 | $query .= " OR "; |
729 | }
|
729 | }
|
730 | }
|
730 | }
|
731 | $query .= ")"; |
731 | $query .= ")"; |
732 | $rq =& $this->db->query($query); |
732 | $rq =& $this->db->query($query); |
733 | while ($rq->fetchInto($sections)) { |
733 | while ($rq->fetchInto($sections)) { |
734 | $show .= $sections["secname"]." "; |
734 | $show .= $sections["secname"]." "; |
735 | }
|
735 | }
|
736 | $show .= "\n\n"; |
736 | $show .= "\n\n"; |
737 | }
|
737 | }
|
738 | 738 | ||
- | 739 | if (count($data["repository"])>0) { |
|
739 | // Репозитории обновлений и третьих лиц
|
740 | // Репозитории обновлений и третьих лиц
|
740 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
741 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
741 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
742 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
742 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
743 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
743 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
744 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
744 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
745 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
745 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
746 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
746 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
747 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
747 | $query .= "WHERE r.rtype_id>'1' AND ("; |
748 | $query .= "WHERE r.rtype_id>'1' AND ("; |
748 | for($i=0;$i<count($data["repository"]);$i++) { |
749 | for($i=0;$i<count($data["repository"]);$i++) { |
749 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
750 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
750 | if ($i<count($data["repository"])-1) { |
751 | if ($i<count($data["repository"])-1) { |
751 | $query .= " OR "; |
752 | $query .= " OR "; |
- | 753 | }
|
|
752 | }
|
754 | }
|
753 | }
|
- | |
754 | $query .= ") ORDER BY r.rtype_id ASC"; |
755 | $query .= ") ORDER BY r.rtype_id ASC"; |
755 | $req =& $this->db->query($query); |
756 | $req =& $this->db->query($query); |
756 | if ($req->numRows()>0) { |
- | |
- | 757 | ||
757 | while ($req->fetchInto($updates)) { |
758 | while ($req->fetchInto($updates)) { |
758 | // Формируем type proto://host/folder
|
759 | // Формируем type proto://host/folder
|
759 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
760 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
760 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
761 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
761 | if ($updates["sign_id"]!=0) { |
762 | if ($updates["sign_id"]!=0) { |
762 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
763 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
763 | $rqs =& $this->db->query($query); |
764 | $rqs =& $this->db->query($query); |
764 | $rqs->fetchInto($sign); |
765 | $rqs->fetchInto($sign); |
765 | $show .= "[".$this->secure->checkStr($sign["sname"],1)."] "; |
766 | $show .= "[".$this->secure->checkStr($sign["sname"],1)."] "; |
766 | }
|
767 | }
|
767 | $show .= $this->secure->checkStr($updates["proto"],1).$this->secure->checkStr($updates["rhost"],1).$this->secure->checkStr($updates["rfolder"],1)." "; |
768 | $show .= $this->secure->checkStr($updates["proto"],1).$this->secure->checkStr($updates["rhost"],1).$this->secure->checkStr($updates["rfolder"],1)." "; |
768 | $show .= $this->secure->checkStr($updates["scheme"],1)." "; |
769 | $show .= $this->secure->checkStr($updates["scheme"],1)." "; |
769 | // Формируем sections
|
770 | // Формируем sections
|
770 | $query = "SELECT * FROM ".$this->prefix."section s "; |
771 | $query = "SELECT * FROM ".$this->prefix."section s "; |
771 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
772 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
772 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
773 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
773 | $rq =& $this->db->query($query); |
774 | $rq =& $this->db->query($query); |
774 | while ($rq->fetchInto($sections)) { |
775 | while ($rq->fetchInto($sections)) { |
775 | $show .= $sections["secname"]." "; |
776 | $show .= $sections["secname"]." "; |
776 | }
|
777 | }
|
777 | $show .= "\n\n"; |
778 | $show .= "\n\n"; |
778 | }
|
779 | }
|
779 | $show .= "\n"; |
780 | $show .= "\n"; |
780 | }
|
781 | }
|
781 | }
|
782 | }
|
782 | 783 | ||
783 | $HTTPHeader1 = "Content-length: ".strlen($show); |
784 | $HTTPHeader1 = "Content-length: ".strlen($show); |
784 | $HTTPHeader2 = "Content-disposition: attachment; filename=sources.list\n\n"; |
785 | $HTTPHeader2 = "Content-disposition: attachment; filename=sources.list\n\n"; |
785 | 786 | ||
786 | header($HTTPHeader1); |
787 | header($HTTPHeader1); |
787 | header($HTTPHeader2); |
788 | header($HTTPHeader2); |
788 | return $show; |
789 | return $show; |
789 | }
|
790 | }
|
790 | 791 | ||
791 | /**
|
792 | /**
|
792 | * Показывает список секций
|
793 | * Показывает список секций
|
793 | *
|
794 | *
|
794 | * @author Alexander Wolf
|
795 | * @author Alexander Wolf
|
795 | * @category Core
|
796 | * @category Core
|
796 | *
|
797 | *
|
797 | * @param string $name
|
798 | * @param string $name
|
798 | * @param string $actor
|
799 | * @param string $actor
|
799 | * @param string $format
|
800 | * @param string $format
|
800 | * @return string
|
801 | * @return string
|
801 | */
|
802 | */
|
802 | public function showSectionsList($name, $actor, $format = 'html') { |
803 | public function showSectionsList($name, $actor, $format = 'html') { |
803 | switch($format) { |
804 | switch($format) { |
804 | case 'html': |
805 | case 'html': |
805 | $query = "SELECT * FROM ".$this->prefix."section"; |
806 | $query = "SELECT * FROM ".$this->prefix."section"; |
806 | $rq =& $this->db->query($query); |
807 | $rq =& $this->db->query($query); |
807 | $show = "<ul>\n"; |
808 | $show = "<ul>\n"; |
808 | while ($rq->fetchInto($element)) { |
809 | while ($rq->fetchInto($element)) { |
809 | $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"; |
810 | $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"; |
810 | }
|
811 | }
|
811 | $show .= "</ul>"; |
812 | $show .= "</ul>"; |
812 | break; |
813 | break; |
813 | case 'innerhtml': |
814 | case 'innerhtml': |
814 | $show = ""; |
815 | $show = ""; |
815 | $repID = $this->secure->checkInt($actor); |
816 | $repID = $this->secure->checkInt($actor); |
816 | if ($repID==0) { |
817 | if ($repID==0) { |
817 | $query = "SELECT * FROM ".$this->prefix."section"; |
818 | $query = "SELECT * FROM ".$this->prefix."section"; |
818 | $rq =& $this->db->query($query); |
819 | $rq =& $this->db->query($query); |
819 | while ($rq->fetchInto($element)) { |
820 | while ($rq->fetchInto($element)) { |
820 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." "; |
821 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." "; |
821 | }
|
822 | }
|
822 | } else { |
823 | } else { |
823 | $query = "SELECT * FROM ".$this->prefix."section s JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$repID'"; |
824 | $query = "SELECT * FROM ".$this->prefix."section s JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$repID'"; |
824 | $rq =& $this->db->query($query); |
825 | $rq =& $this->db->query($query); |
825 | while ($rq->fetchInto($element)) { |
826 | while ($rq->fetchInto($element)) { |
826 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."' checked> ".$this->secure->checkStr($element["secname"],1)." "; |
827 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."' checked> ".$this->secure->checkStr($element["secname"],1)." "; |
827 | }
|
828 | }
|
828 | $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')"; |
829 | $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')"; |
829 | $rq =& $this->db->query($query); |
830 | $rq =& $this->db->query($query); |
830 | while ($rq->fetchInto($element)) { |
831 | while ($rq->fetchInto($element)) { |
831 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." "; |
832 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." "; |
832 | }
|
833 | }
|
833 | }
|
834 | }
|
834 | 835 | ||
835 | break; |
836 | break; |
836 | }
|
837 | }
|
837 | 838 | ||
838 | return $show; |
839 | return $show; |
839 | }
|
840 | }
|
840 | 841 | ||
841 | /**
|
842 | /**
|
842 | * Вывод формы редактирования/добавления секций
|
843 | * Вывод формы редактирования/добавления секций
|
843 | *
|
844 | *
|
844 | * @author Alexander Wolf
|
845 | * @author Alexander Wolf
|
845 | * @category Core
|
846 | * @category Core
|
846 | *
|
847 | *
|
847 | * @param integer $sectionID
|
848 | * @param integer $sectionID
|
848 | * @param string $info
|
849 | * @param string $info
|
849 | * @return string
|
850 | * @return string
|
850 | */
|
851 | */
|
851 | public function showSectionsForm($sectionID = 0, $info = "") { |
852 | public function showSectionsForm($sectionID = 0, $info = "") { |
852 | $sSectID = $this->secure->checkInt($sectionID); |
853 | $sSectID = $this->secure->checkInt($sectionID); |
853 | $sInfo = $this->secure->checkStr($info, 1); |
854 | $sInfo = $this->secure->checkStr($info, 1); |
854 | if ($sInfo == "") { |
855 | if ($sInfo == "") { |
855 | $sInfo = "Секция"; |
856 | $sInfo = "Секция"; |
856 | }
|
857 | }
|
857 | if ($sSectID != 0) { |
858 | if ($sSectID != 0) { |
858 | // Режим редактирования
|
859 | // Режим редактирования
|
859 | $query = "SELECT * FROM ".$this->prefix."section WHERE sect_id='".$sSectID."'"; |
860 | $query = "SELECT * FROM ".$this->prefix."section WHERE sect_id='".$sSectID."'"; |
860 | $rq =& $this->db->query($query); |
861 | $rq =& $this->db->query($query); |
861 | $rq->fetchInto($element); |
862 | $rq->fetchInto($element); |
862 | }
|
863 | }
|
863 | 864 | ||
864 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
865 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
865 | $show .= "<div class='inputbox'><label for='sname'>Название секции:</label> <input type='text' name='sname' id='sname' value='".$this->secure->checkStr($element["secname"],1)."'></div>\n"; |
866 | $show .= "<div class='inputbox'><label for='sname'>Название секции:</label> <input type='text' name='sname' id='sname' value='".$this->secure->checkStr($element["secname"],1)."'></div>\n"; |
866 | $show .= "<div class='inputbox'><label for='sinfo'>Описание секции:</label> <input type='text' name='sinfo' id='sinfo' value='".$this->secure->checkStr($element["sectinfo"],1)."'></div>\n"; |
867 | $show .= "<div class='inputbox'><label for='sinfo'>Описание секции:</label> <input type='text' name='sinfo' id='sinfo' value='".$this->secure->checkStr($element["sectinfo"],1)."'></div>\n"; |
867 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
868 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
868 | 869 | ||
869 | return $show; |
870 | return $show; |
870 | }
|
871 | }
|
871 | 872 | ||
872 | /**
|
873 | /**
|
873 | * Обновление информации о секции
|
874 | * Обновление информации о секции
|
874 | *
|
875 | *
|
875 | * @author Alexander Wolf
|
876 | * @author Alexander Wolf
|
876 | * @category Core
|
877 | * @category Core
|
877 | *
|
878 | *
|
878 | * @param integer $sectionID
|
879 | * @param integer $sectionID
|
879 | * @param string $sname
|
880 | * @param string $sname
|
880 | * @param string $sinfo
|
881 | * @param string $sinfo
|
881 | * @return array
|
882 | * @return array
|
882 | */
|
883 | */
|
883 | public function updateSection($sectionID, $sname, $sinfo = "") { |
884 | public function updateSection($sectionID, $sname, $sinfo = "") { |
884 | $result = array(); |
885 | $result = array(); |
885 | $sSectID = $this->secure->checkInt($sectionID); |
886 | $sSectID = $this->secure->checkInt($sectionID); |
886 | $sSName = $this->secure->checkStr($sname); |
887 | $sSName = $this->secure->checkStr($sname); |
887 | $sSInfo = $this->secure->checkStr($sinfo); |
888 | $sSInfo = $this->secure->checkStr($sinfo); |
888 | 889 | ||
889 | $query = "UPDATE ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."' WHERE sect_id='".$sSectID."'"; |
890 | $query = "UPDATE ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."' WHERE sect_id='".$sSectID."'"; |
890 | $rq =& $this->db->query($query); |
891 | $rq =& $this->db->query($query); |
891 | if (PEAR::isError($this->db)) { |
892 | if (PEAR::isError($this->db)) { |
892 | $result["ERR"] = 1; |
893 | $result["ERR"] = 1; |
893 | $result["ERRINFO"] = $this->db->getMessage(); |
894 | $result["ERRINFO"] = $this->db->getMessage(); |
894 | } else { |
895 | } else { |
895 | $result["ERR"] = 0; |
896 | $result["ERR"] = 0; |
896 | }
|
897 | }
|
897 | 898 | ||
898 | return $result; |
899 | return $result; |
899 | }
|
900 | }
|
900 | 901 | ||
901 | /**
|
902 | /**
|
902 | * Удаление информации о секции
|
903 | * Удаление информации о секции
|
903 | *
|
904 | *
|
904 | * @author Alexander Wolf
|
905 | * @author Alexander Wolf
|
905 | * @category Core
|
906 | * @category Core
|
906 | *
|
907 | *
|
907 | * @param integer $sectionID
|
908 | * @param integer $sectionID
|
908 | * @return array
|
909 | * @return array
|
909 | */
|
910 | */
|
910 | public function dropSection($sectionID) { |
911 | public function dropSection($sectionID) { |
911 | $result = array(); |
912 | $result = array(); |
912 | $sSectID = $this->secure->checkInt($sectionID); |
913 | $sSectID = $this->secure->checkInt($sectionID); |
913 | 914 | ||
914 | // Удаление секции
|
915 | // Удаление секции
|
915 | $query = "DELETE FROM ".$this->prefix."section WHERE sect_id='".$sSectID."'"; |
916 | $query = "DELETE FROM ".$this->prefix."section WHERE sect_id='".$sSectID."'"; |
916 | $rq =& $this->db->query($query); |
917 | $rq =& $this->db->query($query); |
917 | if (PEAR::isError($this->db)) { |
918 | if (PEAR::isError($this->db)) { |
918 | $result["ERR"] = 1; |
919 | $result["ERR"] = 1; |
919 | $result["ERRINFO"] = $this->db->getMessage(); |
920 | $result["ERRINFO"] = $this->db->getMessage(); |
920 | } else { |
921 | } else { |
921 | $result["ERR"] = 0; |
922 | $result["ERR"] = 0; |
922 | }
|
923 | }
|
923 | 924 | ||
924 | return $result; |
925 | return $result; |
925 | }
|
926 | }
|
926 | 927 | ||
927 | /**
|
928 | /**
|
928 | * Добавление новой секции
|
929 | * Добавление новой секции
|
929 | *
|
930 | *
|
930 | * @author Alexander Wolf
|
931 | * @author Alexander Wolf
|
931 | * @category Core
|
932 | * @category Core
|
932 | *
|
933 | *
|
933 | * @param string $sname
|
934 | * @param string $sname
|
934 | * @param string $sinfo
|
935 | * @param string $sinfo
|
935 | * @return array
|
936 | * @return array
|
936 | */
|
937 | */
|
937 | public function addSection($sname, $sinfo = "") { |
938 | public function addSection($sname, $sinfo = "") { |
938 | $result = array(); |
939 | $result = array(); |
939 | $sSName = $this->secure->checkStr($sname); |
940 | $sSName = $this->secure->checkStr($sname); |
940 | $sSInfo = $this->secure->checkStr($sinfo); |
941 | $sSInfo = $this->secure->checkStr($sinfo); |
941 | 942 | ||
942 | $query = "INSERT INTO ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."'"; |
943 | $query = "INSERT INTO ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."'"; |
943 | $rq =& $this->db->query($query); |
944 | $rq =& $this->db->query($query); |
944 | if (PEAR::isError($this->db)) { |
945 | if (PEAR::isError($this->db)) { |
945 | $result["ERR"] = 1; |
946 | $result["ERR"] = 1; |
946 | $result["ERRINFO"] = $this->db->getMessage(); |
947 | $result["ERRINFO"] = $this->db->getMessage(); |
947 | } else { |
948 | } else { |
948 | $result["ERR"] = 0; |
949 | $result["ERR"] = 0; |
949 | }
|
950 | }
|
950 | 951 | ||
951 | return $result; |
952 | return $result; |
952 | }
|
953 | }
|
953 | 954 | ||
954 | /**
|
955 | /**
|
955 | * Вывод списка поддерживаемых архитектур
|
956 | * Вывод списка поддерживаемых архитектур
|
956 | *
|
957 | *
|
957 | * @author Alexander Wolf
|
958 | * @author Alexander Wolf
|
958 | * @category Core
|
959 | * @category Core
|
959 | *
|
960 | *
|
960 | * @param string $name
|
961 | * @param string $name
|
961 | * @param string $actor
|
962 | * @param string $actor
|
962 | * @param string $format
|
963 | * @param string $format
|
963 | * @return string
|
964 | * @return string
|
964 | */
|
965 | */
|
965 | public function showArchList($name, $actor, $format = 'list') { |
966 | public function showArchList($name, $actor, $format = 'list') { |
966 | switch($format) { |
967 | switch($format) { |
967 | case 'list': |
968 | case 'list': |
968 | $query = "SELECT * FROM ".$this->prefix."arch"; |
969 | $query = "SELECT * FROM ".$this->prefix."arch"; |
969 | $rq =& $this->db->query($query); |
970 | $rq =& $this->db->query($query); |
970 | $show = "<ul>\n"; |
971 | $show = "<ul>\n"; |
971 | while ($rq->fetchInto($element)) { |
972 | while ($rq->fetchInto($element)) { |
972 | $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"; |
973 | $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"; |
973 | }
|
974 | }
|
974 | $show .= "</ul>"; |
975 | $show .= "</ul>"; |
975 | break; |
976 | break; |
976 | case 'innerhtml': |
977 | case 'innerhtml': |
977 | $show = ""; |
978 | $show = ""; |
978 | $repID = $this->secure->checkInt($actor); |
979 | $repID = $this->secure->checkInt($actor); |
979 | if ($repID==0) { |
980 | if ($repID==0) { |
980 | $query = "SELECT * FROM ".$this->prefix."arch"; |
981 | $query = "SELECT * FROM ".$this->prefix."arch"; |
981 | $rq =& $this->db->query($query); |
982 | $rq =& $this->db->query($query); |
982 | while ($rq->fetchInto($element)) { |
983 | while ($rq->fetchInto($element)) { |
983 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."'> ".$this->secure->checkStr($element["arch"],1)." "; |
984 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."'> ".$this->secure->checkStr($element["arch"],1)." "; |
984 | }
|
985 | }
|
985 | } else { |
986 | } else { |
986 | $query = "SELECT * FROM ".$this->prefix."arch a JOIN ".$this->prefix."arch2rep r ON a.arch_id=r.arch_id WHERE r.rep_id='$repID'"; |
987 | $query = "SELECT * FROM ".$this->prefix."arch a JOIN ".$this->prefix."arch2rep r ON a.arch_id=r.arch_id WHERE r.rep_id='$repID'"; |
987 | $rq =& $this->db->query($query); |
988 | $rq =& $this->db->query($query); |
988 | while ($rq->fetchInto($element)) { |
989 | while ($rq->fetchInto($element)) { |
989 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."' checked> ".$this->secure->checkStr($element["arch"],1)." "; |
990 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."' checked> ".$this->secure->checkStr($element["arch"],1)." "; |
990 | }
|
991 | }
|
991 | $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')"; |
992 | $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')"; |
992 | $rq =& $this->db->query($query); |
993 | $rq =& $this->db->query($query); |
993 | if ($rq->numRows()>0) { |
994 | if ($rq->numRows()>0) { |
994 | while ($rq->fetchInto($element)) { |
995 | while ($rq->fetchInto($element)) { |
995 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."'> ".$this->secure->checkStr($element["arch"],1)." "; |
996 | $show .= "<input type='checkbox' name='".$name."[]' value='".$element["arch_id"]."'> ".$this->secure->checkStr($element["arch"],1)." "; |
996 | }
|
997 | }
|
997 | }
|
998 | }
|
998 | }
|
999 | }
|
999 | break; |
1000 | break; |
1000 | }
|
1001 | }
|
1001 | return $show; |
1002 | return $show; |
1002 | }
|
1003 | }
|
1003 | 1004 | ||
1004 | /**
|
1005 | /**
|
1005 | * Добавление новой архитектуры
|
1006 | * Добавление новой архитектуры
|
1006 | *
|
1007 | *
|
1007 | * @author Alexander Wolf
|
1008 | * @author Alexander Wolf
|
1008 | * @category Core
|
1009 | * @category Core
|
1009 | *
|
1010 | *
|
1010 | * @param string $arch
|
1011 | * @param string $arch
|
1011 | * @return array
|
1012 | * @return array
|
1012 | */
|
1013 | */
|
1013 | public function addArch($arch) { |
1014 | public function addArch($arch) { |
1014 | $result = array(); |
1015 | $result = array(); |
1015 | $sArch = $this->secure->checkStr($arch); |
1016 | $sArch = $this->secure->checkStr($arch); |
1016 | 1017 | ||
1017 | $query = "INSERT INTO ".$this->prefix."arch SET arch='".$sArch."'"; |
1018 | $query = "INSERT INTO ".$this->prefix."arch SET arch='".$sArch."'"; |
1018 | $rq =& $this->db->query($query); |
1019 | $rq =& $this->db->query($query); |
1019 | if (PEAR::isError($this->db)) { |
1020 | if (PEAR::isError($this->db)) { |
1020 | $result["ERR"] = 1; |
1021 | $result["ERR"] = 1; |
1021 | $result["ERRINFO"] = $this->db->getMessage(); |
1022 | $result["ERRINFO"] = $this->db->getMessage(); |
1022 | } else { |
1023 | } else { |
1023 | $result["ERR"] = 0; |
1024 | $result["ERR"] = 0; |
1024 | }
|
1025 | }
|
1025 | 1026 | ||
1026 | return $result; |
1027 | return $result; |
1027 | }
|
1028 | }
|
1028 | 1029 | ||
1029 | /**
|
1030 | /**
|
1030 | * Удаление информации об архитектуре
|
1031 | * Удаление информации об архитектуре
|
1031 | *
|
1032 | *
|
1032 | * @author Alexander Wolf
|
1033 | * @author Alexander Wolf
|
1033 | * @category Core
|
1034 | * @category Core
|
1034 | *
|
1035 | *
|
1035 | * @param integer $archID
|
1036 | * @param integer $archID
|
1036 | * @return array
|
1037 | * @return array
|
1037 | */
|
1038 | */
|
1038 | public function dropArch($archID) { |
1039 | public function dropArch($archID) { |
1039 | $result = array(); |
1040 | $result = array(); |
1040 | $sArchID = $this->secure->checkInt($archID); |
1041 | $sArchID = $this->secure->checkInt($archID); |
1041 | 1042 | ||
1042 | // Удаление архитектуры
|
1043 | // Удаление архитектуры
|
1043 | $query = "DELETE FROM ".$this->prefix."arch WHERE arch_id='".$sArchID."'"; |
1044 | $query = "DELETE FROM ".$this->prefix."arch WHERE arch_id='".$sArchID."'"; |
1044 | $rq =& $this->db->query($query); |
1045 | $rq =& $this->db->query($query); |
1045 | if (PEAR::isError($this->db)) { |
1046 | if (PEAR::isError($this->db)) { |
1046 | $result["ERR"] = 1; |
1047 | $result["ERR"] = 1; |
1047 | $result["ERRINFO"] = $this->db->getMessage(); |
1048 | $result["ERRINFO"] = $this->db->getMessage(); |
1048 | } else { |
1049 | } else { |
1049 | $result["ERR"] = 0; |
1050 | $result["ERR"] = 0; |
1050 | }
|
1051 | }
|
1051 | 1052 | ||
1052 | // Удаление архитектуры из списка репозиториев
|
1053 | // Удаление архитектуры из списка репозиториев
|
1053 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE arch_id='".$sArchID."'"; |
1054 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE arch_id='".$sArchID."'"; |
1054 | $rq =& $this->db->query($query); |
1055 | $rq =& $this->db->query($query); |
1055 | if (PEAR::isError($this->db)) { |
1056 | if (PEAR::isError($this->db)) { |
1056 | $result["ERR"] = 1; |
1057 | $result["ERR"] = 1; |
1057 | $result["ERRINFO"] = $this->db->getMessage(); |
1058 | $result["ERRINFO"] = $this->db->getMessage(); |
1058 | } else { |
1059 | } else { |
1059 | $result["ERR"] = 0; |
1060 | $result["ERR"] = 0; |
1060 | }
|
1061 | }
|
1061 | return $result; |
1062 | return $result; |
1062 | }
|
1063 | }
|
1063 | 1064 | ||
1064 | /**
|
1065 | /**
|
1065 | * Обновление информации об архитектуре
|
1066 | * Обновление информации об архитектуре
|
1066 | *
|
1067 | *
|
1067 | * @author Alexander Wolf
|
1068 | * @author Alexander Wolf
|
1068 | * @category Core
|
1069 | * @category Core
|
1069 | *
|
1070 | *
|
1070 | * @param integer $archID
|
1071 | * @param integer $archID
|
1071 | * @param string $arch
|
1072 | * @param string $arch
|
1072 | * @return array
|
1073 | * @return array
|
1073 | */
|
1074 | */
|
1074 | public function updateArch($archID, $arch) { |
1075 | public function updateArch($archID, $arch) { |
1075 | $result = array(); |
1076 | $result = array(); |
1076 | $sArchID = $this->secure->checkInt($archID); |
1077 | $sArchID = $this->secure->checkInt($archID); |
1077 | $sArch = $this->secure->checkStr($arch); |
1078 | $sArch = $this->secure->checkStr($arch); |
1078 | 1079 | ||
1079 | $query = "UPDATE ".$this->prefix."arch SET arch='".$sArch."' WHERE arch_id='".$sArchID."'"; |
1080 | $query = "UPDATE ".$this->prefix."arch SET arch='".$sArch."' WHERE arch_id='".$sArchID."'"; |
1080 | $rq =& $this->db->query($query); |
1081 | $rq =& $this->db->query($query); |
1081 | if (PEAR::isError($this->db)) { |
1082 | if (PEAR::isError($this->db)) { |
1082 | $result["ERR"] = 1; |
1083 | $result["ERR"] = 1; |
1083 | $result["ERRINFO"] = $this->db->getMessage(); |
1084 | $result["ERRINFO"] = $this->db->getMessage(); |
1084 | } else { |
1085 | } else { |
1085 | $result["ERR"] = 0; |
1086 | $result["ERR"] = 0; |
1086 | }
|
1087 | }
|
1087 | 1088 | ||
1088 | return $result; |
1089 | return $result; |
1089 | }
|
1090 | }
|
1090 | 1091 | ||
1091 | /**
|
1092 | /**
|
1092 | * Вывод формы редактирования/добавления архитектур
|
1093 | * Вывод формы редактирования/добавления архитектур
|
1093 | *
|
1094 | *
|
1094 | * @author Alexander Wolf
|
1095 | * @author Alexander Wolf
|
1095 | * @category Core
|
1096 | * @category Core
|
1096 | *
|
1097 | *
|
1097 | * @param integer $archID
|
1098 | * @param integer $archID
|
1098 | * @param string $info
|
1099 | * @param string $info
|
1099 | * @return string
|
1100 | * @return string
|
1100 | */
|
1101 | */
|
1101 | public function showArchForm($archID = 0, $info = "") { |
1102 | public function showArchForm($archID = 0, $info = "") { |
1102 | $sArchID = $this->secure->checkInt($archID); |
1103 | $sArchID = $this->secure->checkInt($archID); |
1103 | $sInfo = $this->secure->checkStr($info, 1); |
1104 | $sInfo = $this->secure->checkStr($info, 1); |
1104 | if ($sInfo == "") { |
1105 | if ($sInfo == "") { |
1105 | $sInfo = "Архитектура"; |
1106 | $sInfo = "Архитектура"; |
1106 | }
|
1107 | }
|
1107 | if ($sArchID != 0) { |
1108 | if ($sArchID != 0) { |
1108 | // Режим редактирования
|
1109 | // Режим редактирования
|
1109 | $query = "SELECT * FROM ".$this->prefix."arch WHERE arch_id='".$sArchID."'"; |
1110 | $query = "SELECT * FROM ".$this->prefix."arch WHERE arch_id='".$sArchID."'"; |
1110 | $rq =& $this->db->query($query); |
1111 | $rq =& $this->db->query($query); |
1111 | $rq->fetchInto($element); |
1112 | $rq->fetchInto($element); |
1112 | }
|
1113 | }
|
1113 | 1114 | ||
1114 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1115 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1115 | $show .= "<div class='inputbox'><label for='arch'>Архитектура:</label> <input type='text' name='arch' id='arch' value='".$this->secure->checkStr($element["arch"],1)."'></div>\n"; |
1116 | $show .= "<div class='inputbox'><label for='arch'>Архитектура:</label> <input type='text' name='arch' id='arch' value='".$this->secure->checkStr($element["arch"],1)."'></div>\n"; |
1116 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1117 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1117 | 1118 | ||
1118 | return $show; |
1119 | return $show; |
1119 | }
|
1120 | }
|
1120 | 1121 | ||
1121 | /**
|
1122 | /**
|
1122 | * Вывод списка схем репозиториев
|
1123 | * Вывод списка схем репозиториев
|
1123 | *
|
1124 | *
|
1124 | * @author Alexander Wolf
|
1125 | * @author Alexander Wolf
|
1125 | * @category Core
|
1126 | * @category Core
|
1126 | *
|
1127 | *
|
1127 | * @param string $name
|
1128 | * @param string $name
|
1128 | * @param string $actor
|
1129 | * @param string $actor
|
1129 | * @param string $format
|
1130 | * @param string $format
|
1130 | * @return string
|
1131 | * @return string
|
1131 | */
|
1132 | */
|
1132 | public function showSchemeList($name, $actor, $format = 'list') { |
1133 | public function showSchemeList($name, $actor, $format = 'list') { |
1133 | switch($format) { |
1134 | switch($format) { |
1134 | case 'list': |
1135 | case 'list': |
1135 | $query = "SELECT * FROM ".$this->prefix."repscheme"; |
1136 | $query = "SELECT * FROM ".$this->prefix."repscheme"; |
1136 | $rq =& $this->db->query($query); |
1137 | $rq =& $this->db->query($query); |
1137 | $show = "<ul>\n"; |
1138 | $show = "<ul>\n"; |
1138 | while ($rq->fetchInto($element)) { |
1139 | while ($rq->fetchInto($element)) { |
1139 | $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"; |
1140 | $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"; |
1140 | }
|
1141 | }
|
1141 | $show .= "</ul>"; |
1142 | $show .= "</ul>"; |
1142 | break; |
1143 | break; |
1143 | case 'innerhtml': |
1144 | case 'innerhtml': |
1144 | $schemeID = $this->secure->checkInt($actor); |
1145 | $schemeID = $this->secure->checkInt($actor); |
1145 | $query = "SELECT * FROM ".$this->prefix."repscheme"; |
1146 | $query = "SELECT * FROM ".$this->prefix."repscheme"; |
1146 | $rq =& $this->db->query($query); |
1147 | $rq =& $this->db->query($query); |
1147 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1148 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1148 | while ($rq->fetchInto($element)) { |
1149 | while ($rq->fetchInto($element)) { |
1149 | if ($element["scheme_id"]==$schemeID) { |
1150 | if ($element["scheme_id"]==$schemeID) { |
1150 | $show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."' selected>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
1151 | $show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."' selected>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
1151 | } else { |
1152 | } else { |
1152 | $show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."'>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
1153 | $show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."'>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
1153 | }
|
1154 | }
|
1154 | }
|
1155 | }
|
1155 | $show .= "</select>"; |
1156 | $show .= "</select>"; |
1156 | break; |
1157 | break; |
1157 | }
|
1158 | }
|
1158 | return $show; |
1159 | return $show; |
1159 | }
|
1160 | }
|
1160 | 1161 | ||
1161 | /**
|
1162 | /**
|
1162 | * Добавление новой схемы репозитория
|
1163 | * Добавление новой схемы репозитория
|
1163 | *
|
1164 | *
|
1164 | * @author Alexander Wolf
|
1165 | * @author Alexander Wolf
|
1165 | * @category Core
|
1166 | * @category Core
|
1166 | *
|
1167 | *
|
1167 | * @param string $scheme
|
1168 | * @param string $scheme
|
1168 | * @return array
|
1169 | * @return array
|
1169 | */
|
1170 | */
|
1170 | public function addScheme($scheme) { |
1171 | public function addScheme($scheme) { |
1171 | $result = array(); |
1172 | $result = array(); |
1172 | $sScheme = $this->secure->checkStr($scheme); |
1173 | $sScheme = $this->secure->checkStr($scheme); |
1173 | 1174 | ||
1174 | $query = "INSERT INTO ".$this->prefix."repscheme SET scheme='".$sScheme."'"; |
1175 | $query = "INSERT INTO ".$this->prefix."repscheme SET scheme='".$sScheme."'"; |
1175 | $rq =& $this->db->query($query); |
1176 | $rq =& $this->db->query($query); |
1176 | if (PEAR::isError($this->db)) { |
1177 | if (PEAR::isError($this->db)) { |
1177 | $result["ERR"] = 1; |
1178 | $result["ERR"] = 1; |
1178 | $result["ERRINFO"] = $this->db->getMessage(); |
1179 | $result["ERRINFO"] = $this->db->getMessage(); |
1179 | } else { |
1180 | } else { |
1180 | $result["ERR"] = 0; |
1181 | $result["ERR"] = 0; |
1181 | }
|
1182 | }
|
1182 | 1183 | ||
1183 | return $result; |
1184 | return $result; |
1184 | }
|
1185 | }
|
1185 | 1186 | ||
1186 | /**
|
1187 | /**
|
1187 | * Удаление информации о схеме репозитория
|
1188 | * Удаление информации о схеме репозитория
|
1188 | *
|
1189 | *
|
1189 | * @author Alexander Wolf
|
1190 | * @author Alexander Wolf
|
1190 | * @category Core
|
1191 | * @category Core
|
1191 | *
|
1192 | *
|
1192 | * @param integer $schemeID
|
1193 | * @param integer $schemeID
|
1193 | * @return array
|
1194 | * @return array
|
1194 | */
|
1195 | */
|
1195 | public function dropScheme($schemeID) { |
1196 | public function dropScheme($schemeID) { |
1196 | $result = array(); |
1197 | $result = array(); |
1197 | $sSchemeID = $this->secure->checkInt($schemeID); |
1198 | $sSchemeID = $this->secure->checkInt($schemeID); |
1198 | 1199 | ||
1199 | // Удаление схемы
|
1200 | // Удаление схемы
|
1200 | $query = "DELETE FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'"; |
1201 | $query = "DELETE FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'"; |
1201 | $rq =& $this->db->query($query); |
1202 | $rq =& $this->db->query($query); |
1202 | if (PEAR::isError($this->db)) { |
1203 | if (PEAR::isError($this->db)) { |
1203 | $result["ERR"] = 1; |
1204 | $result["ERR"] = 1; |
1204 | $result["ERRINFO"] = $this->db->getMessage(); |
1205 | $result["ERRINFO"] = $this->db->getMessage(); |
1205 | } else { |
1206 | } else { |
1206 | $result["ERR"] = 0; |
1207 | $result["ERR"] = 0; |
1207 | }
|
1208 | }
|
1208 | 1209 | ||
1209 | return $result; |
1210 | return $result; |
1210 | }
|
1211 | }
|
1211 | 1212 | ||
1212 | /**
|
1213 | /**
|
1213 | * Обновление информации о схеме репозитория
|
1214 | * Обновление информации о схеме репозитория
|
1214 | *
|
1215 | *
|
1215 | * @author Alexander Wolf
|
1216 | * @author Alexander Wolf
|
1216 | * @category Core
|
1217 | * @category Core
|
1217 | *
|
1218 | *
|
1218 | * @param integer $schemeID
|
1219 | * @param integer $schemeID
|
1219 | * @param string $info
|
1220 | * @param string $info
|
1220 | * @return array
|
1221 | * @return array
|
1221 | */
|
1222 | */
|
1222 | public function updateScheme($schemeID, $info) { |
1223 | public function updateScheme($schemeID, $info) { |
1223 | $result = array(); |
1224 | $result = array(); |
1224 | $sSchemeID = $this->secure->checkInt($schemeID); |
1225 | $sSchemeID = $this->secure->checkInt($schemeID); |
1225 | $sScheme = $this->secure->checkStr($info); |
1226 | $sScheme = $this->secure->checkStr($info); |
1226 | 1227 | ||
1227 | $query = "UPDATE ".$this->prefix."repscheme SET scheme='".$sScheme."' WHERE scheme_id='".$sSchemeID."'"; |
1228 | $query = "UPDATE ".$this->prefix."repscheme SET scheme='".$sScheme."' WHERE scheme_id='".$sSchemeID."'"; |
1228 | $rq =& $this->db->query($query); |
1229 | $rq =& $this->db->query($query); |
1229 | if (PEAR::isError($this->db)) { |
1230 | if (PEAR::isError($this->db)) { |
1230 | $result["ERR"] = 1; |
1231 | $result["ERR"] = 1; |
1231 | $result["ERRINFO"] = $this->db->getMessage(); |
1232 | $result["ERRINFO"] = $this->db->getMessage(); |
1232 | } else { |
1233 | } else { |
1233 | $result["ERR"] = 0; |
1234 | $result["ERR"] = 0; |
1234 | }
|
1235 | }
|
1235 | 1236 | ||
1236 | return $result; |
1237 | return $result; |
1237 | }
|
1238 | }
|
1238 | 1239 | ||
1239 | /**
|
1240 | /**
|
1240 | * Вывод формы редактирования/добавления схем репозиториев
|
1241 | * Вывод формы редактирования/добавления схем репозиториев
|
1241 | *
|
1242 | *
|
1242 | * @author Alexander Wolf
|
1243 | * @author Alexander Wolf
|
1243 | * @category Core
|
1244 | * @category Core
|
1244 | *
|
1245 | *
|
1245 | * @param integer $schemeID
|
1246 | * @param integer $schemeID
|
1246 | * @param string $info
|
1247 | * @param string $info
|
1247 | * @return string
|
1248 | * @return string
|
1248 | */
|
1249 | */
|
1249 | public function showSchemeForm($schemeID = 0, $info = "") { |
1250 | public function showSchemeForm($schemeID = 0, $info = "") { |
1250 | $sSchemeID = $this->secure->checkInt($schemeID); |
1251 | $sSchemeID = $this->secure->checkInt($schemeID); |
1251 | $sInfo = $this->secure->checkStr($info, 1); |
1252 | $sInfo = $this->secure->checkStr($info, 1); |
1252 | if ($sInfo == "") { |
1253 | if ($sInfo == "") { |
1253 | $sInfo = "Схема репозитория"; |
1254 | $sInfo = "Схема репозитория"; |
1254 | }
|
1255 | }
|
1255 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1256 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1256 | if ($sSchemeID != 0) { |
1257 | if ($sSchemeID != 0) { |
1257 | // Режим редактирования
|
1258 | // Режим редактирования
|
1258 | $query = "SELECT * FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'"; |
1259 | $query = "SELECT * FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'"; |
1259 | $rq =& $this->db->query($query); |
1260 | $rq =& $this->db->query($query); |
1260 | $rq->fetchInto($element); |
1261 | $rq->fetchInto($element); |
1261 | }
|
1262 | }
|
1262 | 1263 | ||
1263 | $show .= "<div class='inputbox'><label for='scheme'>Схема репозитория:</label> <input type='text' name='scheme' id='scheme' value='".$this->secure->checkStr($element["scheme"],1)."'></div>\n"; |
1264 | $show .= "<div class='inputbox'><label for='scheme'>Схема репозитория:</label> <input type='text' name='scheme' id='scheme' value='".$this->secure->checkStr($element["scheme"],1)."'></div>\n"; |
1264 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1265 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1265 | 1266 | ||
1266 | return $show; |
1267 | return $show; |
1267 | }
|
1268 | }
|
1268 | 1269 | ||
1269 | /**
|
1270 | /**
|
1270 | * Вывод списка протоколов
|
1271 | * Вывод списка протоколов
|
1271 | *
|
1272 | *
|
1272 | * @author Alexander Wolf
|
1273 | * @author Alexander Wolf
|
1273 | * @category Core
|
1274 | * @category Core
|
1274 | *
|
1275 | *
|
1275 | * @param string $name
|
1276 | * @param string $name
|
1276 | * @param string $actor
|
1277 | * @param string $actor
|
1277 | * @param string $format
|
1278 | * @param string $format
|
1278 | * @return string
|
1279 | * @return string
|
1279 | */
|
1280 | */
|
1280 | public function showProtoList($name, $actor, $format = 'list') { |
1281 | public function showProtoList($name, $actor, $format = 'list') { |
1281 | switch($format) { |
1282 | switch($format) { |
1282 | case 'list': |
1283 | case 'list': |
1283 | $query = "SELECT * FROM ".$this->prefix."protos"; |
1284 | $query = "SELECT * FROM ".$this->prefix."protos"; |
1284 | $rq =& $this->db->query($query); |
1285 | $rq =& $this->db->query($query); |
1285 | $show = "<ul>\n"; |
1286 | $show = "<ul>\n"; |
1286 | while ($rq->fetchInto($element)) { |
1287 | while ($rq->fetchInto($element)) { |
1287 | $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"; |
1288 | $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"; |
1288 | }
|
1289 | }
|
1289 | $show .= "</ul>"; |
1290 | $show .= "</ul>"; |
1290 | break; |
1291 | break; |
1291 | case 'innerhtml': |
1292 | case 'innerhtml': |
1292 | $protoID = $this->secure->checkInt($actor); |
1293 | $protoID = $this->secure->checkInt($actor); |
1293 | $query = "SELECT * FROM ".$this->prefix."protos"; |
1294 | $query = "SELECT * FROM ".$this->prefix."protos"; |
1294 | $rq =& $this->db->query($query); |
1295 | $rq =& $this->db->query($query); |
1295 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1296 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1296 | while ($rq->fetchInto($element)) { |
1297 | while ($rq->fetchInto($element)) { |
1297 | if ($element["proto_id"]==$protoID) { |
1298 | if ($element["proto_id"]==$protoID) { |
1298 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."' selected>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
1299 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."' selected>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
1299 | } else { |
1300 | } else { |
1300 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."'>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
1301 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."'>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
1301 | }
|
1302 | }
|
1302 | }
|
1303 | }
|
1303 | $show .= "</select>"; |
1304 | $show .= "</select>"; |
1304 | break; |
1305 | break; |
1305 | }
|
1306 | }
|
1306 | return $show; |
1307 | return $show; |
1307 | }
|
1308 | }
|
1308 | 1309 | ||
1309 | /**
|
1310 | /**
|
1310 | * Добавление нового протокола
|
1311 | * Добавление нового протокола
|
1311 | *
|
1312 | *
|
1312 | * @author Alexander Wolf
|
1313 | * @author Alexander Wolf
|
1313 | * @category Core
|
1314 | * @category Core
|
1314 | *
|
1315 | *
|
1315 | * @param string $proto
|
1316 | * @param string $proto
|
1316 | * @return array
|
1317 | * @return array
|
1317 | */
|
1318 | */
|
1318 | public function addProto($proto) { |
1319 | public function addProto($proto) { |
1319 | $result = array(); |
1320 | $result = array(); |
1320 | $sProto = $this->secure->checkStr($proto); |
1321 | $sProto = $this->secure->checkStr($proto); |
1321 | 1322 | ||
1322 | $query = "INSERT INTO ".$this->prefix."protos SET proto='".$sProto."'"; |
1323 | $query = "INSERT INTO ".$this->prefix."protos SET proto='".$sProto."'"; |
1323 | $rq =& $this->db->query($query); |
1324 | $rq =& $this->db->query($query); |
1324 | if (PEAR::isError($this->db)) { |
1325 | if (PEAR::isError($this->db)) { |
1325 | $result["ERR"] = 1; |
1326 | $result["ERR"] = 1; |
1326 | $result["ERRINFO"] = $this->db->getMessage(); |
1327 | $result["ERRINFO"] = $this->db->getMessage(); |
1327 | } else { |
1328 | } else { |
1328 | $result["ERR"] = 0; |
1329 | $result["ERR"] = 0; |
1329 | }
|
1330 | }
|
1330 | 1331 | ||
1331 | return $result; |
1332 | return $result; |
1332 | }
|
1333 | }
|
1333 | 1334 | ||
1334 | /**
|
1335 | /**
|
1335 | * Удаление информации о протоколе
|
1336 | * Удаление информации о протоколе
|
1336 | *
|
1337 | *
|
1337 | * @author Alexander Wolf
|
1338 | * @author Alexander Wolf
|
1338 | * @category Core
|
1339 | * @category Core
|
1339 | *
|
1340 | *
|
1340 | * @param integer $protoID
|
1341 | * @param integer $protoID
|
1341 | * @return array
|
1342 | * @return array
|
1342 | */
|
1343 | */
|
1343 | public function dropProto($protoID) { |
1344 | public function dropProto($protoID) { |
1344 | $result = array(); |
1345 | $result = array(); |
1345 | $sProtoID = $this->secure->checkInt($protoID); |
1346 | $sProtoID = $this->secure->checkInt($protoID); |
1346 | 1347 | ||
1347 | // Удаление протокола
|
1348 | // Удаление протокола
|
1348 | $query = "DELETE FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
1349 | $query = "DELETE FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
1349 | $rq =& $this->db->query($query); |
1350 | $rq =& $this->db->query($query); |
1350 | if (PEAR::isError($this->db)) { |
1351 | if (PEAR::isError($this->db)) { |
1351 | $result["ERR"] = 1; |
1352 | $result["ERR"] = 1; |
1352 | $result["ERRINFO"] = $this->db->getMessage(); |
1353 | $result["ERRINFO"] = $this->db->getMessage(); |
1353 | } else { |
1354 | } else { |
1354 | $result["ERR"] = 0; |
1355 | $result["ERR"] = 0; |
1355 | }
|
1356 | }
|
1356 | 1357 | ||
1357 | return $result; |
1358 | return $result; |
1358 | }
|
1359 | }
|
1359 | 1360 | ||
1360 | /**
|
1361 | /**
|
1361 | * Обновление информации о протоколе
|
1362 | * Обновление информации о протоколе
|
1362 | *
|
1363 | *
|
1363 | * @author Alexander Wolf
|
1364 | * @author Alexander Wolf
|
1364 | * @category Core
|
1365 | * @category Core
|
1365 | *
|
1366 | *
|
1366 | * @param integer $protoID
|
1367 | * @param integer $protoID
|
1367 | * @param string $info
|
1368 | * @param string $info
|
1368 | * @return array
|
1369 | * @return array
|
1369 | */
|
1370 | */
|
1370 | public function updateProto($protoID, $info) { |
1371 | public function updateProto($protoID, $info) { |
1371 | $result = array(); |
1372 | $result = array(); |
1372 | $sProtoID = $this->secure->checkInt($protoID); |
1373 | $sProtoID = $this->secure->checkInt($protoID); |
1373 | $sProto = $this->secure->checkStr($info); |
1374 | $sProto = $this->secure->checkStr($info); |
1374 | 1375 | ||
1375 | $query = "UPDATE ".$this->prefix."protos SET proto='".$sProto."' WHERE proto_id='".$sProtoID."'"; |
1376 | $query = "UPDATE ".$this->prefix."protos SET proto='".$sProto."' WHERE proto_id='".$sProtoID."'"; |
1376 | $rq =& $this->db->query($query); |
1377 | $rq =& $this->db->query($query); |
1377 | if (PEAR::isError($this->db)) { |
1378 | if (PEAR::isError($this->db)) { |
1378 | $result["ERR"] = 1; |
1379 | $result["ERR"] = 1; |
1379 | $result["ERRINFO"] = $this->db->getMessage(); |
1380 | $result["ERRINFO"] = $this->db->getMessage(); |
1380 | } else { |
1381 | } else { |
1381 | $result["ERR"] = 0; |
1382 | $result["ERR"] = 0; |
1382 | }
|
1383 | }
|
1383 | 1384 | ||
1384 | return $result; |
1385 | return $result; |
1385 | }
|
1386 | }
|
1386 | 1387 | ||
1387 | /**
|
1388 | /**
|
1388 | * Вывод формы редактирования/добавления протоколов
|
1389 | * Вывод формы редактирования/добавления протоколов
|
1389 | *
|
1390 | *
|
1390 | * @author Alexander Wolf
|
1391 | * @author Alexander Wolf
|
1391 | * @category Core
|
1392 | * @category Core
|
1392 | *
|
1393 | *
|
1393 | * @param integer $protoID
|
1394 | * @param integer $protoID
|
1394 | * @param string $info
|
1395 | * @param string $info
|
1395 | * @return string
|
1396 | * @return string
|
1396 | */
|
1397 | */
|
1397 | public function showProtoForm($protoID = 0, $info = "") { |
1398 | public function showProtoForm($protoID = 0, $info = "") { |
1398 | $sProtoID = $this->secure->checkInt($protoID); |
1399 | $sProtoID = $this->secure->checkInt($protoID); |
1399 | $sInfo = $this->secure->checkStr($info, 1); |
1400 | $sInfo = $this->secure->checkStr($info, 1); |
1400 | if ($sInfo == "") { |
1401 | if ($sInfo == "") { |
1401 | $sInfo = "Протокол доступа"; |
1402 | $sInfo = "Протокол доступа"; |
1402 | }
|
1403 | }
|
1403 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1404 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1404 | if ($sProtoID != 0) { |
1405 | if ($sProtoID != 0) { |
1405 | // Режим редактирования
|
1406 | // Режим редактирования
|
1406 | $query = "SELECT * FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
1407 | $query = "SELECT * FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
1407 | $rq =& $this->db->query($query); |
1408 | $rq =& $this->db->query($query); |
1408 | $rq->fetchInto($element); |
1409 | $rq->fetchInto($element); |
1409 | }
|
1410 | }
|
1410 | 1411 | ||
1411 | $show .= "<div class='inputbox'><label for='proto'>Протокол доступа:</label> <input type='text' name='proto' id='proto' value='".$this->secure->checkStr($element["proto"],1)."'></div>\n"; |
1412 | $show .= "<div class='inputbox'><label for='proto'>Протокол доступа:</label> <input type='text' name='proto' id='proto' value='".$this->secure->checkStr($element["proto"],1)."'></div>\n"; |
1412 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1413 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1413 | 1414 | ||
1414 | return $show; |
1415 | return $show; |
1415 | }
|
1416 | }
|
1416 | 1417 | ||
1417 | /**
|
1418 | /**
|
1418 | * Вывод списка хостов
|
1419 | * Вывод списка хостов
|
1419 | *
|
1420 | *
|
1420 | * @author Alexander Wolf
|
1421 | * @author Alexander Wolf
|
1421 | * @category Core
|
1422 | * @category Core
|
1422 | *
|
1423 | *
|
1423 | * @param string $name
|
1424 | * @param string $name
|
1424 | * @param string $actor
|
1425 | * @param string $actor
|
1425 | * @param string $format
|
1426 | * @param string $format
|
1426 | * @return string
|
1427 | * @return string
|
1427 | */
|
1428 | */
|
1428 | public function showHostsList($name, $actor, $format = 'list') { |
1429 | public function showHostsList($name, $actor, $format = 'list') { |
1429 | switch($format) { |
1430 | switch($format) { |
1430 | case 'list': |
1431 | case 'list': |
1431 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
1432 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
1432 | $rq =& $this->db->query($query); |
1433 | $rq =& $this->db->query($query); |
1433 | $show = "<ul>\n"; |
1434 | $show = "<ul>\n"; |
1434 | while ($rq->fetchInto($element)) { |
1435 | while ($rq->fetchInto($element)) { |
1435 | $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"; |
1436 | $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"; |
1436 | }
|
1437 | }
|
1437 | $show .= "</ul>"; |
1438 | $show .= "</ul>"; |
1438 | break; |
1439 | break; |
1439 | case 'innerhtml': |
1440 | case 'innerhtml': |
1440 | $hostID = $this->secure->checkInt($actor); |
1441 | $hostID = $this->secure->checkInt($actor); |
1441 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
1442 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
1442 | $rq =& $this->db->query($query); |
1443 | $rq =& $this->db->query($query); |
1443 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1444 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1444 | while ($rq->fetchInto($element)) { |
1445 | while ($rq->fetchInto($element)) { |
1445 | if ($element["rhost_id"]==$hostID) { |
1446 | if ($element["rhost_id"]==$hostID) { |
1446 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."' selected>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
1447 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."' selected>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
1447 | } else { |
1448 | } else { |
1448 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."'>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
1449 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."'>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
1449 | }
|
1450 | }
|
1450 | }
|
1451 | }
|
1451 | $show .= "</select>"; |
1452 | $show .= "</select>"; |
1452 | break; |
1453 | break; |
1453 | }
|
1454 | }
|
1454 | return $show; |
1455 | return $show; |
1455 | }
|
1456 | }
|
1456 | 1457 | ||
1457 | /**
|
1458 | /**
|
1458 | * Добавление нового хоста
|
1459 | * Добавление нового хоста
|
1459 | *
|
1460 | *
|
1460 | * @author Alexander Wolf
|
1461 | * @author Alexander Wolf
|
1461 | * @category Core
|
1462 | * @category Core
|
1462 | *
|
1463 | *
|
1463 | * @param string $host
|
1464 | * @param string $host
|
1464 | * @return array
|
1465 | * @return array
|
1465 | */
|
1466 | */
|
1466 | public function addHost($host) { |
1467 | public function addHost($host) { |
1467 | $result = array(); |
1468 | $result = array(); |
1468 | $sHost = $this->secure->checkStr($host); |
1469 | $sHost = $this->secure->checkStr($host); |
1469 | 1470 | ||
1470 | $query = "INSERT INTO ".$this->prefix."rephost SET rhost='".$sHost."'"; |
1471 | $query = "INSERT INTO ".$this->prefix."rephost SET rhost='".$sHost."'"; |
1471 | $rq =& $this->db->query($query); |
1472 | $rq =& $this->db->query($query); |
1472 | if (PEAR::isError($this->db)) { |
1473 | if (PEAR::isError($this->db)) { |
1473 | $result["ERR"] = 1; |
1474 | $result["ERR"] = 1; |
1474 | $result["ERRINFO"] = $this->db->getMessage(); |
1475 | $result["ERRINFO"] = $this->db->getMessage(); |
1475 | } else { |
1476 | } else { |
1476 | $result["ERR"] = 0; |
1477 | $result["ERR"] = 0; |
1477 | }
|
1478 | }
|
1478 | 1479 | ||
1479 | return $result; |
1480 | return $result; |
1480 | }
|
1481 | }
|
1481 | 1482 | ||
1482 | /**
|
1483 | /**
|
1483 | * Удаление информации о хосте
|
1484 | * Удаление информации о хосте
|
1484 | *
|
1485 | *
|
1485 | * @author Alexander Wolf
|
1486 | * @author Alexander Wolf
|
1486 | * @category Core
|
1487 | * @category Core
|
1487 | *
|
1488 | *
|
1488 | * @param integer $hostID
|
1489 | * @param integer $hostID
|
1489 | * @return array
|
1490 | * @return array
|
1490 | */
|
1491 | */
|
1491 | public function dropHost($hostID) { |
1492 | public function dropHost($hostID) { |
1492 | $result = array(); |
1493 | $result = array(); |
1493 | $sHostID = $this->secure->checkInt($hostID); |
1494 | $sHostID = $this->secure->checkInt($hostID); |
1494 | 1495 | ||
1495 | // Удаление хоста
|
1496 | // Удаление хоста
|
1496 | $query = "DELETE FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
1497 | $query = "DELETE FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
1497 | $rq =& $this->db->query($query); |
1498 | $rq =& $this->db->query($query); |
1498 | if (PEAR::isError($this->db)) { |
1499 | if (PEAR::isError($this->db)) { |
1499 | $result["ERR"] = 1; |
1500 | $result["ERR"] = 1; |
1500 | $result["ERRINFO"] = $this->db->getMessage(); |
1501 | $result["ERRINFO"] = $this->db->getMessage(); |
1501 | } else { |
1502 | } else { |
1502 | $result["ERR"] = 0; |
1503 | $result["ERR"] = 0; |
1503 | }
|
1504 | }
|
1504 | 1505 | ||
1505 | return $result; |
1506 | return $result; |
1506 | }
|
1507 | }
|
1507 | 1508 | ||
1508 | /**
|
1509 | /**
|
1509 | * Обновление информации о хосте
|
1510 | * Обновление информации о хосте
|
1510 | *
|
1511 | *
|
1511 | * @author Alexander Wolf
|
1512 | * @author Alexander Wolf
|
1512 | * @category Core
|
1513 | * @category Core
|
1513 | *
|
1514 | *
|
1514 | * @param integer $hostID
|
1515 | * @param integer $hostID
|
1515 | * @param string $info
|
1516 | * @param string $info
|
1516 | * @return array
|
1517 | * @return array
|
1517 | */
|
1518 | */
|
1518 | public function updateHost($hostID, $info) { |
1519 | public function updateHost($hostID, $info) { |
1519 | $result = array(); |
1520 | $result = array(); |
1520 | $sHostID = $this->secure->checkInt($hostID); |
1521 | $sHostID = $this->secure->checkInt($hostID); |
1521 | $sHost = $this->secure->checkStr($info); |
1522 | $sHost = $this->secure->checkStr($info); |
1522 | 1523 | ||
1523 | $query = "UPDATE ".$this->prefix."rephost SET rhost='".$sHost."' WHERE rhost_id='".$sHostID."'"; |
1524 | $query = "UPDATE ".$this->prefix."rephost SET rhost='".$sHost."' WHERE rhost_id='".$sHostID."'"; |
1524 | $rq =& $this->db->query($query); |
1525 | $rq =& $this->db->query($query); |
1525 | if (PEAR::isError($this->db)) { |
1526 | if (PEAR::isError($this->db)) { |
1526 | $result["ERR"] = 1; |
1527 | $result["ERR"] = 1; |
1527 | $result["ERRINFO"] = $this->db->getMessage(); |
1528 | $result["ERRINFO"] = $this->db->getMessage(); |
1528 | } else { |
1529 | } else { |
1529 | $result["ERR"] = 0; |
1530 | $result["ERR"] = 0; |
1530 | }
|
1531 | }
|
1531 | 1532 | ||
1532 | return $result; |
1533 | return $result; |
1533 | }
|
1534 | }
|
1534 | 1535 | ||
1535 | /**
|
1536 | /**
|
1536 | * Вывод формы редактирования/добавления хостов
|
1537 | * Вывод формы редактирования/добавления хостов
|
1537 | *
|
1538 | *
|
1538 | * @author Alexander Wolf
|
1539 | * @author Alexander Wolf
|
1539 | * @category Core
|
1540 | * @category Core
|
1540 | *
|
1541 | *
|
1541 | * @param integer $hostID
|
1542 | * @param integer $hostID
|
1542 | * @param string $info
|
1543 | * @param string $info
|
1543 | * @return string
|
1544 | * @return string
|
1544 | */
|
1545 | */
|
1545 | public function showHostForm($hostID = 0, $info = "") { |
1546 | public function showHostForm($hostID = 0, $info = "") { |
1546 | $sHostID = $this->secure->checkInt($hostID); |
1547 | $sHostID = $this->secure->checkInt($hostID); |
1547 | $sInfo = $this->secure->checkStr($info, 1); |
1548 | $sInfo = $this->secure->checkStr($info, 1); |
1548 | if ($sInfo == "") { |
1549 | if ($sInfo == "") { |
1549 | $sInfo = "Хост репозитория"; |
1550 | $sInfo = "Хост репозитория"; |
1550 | }
|
1551 | }
|
1551 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1552 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1552 | if ($sHostID != 0) { |
1553 | if ($sHostID != 0) { |
1553 | // Режим редактирования
|
1554 | // Режим редактирования
|
1554 | $query = "SELECT * FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
1555 | $query = "SELECT * FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
1555 | $rq =& $this->db->query($query); |
1556 | $rq =& $this->db->query($query); |
1556 | $rq->fetchInto($element); |
1557 | $rq->fetchInto($element); |
1557 | }
|
1558 | }
|
1558 | 1559 | ||
1559 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> <input type='text' name='rhost' id='rhost' value='".$this->secure->checkStr($element["rhost"],1)."'></div>\n"; |
1560 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> <input type='text' name='rhost' id='rhost' value='".$this->secure->checkStr($element["rhost"],1)."'></div>\n"; |
1560 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1561 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1561 | 1562 | ||
1562 | return $show; |
1563 | return $show; |
1563 | }
|
1564 | }
|
1564 | 1565 | ||
1565 | /**
|
1566 | /**
|
1566 | * Вывод списка корневых папок
|
1567 | * Вывод списка корневых папок
|
1567 | *
|
1568 | *
|
1568 | * @author Alexander Wolf
|
1569 | * @author Alexander Wolf
|
1569 | * @category Core
|
1570 | * @category Core
|
1570 | *
|
1571 | *
|
1571 | * @param string $name
|
1572 | * @param string $name
|
1572 | * @param string $actor
|
1573 | * @param string $actor
|
1573 | * @param string $format
|
1574 | * @param string $format
|
1574 | * @return string
|
1575 | * @return string
|
1575 | */
|
1576 | */
|
1576 | public function showFoldersList($name, $actor, $format = 'list') { |
1577 | public function showFoldersList($name, $actor, $format = 'list') { |
1577 | switch($format) { |
1578 | switch($format) { |
1578 | case 'list': |
1579 | case 'list': |
1579 | $query = "SELECT * FROM ".$this->prefix."repfolder"; |
1580 | $query = "SELECT * FROM ".$this->prefix."repfolder"; |
1580 | $rq =& $this->db->query($query); |
1581 | $rq =& $this->db->query($query); |
1581 | $show = "<ul>\n"; |
1582 | $show = "<ul>\n"; |
1582 | while ($rq->fetchInto($element)) { |
1583 | while ($rq->fetchInto($element)) { |
1583 | $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"; |
1584 | $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"; |
1584 | }
|
1585 | }
|
1585 | $show .= "</ul>"; |
1586 | $show .= "</ul>"; |
1586 | break; |
1587 | break; |
1587 | case 'innerhtml': |
1588 | case 'innerhtml': |
1588 | $folderID = $this->secure->checkInt($actor); |
1589 | $folderID = $this->secure->checkInt($actor); |
1589 | $query = "SELECT * FROM ".$this->prefix."repfolder"; |
1590 | $query = "SELECT * FROM ".$this->prefix."repfolder"; |
1590 | $rq =& $this->db->query($query); |
1591 | $rq =& $this->db->query($query); |
1591 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1592 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1592 | while ($rq->fetchInto($element)) { |
1593 | while ($rq->fetchInto($element)) { |
1593 | if ($element["rfolder_id"]==$folderID) { |
1594 | if ($element["rfolder_id"]==$folderID) { |
1594 | $show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."' selected>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
1595 | $show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."' selected>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
1595 | } else { |
1596 | } else { |
1596 | $show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."'>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
1597 | $show .= "<option value='".$this->secure->checkInt($element["rfolder_id"])."'>".$this->secure->checkStr($element["rfolder"],1)."</option>\n"; |
1597 | }
|
1598 | }
|
1598 | }
|
1599 | }
|
1599 | $show .= "</select>"; |
1600 | $show .= "</select>"; |
1600 | break; |
1601 | break; |
1601 | }
|
1602 | }
|
1602 | return $show; |
1603 | return $show; |
1603 | }
|
1604 | }
|
1604 | 1605 | ||
1605 | /**
|
1606 | /**
|
1606 | * Добавление нового корневого каталога
|
1607 | * Добавление нового корневого каталога
|
1607 | *
|
1608 | *
|
1608 | * @author Alexander Wolf
|
1609 | * @author Alexander Wolf
|
1609 | * @category Core
|
1610 | * @category Core
|
1610 | *
|
1611 | *
|
1611 | * @param string $flder
|
1612 | * @param string $flder
|
1612 | * @return array
|
1613 | * @return array
|
1613 | */
|
1614 | */
|
1614 | public function addFolder($folder) { |
1615 | public function addFolder($folder) { |
1615 | $result = array(); |
1616 | $result = array(); |
1616 | $sFolder = $this->secure->checkStr($folder); |
1617 | $sFolder = $this->secure->checkStr($folder); |
1617 | 1618 | ||
1618 | $query = "INSERT INTO ".$this->prefix."repfolder SET rfolder='".$sFolder."'"; |
1619 | $query = "INSERT INTO ".$this->prefix."repfolder SET rfolder='".$sFolder."'"; |
1619 | $rq =& $this->db->query($query); |
1620 | $rq =& $this->db->query($query); |
1620 | if (PEAR::isError($this->db)) { |
1621 | if (PEAR::isError($this->db)) { |
1621 | $result["ERR"] = 1; |
1622 | $result["ERR"] = 1; |
1622 | $result["ERRINFO"] = $this->db->getMessage(); |
1623 | $result["ERRINFO"] = $this->db->getMessage(); |
1623 | } else { |
1624 | } else { |
1624 | $result["ERR"] = 0; |
1625 | $result["ERR"] = 0; |
1625 | }
|
1626 | }
|
1626 | 1627 | ||
1627 | return $result; |
1628 | return $result; |
1628 | }
|
1629 | }
|
1629 | 1630 | ||
1630 | /**
|
1631 | /**
|
1631 | * Удаление информации о корневой папке
|
1632 | * Удаление информации о корневой папке
|
1632 | *
|
1633 | *
|
1633 | * @author Alexander Wolf
|
1634 | * @author Alexander Wolf
|
1634 | * @category Core
|
1635 | * @category Core
|
1635 | *
|
1636 | *
|
1636 | * @param integer $folderID
|
1637 | * @param integer $folderID
|
1637 | * @return array
|
1638 | * @return array
|
1638 | */
|
1639 | */
|
1639 | public function dropFolder($folderID) { |
1640 | public function dropFolder($folderID) { |
1640 | $result = array(); |
1641 | $result = array(); |
1641 | $sFolderID = $this->secure->checkInt($folderID); |
1642 | $sFolderID = $this->secure->checkInt($folderID); |
1642 | 1643 | ||
1643 | // Удаление корневой папки
|
1644 | // Удаление корневой папки
|
1644 | $query = "DELETE FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
1645 | $query = "DELETE FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
1645 | $rq =& $this->db->query($query); |
1646 | $rq =& $this->db->query($query); |
1646 | if (PEAR::isError($this->db)) { |
1647 | if (PEAR::isError($this->db)) { |
1647 | $result["ERR"] = 1; |
1648 | $result["ERR"] = 1; |
1648 | $result["ERRINFO"] = $this->db->getMessage(); |
1649 | $result["ERRINFO"] = $this->db->getMessage(); |
1649 | } else { |
1650 | } else { |
1650 | $result["ERR"] = 0; |
1651 | $result["ERR"] = 0; |
1651 | }
|
1652 | }
|
1652 | 1653 | ||
1653 | return $result; |
1654 | return $result; |
1654 | }
|
1655 | }
|
1655 | 1656 | ||
1656 | /**
|
1657 | /**
|
1657 | * Обновление информации о корневой папки
|
1658 | * Обновление информации о корневой папки
|
1658 | *
|
1659 | *
|
1659 | * @author Alexander Wolf
|
1660 | * @author Alexander Wolf
|
1660 | * @category Core
|
1661 | * @category Core
|
1661 | *
|
1662 | *
|
1662 | * @param integer $folderID
|
1663 | * @param integer $folderID
|
1663 | * @param string $info
|
1664 | * @param string $info
|
1664 | * @return array
|
1665 | * @return array
|
1665 | */
|
1666 | */
|
1666 | public function updateFolder($folderID, $info) { |
1667 | public function updateFolder($folderID, $info) { |
1667 | $result = array(); |
1668 | $result = array(); |
1668 | $sFolderID = $this->secure->checkInt($folderID); |
1669 | $sFolderID = $this->secure->checkInt($folderID); |
1669 | $sFolder = $this->secure->checkStr($info); |
1670 | $sFolder = $this->secure->checkStr($info); |
1670 | 1671 | ||
1671 | $query = "UPDATE ".$this->prefix."repfolder SET rfolder='".$sFolder."' WHERE rfolder_id='".$sFolderID."'"; |
1672 | $query = "UPDATE ".$this->prefix."repfolder SET rfolder='".$sFolder."' WHERE rfolder_id='".$sFolderID."'"; |
1672 | $rq =& $this->db->query($query); |
1673 | $rq =& $this->db->query($query); |
1673 | if (PEAR::isError($this->db)) { |
1674 | if (PEAR::isError($this->db)) { |
1674 | $result["ERR"] = 1; |
1675 | $result["ERR"] = 1; |
1675 | $result["ERRINFO"] = $this->db->getMessage(); |
1676 | $result["ERRINFO"] = $this->db->getMessage(); |
1676 | } else { |
1677 | } else { |
1677 | $result["ERR"] = 0; |
1678 | $result["ERR"] = 0; |
1678 | }
|
1679 | }
|
1679 | 1680 | ||
1680 | return $result; |
1681 | return $result; |
1681 | }
|
1682 | }
|
1682 | 1683 | ||
1683 | /**
|
1684 | /**
|
1684 | * Вывод формы редактирования/добавления корневых папок
|
1685 | * Вывод формы редактирования/добавления корневых папок
|
1685 | *
|
1686 | *
|
1686 | * @author Alexander Wolf
|
1687 | * @author Alexander Wolf
|
1687 | * @category Core
|
1688 | * @category Core
|
1688 | *
|
1689 | *
|
1689 | * @param integer $folderID
|
1690 | * @param integer $folderID
|
1690 | * @param string $info
|
1691 | * @param string $info
|
1691 | * @return string
|
1692 | * @return string
|
1692 | */
|
1693 | */
|
1693 | public function showFolderForm($folderID = 0, $info = "") { |
1694 | public function showFolderForm($folderID = 0, $info = "") { |
1694 | $sFolderID = $this->secure->checkInt($folderID); |
1695 | $sFolderID = $this->secure->checkInt($folderID); |
1695 | $sInfo = $this->secure->checkStr($info, 1); |
1696 | $sInfo = $this->secure->checkStr($info, 1); |
1696 | if ($sInfo == "") { |
1697 | if ($sInfo == "") { |
1697 | $sInfo = "Корневая папка"; |
1698 | $sInfo = "Корневая папка"; |
1698 | }
|
1699 | }
|
1699 | if ($sFolderID != 0) { |
1700 | if ($sFolderID != 0) { |
1700 | // Режим редактирования
|
1701 | // Режим редактирования
|
1701 | $query = "SELECT * FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
1702 | $query = "SELECT * FROM ".$this->prefix."repfolder WHERE rfolder_id='".$sFolderID."'"; |
1702 | $rq =& $this->db->query($query); |
1703 | $rq =& $this->db->query($query); |
1703 | $rq->fetchInto($element); |
1704 | $rq->fetchInto($element); |
1704 | }
|
1705 | }
|
1705 | 1706 | ||
1706 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1707 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1707 | $show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> <input type='text' name='rfolder' id='rfolder' value='".$this->secure->checkStr($element["rfolder"],1)."'></div>\n"; |
1708 | $show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> <input type='text' name='rfolder' id='rfolder' value='".$this->secure->checkStr($element["rfolder"],1)."'></div>\n"; |
1708 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1709 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1709 | 1710 | ||
1710 | return $show; |
1711 | return $show; |
1711 | }
|
1712 | }
|
1712 | 1713 | ||
1713 | /**
|
1714 | /**
|
1714 | * Показывает список подписей
|
1715 | * Показывает список подписей
|
1715 | *
|
1716 | *
|
1716 | * @author Alexander Wolf
|
1717 | * @author Alexander Wolf
|
1717 | * @category Core
|
1718 | * @category Core
|
1718 | *
|
1719 | *
|
1719 | * @param string $name
|
1720 | * @param string $name
|
1720 | * @param string $actor
|
1721 | * @param string $actor
|
1721 | * @param string $format
|
1722 | * @param string $format
|
1722 | * @return string
|
1723 | * @return string
|
1723 | */
|
1724 | */
|
1724 | public function showSignsList($name, $actor, $format = 'list') { |
1725 | public function showSignsList($name, $actor, $format = 'list') { |
1725 | $query = "SELECT * FROM ".$this->prefix."signs"; |
1726 | $query = "SELECT * FROM ".$this->prefix."signs"; |
1726 | $rq =& $this->db->query($query); |
1727 | $rq =& $this->db->query($query); |
1727 | switch ($format) { |
1728 | switch ($format) { |
1728 | case 'list': |
1729 | case 'list': |
1729 | $show = "<ul>\n"; |
1730 | $show = "<ul>\n"; |
1730 | while ($rq->fetchInto($element)) { |
1731 | while ($rq->fetchInto($element)) { |
1731 | $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"; |
1732 | $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"; |
1732 | }
|
1733 | }
|
1733 | $show .= "</ul>"; |
1734 | $show .= "</ul>"; |
1734 | break; |
1735 | break; |
1735 | case 'innerhtml': |
1736 | case 'innerhtml': |
1736 | $signID = $this->secure->checkInt($actor); |
1737 | $signID = $this->secure->checkInt($actor); |
1737 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1738 | $show = "<select name='".$name."' id='".$name."'>\n"; |
1738 | $show .= "<option value='0'>Подписи нет</option>\n"; |
1739 | $show .= "<option value='0'>Подписи нет</option>\n"; |
1739 | while ($rq->fetchInto($element)) { |
1740 | while ($rq->fetchInto($element)) { |
1740 | if ($element["sign_id"]==$signID) { |
1741 | if ($element["sign_id"]==$signID) { |
1741 | $show .= "<option value='".$this->secure->checkInt($element["sign_id"])."' selected>".$this->secure->checkStr($element["sname"],1)."</option>\n"; |
1742 | $show .= "<option value='".$this->secure->checkInt($element["sign_id"])."' selected>".$this->secure->checkStr($element["sname"],1)."</option>\n"; |
1742 | } else { |
1743 | } else { |
1743 | $show .= "<option value='".$this->secure->checkInt($element["sign_id"])."'>".$this->secure->checkStr($element["sname"],1)."</option>\n"; |
1744 | $show .= "<option value='".$this->secure->checkInt($element["sign_id"])."'>".$this->secure->checkStr($element["sname"],1)."</option>\n"; |
1744 | }
|
1745 | }
|
1745 | }
|
1746 | }
|
1746 | $show .= "</select>\n"; |
1747 | $show .= "</select>\n"; |
1747 | break; |
1748 | break; |
1748 | }
|
1749 | }
|
1749 | 1750 | ||
1750 | return $show; |
1751 | return $show; |
1751 | }
|
1752 | }
|
1752 | 1753 | ||
1753 | /**
|
1754 | /**
|
1754 | * Вывод формы редактирования/добавления подписей
|
1755 | * Вывод формы редактирования/добавления подписей
|
1755 | *
|
1756 | *
|
1756 | * @author Alexander Wolf
|
1757 | * @author Alexander Wolf
|
1757 | * @category Core
|
1758 | * @category Core
|
1758 | *
|
1759 | *
|
1759 | * @param integer $sectionID
|
1760 | * @param integer $sectionID
|
1760 | * @param string $info
|
1761 | * @param string $info
|
1761 | * @return string
|
1762 | * @return string
|
1762 | */
|
1763 | */
|
1763 | public function showSignsForm($signID = 0, $info = "") { |
1764 | public function showSignsForm($signID = 0, $info = "") { |
1764 | $sSignID = $this->secure->checkInt($signID); |
1765 | $sSignID = $this->secure->checkInt($signID); |
1765 | $sInfo = $this->secure->checkStr($info, 1); |
1766 | $sInfo = $this->secure->checkStr($info, 1); |
1766 | if ($sInfo == "") { |
1767 | if ($sInfo == "") { |
1767 | $sInfo = "Подписи"; |
1768 | $sInfo = "Подписи"; |
1768 | }
|
1769 | }
|
1769 | if ($sSignID != 0) { |
1770 | if ($sSignID != 0) { |
1770 | // Режим редактирования
|
1771 | // Режим редактирования
|
1771 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$sSignID."'"; |
1772 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$sSignID."'"; |
1772 | $rq =& $this->db->query($query); |
1773 | $rq =& $this->db->query($query); |
1773 | $rq->fetchInto($element); |
1774 | $rq->fetchInto($element); |
1774 | }
|
1775 | }
|
1775 | 1776 | ||
1776 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1777 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1777 | $show .= "<div class='inputbox'><label for='sname'>Название подписи:</label> <input type='text' name='sname' id='sname' value='".$this->secure->checkStr($element["sname"],1)."'></div>\n"; |
1778 | $show .= "<div class='inputbox'><label for='sname'>Название подписи:</label> <input type='text' name='sname' id='sname' value='".$this->secure->checkStr($element["sname"],1)."'></div>\n"; |
1778 | $show .= "<div class='inputbox'><label for='sinfo'>Описание подписи:</label> <input type='text' name='sinfo' id='sinfo' value='".$this->secure->checkStr($element["sinfo"],1)."'></div>\n"; |
1779 | $show .= "<div class='inputbox'><label for='sinfo'>Описание подписи:</label> <input type='text' name='sinfo' id='sinfo' value='".$this->secure->checkStr($element["sinfo"],1)."'></div>\n"; |
1779 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1780 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
1780 | 1781 | ||
1781 | return $show; |
1782 | return $show; |
1782 | }
|
1783 | }
|
1783 | 1784 | ||
1784 | /**
|
1785 | /**
|
1785 | * Обновление информации о секции
|
1786 | * Обновление информации о секции
|
1786 | *
|
1787 | *
|
1787 | * @author Alexander Wolf
|
1788 | * @author Alexander Wolf
|
1788 | * @category Core
|
1789 | * @category Core
|
1789 | *
|
1790 | *
|
1790 | * @param integer $sectionID
|
1791 | * @param integer $sectionID
|
1791 | * @param string $sname
|
1792 | * @param string $sname
|
1792 | * @param string $sinfo
|
1793 | * @param string $sinfo
|
1793 | * @return array
|
1794 | * @return array
|
1794 | */
|
1795 | */
|
1795 | public function updateSign($signID, $sname, $sinfo = "") { |
1796 | public function updateSign($signID, $sname, $sinfo = "") { |
1796 | $result = array(); |
1797 | $result = array(); |
1797 | $sSignID = $this->secure->checkInt($signID); |
1798 | $sSignID = $this->secure->checkInt($signID); |
1798 | $sSName = $this->secure->checkStr($sname); |
1799 | $sSName = $this->secure->checkStr($sname); |
1799 | $sSInfo = $this->secure->checkStr($sinfo); |
1800 | $sSInfo = $this->secure->checkStr($sinfo); |
1800 | 1801 | ||
1801 | $query = "UPDATE ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."' WHERE sign_id='".$sSignID."'"; |
1802 | $query = "UPDATE ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."' WHERE sign_id='".$sSignID."'"; |
1802 | $rq =& $this->db->query($query); |
1803 | $rq =& $this->db->query($query); |
1803 | if (PEAR::isError($this->db)) { |
1804 | if (PEAR::isError($this->db)) { |
1804 | $result["ERR"] = 1; |
1805 | $result["ERR"] = 1; |
1805 | $result["ERRINFO"] = $this->db->getMessage(); |
1806 | $result["ERRINFO"] = $this->db->getMessage(); |
1806 | } else { |
1807 | } else { |
1807 | $result["ERR"] = 0; |
1808 | $result["ERR"] = 0; |
1808 | }
|
1809 | }
|
1809 | 1810 | ||
1810 | return $result; |
1811 | return $result; |
1811 | }
|
1812 | }
|
1812 | 1813 | ||
1813 | /**
|
1814 | /**
|
1814 | * Удаление информации о подписи
|
1815 | * Удаление информации о подписи
|
1815 | *
|
1816 | *
|
1816 | * @author Alexander Wolf
|
1817 | * @author Alexander Wolf
|
1817 | * @category Core
|
1818 | * @category Core
|
1818 | *
|
1819 | *
|
1819 | * @param integer $sectionID
|
1820 | * @param integer $sectionID
|
1820 | * @return array
|
1821 | * @return array
|
1821 | */
|
1822 | */
|
1822 | public function dropSign($signID) { |
1823 | public function dropSign($signID) { |
1823 | $result = array(); |
1824 | $result = array(); |
1824 | $sSignID = $this->secure->checkInt($signID); |
1825 | $sSignID = $this->secure->checkInt($signID); |
1825 | 1826 | ||
1826 | // Удаление подписи
|
1827 | // Удаление подписи
|
1827 | $query = "DELETE FROM ".$this->prefix."signs WHERE sign_id='".$sSignID."'"; |
1828 | $query = "DELETE FROM ".$this->prefix."signs WHERE sign_id='".$sSignID."'"; |
1828 | $rq =& $this->db->query($query); |
1829 | $rq =& $this->db->query($query); |
1829 | if (PEAR::isError($this->db)) { |
1830 | if (PEAR::isError($this->db)) { |
1830 | $result["ERR"] = 1; |
1831 | $result["ERR"] = 1; |
1831 | $result["ERRINFO"] = $this->db->getMessage(); |
1832 | $result["ERRINFO"] = $this->db->getMessage(); |
1832 | } else { |
1833 | } else { |
1833 | $result["ERR"] = 0; |
1834 | $result["ERR"] = 0; |
1834 | }
|
1835 | }
|
1835 | 1836 | ||
1836 | return $result; |
1837 | return $result; |
1837 | }
|
1838 | }
|
1838 | 1839 | ||
1839 | /**
|
1840 | /**
|
1840 | * Добавление новой подписи
|
1841 | * Добавление новой подписи
|
1841 | *
|
1842 | *
|
1842 | * @author Alexander Wolf
|
1843 | * @author Alexander Wolf
|
1843 | * @category Core
|
1844 | * @category Core
|
1844 | *
|
1845 | *
|
1845 | * @param string $sname
|
1846 | * @param string $sname
|
1846 | * @param string $sinfo
|
1847 | * @param string $sinfo
|
1847 | * @return array
|
1848 | * @return array
|
1848 | */
|
1849 | */
|
1849 | public function addSign($sname, $sinfo = "") { |
1850 | public function addSign($sname, $sinfo = "") { |
1850 | $result = array(); |
1851 | $result = array(); |
1851 | $sSName = $this->secure->checkStr($sname); |
1852 | $sSName = $this->secure->checkStr($sname); |
1852 | $sSInfo = $this->secure->checkStr($sinfo); |
1853 | $sSInfo = $this->secure->checkStr($sinfo); |
1853 | 1854 | ||
1854 | $query = "INSERT INTO ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."'"; |
1855 | $query = "INSERT INTO ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."'"; |
1855 | $rq =& $this->db->query($query); |
1856 | $rq =& $this->db->query($query); |
1856 | if (PEAR::isError($this->db)) { |
1857 | if (PEAR::isError($this->db)) { |
1857 | $result["ERR"] = 1; |
1858 | $result["ERR"] = 1; |
1858 | $result["ERRINFO"] = $this->db->getMessage(); |
1859 | $result["ERRINFO"] = $this->db->getMessage(); |
1859 | } else { |
1860 | } else { |
1860 | $result["ERR"] = 0; |
1861 | $result["ERR"] = 0; |
1861 | }
|
1862 | }
|
1862 | 1863 | ||
1863 | return $result; |
1864 | return $result; |
1864 | }
|
1865 | }
|
1865 | 1866 | ||
1866 | /**
|
1867 | /**
|
1867 | * Проверка пароля (из формы авторизации)
|
1868 | * Проверка пароля (из формы авторизации)
|
1868 | *
|
1869 | *
|
1869 | * @author Alexander Wolf
|
1870 | * @author Alexander Wolf
|
1870 | * @category Core
|
1871 | * @category Core
|
1871 | *
|
1872 | *
|
1872 | * @param string $word
|
1873 | * @param string $word
|
1873 | * @return array
|
1874 | * @return array
|
1874 | */
|
1875 | */
|
1875 | public function checkSign($word) { |
1876 | public function checkSign($word) { |
1876 | $result = array(); |
1877 | $result = array(); |
1877 | 1878 | ||
1878 | $sHash = $this->secure->encryptStr($word); |
1879 | $sHash = $this->secure->encryptStr($word); |
1879 | $pwd = $this->getOption("passwd"); |
1880 | $pwd = $this->getOption("passwd"); |
1880 | if ($sHash == $pwd["OptValue"]) { |
1881 | if ($sHash == $pwd["OptValue"]) { |
1881 | $result["ERR"] = 0; |
1882 | $result["ERR"] = 0; |
1882 | $result["Location"] = "manager.php"; |
1883 | $result["Location"] = "manager.php"; |
1883 | setcookie($this->cookie, $sHash); |
1884 | setcookie($this->cookie, $sHash); |
1884 | } else { |
1885 | } else { |
1885 | $result["ERR"] = 1; |
1886 | $result["ERR"] = 1; |
1886 | $result["ERRINFO"] = "Password not valid"; |
1887 | $result["ERRINFO"] = "Password not valid"; |
1887 | $result["Location"] = "manager.php?error=1"; |
1888 | $result["Location"] = "manager.php?error=1"; |
1888 | }
|
1889 | }
|
1889 | 1890 | ||
1890 | return $result; |
1891 | return $result; |
1891 | }
|
1892 | }
|
1892 | 1893 | ||
1893 | /**
|
1894 | /**
|
1894 | * Проверка пароля (из cookies)
|
1895 | * Проверка пароля (из cookies)
|
1895 | *
|
1896 | *
|
1896 | * @author Alexander Wolf
|
1897 | * @author Alexander Wolf
|
1897 | * @category Core
|
1898 | * @category Core
|
1898 | *
|
1899 | *
|
1899 | * @param string $hash
|
1900 | * @param string $hash
|
1900 | * @return array
|
1901 | * @return array
|
1901 | */
|
1902 | */
|
1902 | public function checkCookieSign($hash) { |
1903 | public function checkCookieSign($hash) { |
1903 | $result = array(); |
1904 | $result = array(); |
1904 | 1905 | ||
1905 | $pwd = $this->getOption("passwd"); |
1906 | $pwd = $this->getOption("passwd"); |
1906 | if ($hash == $pwd["OptValue"]) { |
1907 | if ($hash == $pwd["OptValue"]) { |
1907 | $result["ERR"] = 0; |
1908 | $result["ERR"] = 0; |
1908 | } else { |
1909 | } else { |
1909 | $result["ERR"] = 1; |
1910 | $result["ERR"] = 1; |
1910 | $result["ERRINFO"] = "Hash not valid"; |
1911 | $result["ERRINFO"] = "Hash not valid"; |
1911 | $result["Location"] = "manager.php"; |
1912 | $result["Location"] = "manager.php"; |
1912 | }
|
1913 | }
|
1913 | 1914 | ||
1914 | return $result; |
1915 | return $result; |
1915 | }
|
1916 | }
|
1916 | 1917 | ||
1917 | /**
|
1918 | /**
|
1918 | * Форма ввода пароля
|
1919 | * Форма ввода пароля
|
1919 | *
|
1920 | *
|
1920 | * @author Alexander Wolf
|
1921 | * @author Alexander Wolf
|
1921 | * @category Core
|
1922 | * @category Core
|
1922 | *
|
1923 | *
|
1923 | * @return string
|
1924 | * @return string
|
1924 | */
|
1925 | */
|
1925 | public function showSigninForm() { |
1926 | public function showSigninForm() { |
1926 | $show = "<div id='regform'>"; |
1927 | $show = "<div id='regform'>"; |
1927 | $show .= "<form action='process.php' method='post'>\n"; |
1928 | $show .= "<form action='process.php' method='post'>\n"; |
1928 | $show .= "<fieldset><legend>Пароль</legend>\n"; |
1929 | $show .= "<fieldset><legend>Пароль</legend>\n"; |
1929 | $show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
1930 | $show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
1930 | $show .= "<input type='password' name='word' value=''>\n"; |
1931 | $show .= "<input type='password' name='word' value=''>\n"; |
1931 | $show .= "<input type='submit' value=' Войти '>\n"; |
1932 | $show .= "<input type='submit' value=' Войти '>\n"; |
1932 | $show .= "</fieldset>\n</form></div>\n"; |
1933 | $show .= "</fieldset>\n</form></div>\n"; |
1933 | 1934 | ||
1934 | return $show; |
1935 | return $show; |
1935 | }
|
1936 | }
|
1936 | 1937 | ||
1937 | /**
|
1938 | /**
|
1938 | * Обновление пароля
|
1939 | * Обновление пароля
|
1939 | *
|
1940 | *
|
1940 | * @author Alexander Wolf
|
1941 | * @author Alexander Wolf
|
1941 | * @category Core
|
1942 | * @category Core
|
1942 | *
|
1943 | *
|
1943 | * @param string $word1
|
1944 | * @param string $word1
|
1944 | * @param string $word2
|
1945 | * @param string $word2
|
1945 | * @return array
|
1946 | * @return array
|
1946 | */
|
1947 | */
|
1947 | public function updatePassword($word1, $word2) { |
1948 | public function updatePassword($word1, $word2) { |
1948 | $result = array(); |
1949 | $result = array(); |
1949 | 1950 | ||
1950 | if ($word1 == $word2) { |
1951 | if ($word1 == $word2) { |
1951 | $sWord = $this->secure->encryptStr($word1); |
1952 | $sWord = $this->secure->encryptStr($word1); |
1952 | $r = $this->setOption("passwd", $sWord); |
1953 | $r = $this->setOption("passwd", $sWord); |
1953 | $result = $r; |
1954 | $result = $r; |
1954 | } else { |
1955 | } else { |
1955 | $result["ERR"] = 1; |
1956 | $result["ERR"] = 1; |
1956 | $result["ERRINFO"] = "Passwords is mismatch"; |
1957 | $result["ERRINFO"] = "Passwords is mismatch"; |
1957 | }
|
1958 | }
|
1958 | 1959 | ||
1959 | return $result; |
1960 | return $result; |
1960 | }
|
1961 | }
|
1961 | 1962 | ||
1962 | /**
|
1963 | /**
|
1963 | * Отображение формы создания и редактирования версии apt-дистрибутива
|
1964 | * Отображение формы создания и редактирования версии apt-дистрибутива
|
1964 | *
|
1965 | *
|
1965 | * @author Alexander Wolf
|
1966 | * @author Alexander Wolf
|
1966 | * @category Core
|
1967 | * @category Core
|
1967 | *
|
1968 | *
|
1968 | * @param string $name
|
1969 | * @param string $name
|
1969 | * @param string $actor
|
1970 | * @param string $actor
|
1970 | * @param integer $versionID
|
1971 | * @param integer $versionID
|
1971 | * @return string
|
1972 | * @return string
|
1972 | */
|
1973 | */
|
1973 | public function showDistVersionsForm($versionID = 0, $info = '') { |
1974 | public function showDistVersionsForm($versionID = 0, $info = '') { |
1974 | $sVersionID = $this->secure->checkInt($versionID); |
1975 | $sVersionID = $this->secure->checkInt($versionID); |
1975 | $sInfo = $this->secure->checkStr($info, 1); |
1976 | $sInfo = $this->secure->checkStr($info, 1); |
1976 | if ($sInfo == "") { |
1977 | if ($sInfo == "") { |
1977 | $sInfo = "Версия дистрибутива"; |
1978 | $sInfo = "Версия дистрибутива"; |
1978 | }
|
1979 | }
|
1979 | if ($sVersionID != 0) { |
1980 | if ($sVersionID != 0) { |
1980 | // Режим редактирования
|
1981 | // Режим редактирования
|
1981 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id WHERE v.version_id='".$sVersionID."'"; |
1982 | $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id WHERE v.version_id='".$sVersionID."'"; |
1982 | $rq =& $this->db->query($query); |
1983 | $rq =& $this->db->query($query); |
1983 | $rq->fetchInto($element); |
1984 | $rq->fetchInto($element); |
1984 | }
|
1985 | }
|
1985 | 1986 | ||
1986 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1987 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
1987 | if ($sVersionID != 0) { |
1988 | if ($sVersionID != 0) { |
1988 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n"; |
1989 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n"; |
1989 | } else { |
1990 | } else { |
1990 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> ".$this->showDistributionList("distname", "", "", "innerhtml")."</div>\n"; |
1991 | $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> ".$this->showDistributionList("distname", "", "", "innerhtml")."</div>\n"; |
1991 | }
|
1992 | }
|
1992 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."'></div>\n"; |
1993 | $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."'></div>\n"; |
1993 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."'></div>\n"; |
1994 | $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."'></div>\n"; |
1994 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."'></div>\n"; |
1995 | $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."'></div>\n"; |
1995 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n"; |
1996 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n"; |
1996 | 1997 | ||
1997 | return $show; |
1998 | return $show; |
1998 | }
|
1999 | }
|
1999 | 2000 | ||
2000 | /**
|
2001 | /**
|
2001 | * Парсер схемы адреса репозитория
|
2002 | * Парсер схемы адреса репозитория
|
2002 | * FIXME Возможно не потребуется
|
2003 | * FIXME Возможно не потребуется
|
2003 | *
|
2004 | *
|
2004 | * @author Alexander Wolf
|
2005 | * @author Alexander Wolf
|
2005 | * @category Core
|
2006 | * @category Core
|
2006 | *
|
2007 | *
|
2007 | * @param string $repstring
|
2008 | * @param string $repstring
|
2008 | * @return integer
|
2009 | * @return integer
|
2009 | */
|
2010 | */
|
2010 | public function repositoryParser($repstring) { |
2011 | public function repositoryParser($repstring) { |
2011 | $tokens = array(); |
2012 | $tokens = array(); |
2012 | $sections = array(); |
2013 | $sections = array(); |
2013 | $tokens = split(" ",$repstring); |
2014 | $tokens = split(" ",$repstring); |
2014 | 2015 | ||
2015 | if ($tokens[0] == "deb") { |
2016 | if ($tokens[0] == "deb") { |
2016 | // debian/ubuntu репозиторий "type proto://host/folder distr sections"
|
2017 | // debian/ubuntu репозиторий "type proto://host/folder distr sections"
|
2017 | $url = parse_url($tokens[1]); |
2018 | $url = parse_url($tokens[1]); |
2018 | $distr = $tokens[2]; |
2019 | $distr = $tokens[2]; |
2019 | 2020 | ||
2020 | for($i=3;$i<count($tokens);$i++) { |
2021 | for($i=3;$i<count($tokens);$i++) { |
2021 | $sections[] = $tokens[$i]; |
2022 | $sections[] = $tokens[$i]; |
2022 | }
|
2023 | }
|
2023 | } else { |
2024 | } else { |
2024 | // altlinux репозиторий "type [sign] proto://host/folder base repname"
|
2025 | // altlinux репозиторий "type [sign] proto://host/folder base repname"
|
2025 | if (stripos($tokens[1],"]")!=0) { |
2026 | if (stripos($tokens[1],"]")!=0) { |
2026 | $sign = $tokens[1]; |
2027 | $sign = $tokens[1]; |
2027 | $url = parse_url($tokens[2]); |
2028 | $url = parse_url($tokens[2]); |
2028 | $base = $tokens[3]; |
2029 | $base = $tokens[3]; |
2029 | $repname = $tokens[4]; |
2030 | $repname = $tokens[4]; |
2030 | } else { |
2031 | } else { |
2031 | $url = parse_url($tokens[1]); |
2032 | $url = parse_url($tokens[1]); |
2032 | $base = $tokens[2]; |
2033 | $base = $tokens[2]; |
2033 | $repname = $tokens[3]; |
2034 | $repname = $tokens[3]; |
2034 | }
|
2035 | }
|
2035 | }
|
2036 | }
|
2036 | 2037 | ||
2037 | $proto = $url["scheme"]."://"; |
2038 | $proto = $url["scheme"]."://"; |
2038 | $addr = $url["host"]; |
2039 | $addr = $url["host"]; |
2039 | if ($url["port"]!="") { |
2040 | if ($url["port"]!="") { |
2040 | $addr .= ":".$url["port"]; |
2041 | $addr .= ":".$url["port"]; |
2041 | }
|
2042 | }
|
2042 | $path = $url["path"]; |
2043 | $path = $url["path"]; |
2043 | 2044 | ||
2044 | return 0; |
2045 | return 0; |
2045 | }
|
2046 | }
|
2046 | 2047 | ||
2047 | /**
|
2048 | /**
|
2048 | * Выгрузка картинок логотипов дистрибутивов
|
2049 | * Выгрузка картинок логотипов дистрибутивов
|
2049 | *
|
2050 | *
|
2050 | * @author Alexander Wolf
|
2051 | * @author Alexander Wolf
|
2051 | * @category Core
|
2052 | * @category Core
|
2052 | *
|
2053 | *
|
2053 | * @param string $path
|
2054 | * @param string $path
|
2054 | * @param string $dist
|
2055 | * @param string $dist
|
2055 | * @param array $datafile
|
2056 | * @param array $datafile
|
2056 | * @return integer
|
2057 | * @return integer
|
2057 | */
|
2058 | */
|
2058 | public function uploadPicture($path, $dist, $datafile) { |
2059 | public function uploadPicture($path, $dist, $datafile) { |
2059 | $folder = $path.$dist."-orig.png"; |
2060 | $folder = $path.$dist."-orig.png"; |
2060 | $folderN = $path.$dist.".png"; |
2061 | $folderN = $path.$dist.".png"; |
2061 | $folderEM = $path.$dist."-em.png"; |
2062 | $folderEM = $path.$dist."-em.png"; |
2062 | 2063 | ||
2063 | $distlogo = 0; |
2064 | $distlogo = 0; |
2064 | if (move_uploaded_file($datafile["distlogo"]["tmp_name"],$folder)) { |
2065 | if (move_uploaded_file($datafile["distlogo"]["tmp_name"],$folder)) { |
2065 | chmod($folder, 0644); |
2066 | chmod($folder, 0644); |
2066 | list($width, $height) = GetImageSize($folder); |
2067 | list($width, $height) = GetImageSize($folder); |
2067 | $percent = 32/$height; |
2068 | $percent = 32/$height; |
2068 | $newwidth = $width * $percent; |
2069 | $newwidth = $width * $percent; |
2069 | $newheight = $height * $percent; |
2070 | $newheight = $height * $percent; |
2070 | 2071 | ||
2071 | $output = ImageCreateTrueColor($newwidth, $newheight); |
2072 | $output = ImageCreateTrueColor($newwidth, $newheight); |
2072 | $source = ImageCreateFromPNG($folder); |
2073 | $source = ImageCreateFromPNG($folder); |
2073 | 2074 | ||
2074 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
2075 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
2075 | ImagePNG($output, $folderEM); |
2076 | ImagePNG($output, $folderEM); |
2076 | 2077 | ||
2077 | $percent = 15/$height; |
2078 | $percent = 15/$height; |
2078 | $newwidth = $width * $percent; |
2079 | $newwidth = $width * $percent; |
2079 | $newheight = $height * $percent; |
2080 | $newheight = $height * $percent; |
2080 | 2081 | ||
2081 | $output = ImageCreateTrueColor($newwidth, $newheight); |
2082 | $output = ImageCreateTrueColor($newwidth, $newheight); |
2082 | 2083 | ||
2083 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
2084 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
2084 | ImagePNG($output, $folderN); |
2085 | ImagePNG($output, $folderN); |
2085 | 2086 | ||
2086 | unlink($folder); |
2087 | unlink($folder); |
2087 | $distlogo = 1; |
2088 | $distlogo = 1; |
2088 | }
|
2089 | }
|
2089 | return $distlogo; |
2090 | return $distlogo; |
2090 | }
|
2091 | }
|
2091 | 2092 | ||
2092 | /**
|
2093 | /**
|
2093 | * Показ списка репозиториев
|
2094 | * Показ списка репозиториев
|
2094 | *
|
2095 | *
|
2095 | * @author Alexander Wolf
|
2096 | * @author Alexander Wolf
|
2096 | * @category Core
|
2097 | * @category Core
|
2097 | *
|
2098 | *
|
2098 | * @param string $name
|
2099 | * @param string $name
|
2099 | * @param string $actor
|
2100 | * @param string $actor
|
2100 | * @param string $format
|
2101 | * @param string $format
|
2101 | * @return string
|
2102 | * @return string
|
2102 | */
|
2103 | */
|
2103 | public function showRepositoriesList($name, $actor, $format = 'list') { |
2104 | public function showRepositoriesList($name, $actor, $format = 'list') { |
2104 | $query = "SELECT r.*,rt.*,v.version_id,CONCAT(d.distname,' ',v.version,' “',v.vname,'”') AS fullname FROM ".$this->prefix."repository r "; |
2105 | $query = "SELECT r.*,rt.*,v.version_id,CONCAT(d.distname,' ',v.version,' “',v.vname,'”') AS fullname FROM ".$this->prefix."repository r "; |
2105 | $query .= "JOIN ".$this->prefix."rtype rt ON rt.rtype_id=r.rtype_id "; |
2106 | $query .= "JOIN ".$this->prefix."rtype rt ON rt.rtype_id=r.rtype_id "; |
2106 | $query .= "JOIN ".$this->prefix."version v ON v.version_id=r.version "; |
2107 | $query .= "JOIN ".$this->prefix."version v ON v.version_id=r.version "; |
2107 | $query .= "JOIN ".$this->prefix."distribution d ON d.dist_id=v.dist_id "; |
2108 | $query .= "JOIN ".$this->prefix."distribution d ON d.dist_id=v.dist_id "; |
2108 | $query .= "ORDER BY v.version_id,r.rep_id ASC"; |
2109 | $query .= "ORDER BY v.version_id,r.rep_id ASC"; |
2109 | $rq =& $this->db->query($query); |
2110 | $rq =& $this->db->query($query); |
2110 | $show = "<ul><li class='nomarker'></li>"; |
2111 | $show = "<ul><li class='nomarker'></li>"; |
2111 | $splitter = 0; |
2112 | $splitter = 0; |
2112 | while ($rq->fetchInto($element)) { |
2113 | while ($rq->fetchInto($element)) { |
2113 | if ($splitter != $this->secure->checkInt($element["version_id"])) { |
2114 | if ($splitter != $this->secure->checkInt($element["version_id"])) { |
2114 | $splitter = $this->secure->checkInt($element["version_id"]); |
2115 | $splitter = $this->secure->checkInt($element["version_id"]); |
2115 | $show .= "</ul><ul><li class='nomarker'><strong>Репозитории для ".$this->secure->checkStr($element["fullname"],1)."</strong></li>"; |
2116 | $show .= "</ul><ul><li class='nomarker'><strong>Репозитории для ".$this->secure->checkStr($element["fullname"],1)."</strong></li>"; |
2116 | }
|
2117 | }
|
2117 | $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"; |
2118 | $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"; |
2118 | }
|
2119 | }
|
2119 | $show .= "</ul>"; |
2120 | $show .= "</ul>"; |
2120 | return $show; |
2121 | return $show; |
2121 | }
|
2122 | }
|
2122 | 2123 | ||
2123 | /**
|
2124 | /**
|
2124 | * Вывод списка типов репозиториев
|
2125 | * Вывод списка типов репозиториев
|
2125 | *
|
2126 | *
|
2126 | * @author Alexander Wolf
|
2127 | * @author Alexander Wolf
|
2127 | * @category Core
|
2128 | * @category Core
|
2128 | *
|
2129 | *
|
2129 | * @param integer $reptype
|
2130 | * @param integer $reptype
|
2130 | * @param string $name
|
2131 | * @param string $name
|
2131 | * @return string
|
2132 | * @return string
|
2132 | */
|
2133 | */
|
2133 | public function showRepType($reptype = 0, $name = "") { |
2134 | public function showRepType($reptype = 0, $name = "") { |
2134 | $sRT = $this->secure->checkInt($reptype); |
2135 | $sRT = $this->secure->checkInt($reptype); |
2135 | $sNM = $this->secure->checkStr($name,1); |
2136 | $sNM = $this->secure->checkStr($name,1); |
2136 | $query = "SELECT * FROM ".$this->prefix."rtype"; |
2137 | $query = "SELECT * FROM ".$this->prefix."rtype"; |
2137 | $rq =& $this->db->query($query); |
2138 | $rq =& $this->db->query($query); |
2138 | $show = "<select name='".$sNM."' id='".$sNM."'>\n"; |
2139 | $show = "<select name='".$sNM."' id='".$sNM."'>\n"; |
2139 | while ($rq->fetchInto($element)) { |
2140 | while ($rq->fetchInto($element)) { |
2140 | if ($element["rtype_id"]==$sRT) { |
2141 | if ($element["rtype_id"]==$sRT) { |
2141 | $show .= "<option value='".$this->secure->checkInt($element["rtype_id"])."' selected>".$this->secure->checkStr($element["rtype"],1)."</option>\n"; |
2142 | $show .= "<option value='".$this->secure->checkInt($element["rtype_id"])."' selected>".$this->secure->checkStr($element["rtype"],1)."</option>\n"; |
2142 | } else { |
2143 | } else { |
2143 | $show .= "<option value='".$this->secure->checkInt($element["rtype_id"])."'>".$this->secure->checkStr($element["rtype"],1)."</option>\n"; |
2144 | $show .= "<option value='".$this->secure->checkInt($element["rtype_id"])."'>".$this->secure->checkStr($element["rtype"],1)."</option>\n"; |
2144 | }
|
2145 | }
|
2145 | }
|
2146 | }
|
2146 | $show .= "</select>"; |
2147 | $show .= "</select>"; |
2147 | 2148 | ||
2148 | return $show; |
2149 | return $show; |
2149 | }
|
2150 | }
|
2150 | 2151 | ||
2151 | /**
|
2152 | /**
|
2152 | * Вывод списка версий дистрибутивов
|
2153 | * Вывод списка версий дистрибутивов
|
2153 | *
|
2154 | *
|
2154 | * @author Alexander Wolf
|
2155 | * @author Alexander Wolf
|
2155 | * @category Core
|
2156 | * @category Core
|
2156 | *
|
2157 | *
|
2157 | * @param string $name
|
2158 | * @param string $name
|
2158 | * @param integer $versionID
|
2159 | * @param integer $versionID
|
2159 | * @return string
|
2160 | * @return string
|
2160 | */
|
2161 | */
|
2161 | public function showVDList($name, $versionID = 0) { |
2162 | public function showVDList($name, $versionID = 0) { |
2162 | $query = "SELECT v.version_id, CONCAT(d.distname, ' ', v.version, ' ', v.vname) AS fullname FROM ".$this->prefix."version v "; |
2163 | $query = "SELECT v.version_id, CONCAT(d.distname, ' ', v.version, ' ', v.vname) AS fullname FROM ".$this->prefix."version v "; |
2163 | $query .= "JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id"; |
2164 | $query .= "JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id"; |
2164 | $rq =& $this->db->query($query); |
2165 | $rq =& $this->db->query($query); |
2165 | $show = "<select name='".$name."' id='".$name."'>\n"; |
2166 | $show = "<select name='".$name."' id='".$name."'>\n"; |
2166 | while ($rq->fetchInto($element)) { |
2167 | while ($rq->fetchInto($element)) { |
2167 | if ($element["version_id"]==$versionID) { |
2168 | if ($element["version_id"]==$versionID) { |
2168 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."' selected>".$this->secure->checkStr($element["fullname"],1)."</option>\n"; |
2169 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."' selected>".$this->secure->checkStr($element["fullname"],1)."</option>\n"; |
2169 | } else { |
2170 | } else { |
2170 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["fullname"],1)."</option>\n"; |
2171 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["fullname"],1)."</option>\n"; |
2171 | }
|
2172 | }
|
2172 | }
|
2173 | }
|
2173 | $show .= "</select>"; |
2174 | $show .= "</select>"; |
2174 | return $show; |
2175 | return $show; |
2175 | }
|
2176 | }
|
2176 | 2177 | ||
2177 | /**
|
2178 | /**
|
2178 | * Форма создания/редактирвоания репозиториев
|
2179 | * Форма создания/редактирвоания репозиториев
|
2179 | *
|
2180 | *
|
2180 | * @author Alexander Wolf
|
2181 | * @author Alexander Wolf
|
2181 | * @category Core
|
2182 | * @category Core
|
2182 | *
|
2183 | *
|
2183 | * @param integer $repID
|
2184 | * @param integer $repID
|
2184 | * @param string $info
|
2185 | * @param string $info
|
2185 | * @param string $reptype
|
2186 | * @param string $reptype
|
2186 | * @return string
|
2187 | * @return string
|
2187 | */
|
2188 | */
|
2188 | public function showRepositoriesForm($repID = 0, $info = "") { |
2189 | public function showRepositoriesForm($repID = 0, $info = "") { |
2189 | $sRepID = $this->secure->checkInt($repID); |
2190 | $sRepID = $this->secure->checkInt($repID); |
2190 | $sInfo = $this->secure->checkStr($info, 1); |
2191 | $sInfo = $this->secure->checkStr($info, 1); |
2191 | if ($sInfo == "") { |
2192 | if ($sInfo == "") { |
2192 | $sInfo = "Репозиторий"; |
2193 | $sInfo = "Репозиторий"; |
2193 | }
|
2194 | }
|
2194 | if ($sRepID != 0) { |
2195 | if ($sRepID != 0) { |
2195 | // Режим редактирования
|
2196 | // Режим редактирования
|
2196 | $query = "SELECT r.*,v.*,d.dist_id,dt.type FROM ".$this->prefix."repository r "; |
2197 | $query = "SELECT r.*,v.*,d.dist_id,dt.type FROM ".$this->prefix."repository r "; |
2197 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
2198 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
2198 | $query .= "JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id "; |
2199 | $query .= "JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id "; |
2199 | $query .= "JOIN ".$this->prefix."dtype dt ON d.disttype=dt.type_id "; |
2200 | $query .= "JOIN ".$this->prefix."dtype dt ON d.disttype=dt.type_id "; |
2200 | $query .= "WHERE r.rep_id='".$sRepID."'"; |
2201 | $query .= "WHERE r.rep_id='".$sRepID."'"; |
2201 | $rq =& $this->db->query($query); |
2202 | $rq =& $this->db->query($query); |
2202 | $rq->fetchInto($element); |
2203 | $rq->fetchInto($element); |
2203 | }
|
2204 | }
|
2204 | 2205 | ||
2205 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
2206 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
2206 | $show .= "<div class='inputbox'><label for='rdist'>Дистрибутив:</label> ".$this->showVDList("rdist",$this->secure->checkInt($element["version_id"]),"innerhtml")."</div>\n"; |
2207 | $show .= "<div class='inputbox'><label for='rdist'>Дистрибутив:</label> ".$this->showVDList("rdist",$this->secure->checkInt($element["version_id"]),"innerhtml")."</div>\n"; |
2207 | $show .= "<div class='inputbox'><label for='rname'>Название репозитория:</label> <input type='text' name='rname' value=\"".$this->secure->checkStr($element["repname"],1)."\"></div>\n"; |
2208 | $show .= "<div class='inputbox'><label for='rname'>Название репозитория:</label> <input type='text' name='rname' value=\"".$this->secure->checkStr($element["repname"],1)."\"></div>\n"; |
2208 | $show .= "<div class='inputbox'><label for='rinfo'>Описание репозитория:</label> <input type='text' name='rinfo' value=\"".$this->secure->checkStr($element["repinfo"],1)."\"></div>\n"; |
2209 | $show .= "<div class='inputbox'><label for='rinfo'>Описание репозитория:</label> <input type='text' name='rinfo' value=\"".$this->secure->checkStr($element["repinfo"],1)."\"></div>\n"; |
2209 | $show .= "<div class='inputbox'><label for='rkey'>Ключ подписи репозитория:</label> <input type='text' name='rkey' value=\"".$this->secure->checkStr($element["repkey"],1)."\"></div>\n"; |
2210 | $show .= "<div class='inputbox'><label for='rkey'>Ключ подписи репозитория:</label> <input type='text' name='rkey' value=\"".$this->secure->checkStr($element["repkey"],1)."\"></div>\n"; |
2210 | $show .= "<div class='inputbox'><label for='rproto'>Протокол доступа:</label> ".$this->showProtoList("rproto",$this->secure->checkInt($element["proto_id"]),"innerhtml")."</div>\n"; |
2211 | $show .= "<div class='inputbox'><label for='rproto'>Протокол доступа:</label> ".$this->showProtoList("rproto",$this->secure->checkInt($element["proto_id"]),"innerhtml")."</div>\n"; |
2211 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> ".$this->showHostsList("rhost",$this->secure->checkInt($element["rhost_id"]),"innerhtml")."</div>\n"; |
2212 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> ".$this->showHostsList("rhost",$this->secure->checkInt($element["rhost_id"]),"innerhtml")."</div>\n"; |
2212 | $show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> ".$this->showFoldersList("rfolder",$this->secure->checkInt($element["rfolder_id"]),"innerhtml")."</div>\n"; |
2213 | $show .= "<div class='inputbox'><label for='rfolder'>Корневая папка:</label> ".$this->showFoldersList("rfolder",$this->secure->checkInt($element["rfolder_id"]),"innerhtml")."</div>\n"; |
2213 | $show .= "<div class='inputbox'><label for='rtype'>Тип репозитория:</label> ".$this->showRepType($this->secure->checkInt($element["rtype_id"]), "rtype")."</div>\n"; |
2214 | $show .= "<div class='inputbox'><label for='rtype'>Тип репозитория:</label> ".$this->showRepType($this->secure->checkInt($element["rtype_id"]), "rtype")."</div>\n"; |
2214 | $show .= "<div class='inputbox'><label for='rsects'>Секции репозитория:</label> <div class='formwrapper'>".$this->showSectionsList("rsects",$sRepID,"innerhtml")."</div></div>\n"; |
2215 | $show .= "<div class='inputbox'><label for='rsects'>Секции репозитория:</label> <div class='formwrapper'>".$this->showSectionsList("rsects",$sRepID,"innerhtml")."</div></div>\n"; |
2215 | $show .= "<div class='inputbox'><label for='rarchs'>Архитектуры:</label> <div class='formwrapper'>".$this->showArchList("rarchs",$sRepID,"innerhtml")."</div></div>\n"; |
2216 | $show .= "<div class='inputbox'><label for='rarchs'>Архитектуры:</label> <div class='formwrapper'>".$this->showArchList("rarchs",$sRepID,"innerhtml")."</div></div>\n"; |
2216 | $show .= "<div class='inputbox'><label for='rscheme'>Схема репозитория:</label> ".$this->showSchemeList("rscheme",$this->secure->checkInt($element["scheme_id"]),"innerhtml")."</div>\n"; |
2217 | $show .= "<div class='inputbox'><label for='rscheme'>Схема репозитория:</label> ".$this->showSchemeList("rscheme",$this->secure->checkInt($element["scheme_id"]),"innerhtml")."</div>\n"; |
2217 | $show .= "<div class='inputbox'><label for='rsign'>Подпись репозитория:</label> ".$this->showSignsList("rsign",$this->secure->checkInt($element["sign_id"]),"innerhtml")."</div>\n"; |
2218 | $show .= "<div class='inputbox'><label for='rsign'>Подпись репозитория:</label> ".$this->showSignsList("rsign",$this->secure->checkInt($element["sign_id"]),"innerhtml")."</div>\n"; |
2218 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n"; |
2219 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n"; |
2219 | 2220 | ||
2220 | return $show; |
2221 | return $show; |
2221 | }
|
2222 | }
|
2222 | 2223 | ||
2223 | /**
|
2224 | /**
|
2224 | * Добавление нового репозитория
|
2225 | * Добавление нового репозитория
|
2225 | *
|
2226 | *
|
2226 | * @author Alexander Wolf
|
2227 | * @author Alexander Wolf
|
2227 | * @category Core
|
2228 | * @category Core
|
2228 | *
|
2229 | *
|
2229 | * @param integer $verionID
|
2230 | * @param integer $verionID
|
2230 | * @param string $rname
|
2231 | * @param string $rname
|
2231 | * @param string $rinfo
|
2232 | * @param string $rinfo
|
2232 | * @param string $rkey
|
2233 | * @param string $rkey
|
2233 | * @param integer $proto
|
2234 | * @param integer $proto
|
2234 | * @param integer $rhost
|
2235 | * @param integer $rhost
|
2235 | * @param integer $rfolder
|
2236 | * @param integer $rfolder
|
2236 | * @param integer $rtype
|
2237 | * @param integer $rtype
|
2237 | * @param array $sections
|
2238 | * @param array $sections
|
2238 | * @param array $arch
|
2239 | * @param array $arch
|
2239 | * @param integer $scheme
|
2240 | * @param integer $scheme
|
2240 | * @param integer $sign
|
2241 | * @param integer $sign
|
2241 | * @return array
|
2242 | * @return array
|
2242 | */
|
2243 | */
|
2243 | public function addRepository($verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) { |
2244 | public function addRepository($verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) { |
2244 | $result = array(); |
2245 | $result = array(); |
2245 | $sVersionID = $this->secure->checkInt($verionID); |
2246 | $sVersionID = $this->secure->checkInt($verionID); |
2246 | $sRName = $this->secure->checkStr($rname); |
2247 | $sRName = $this->secure->checkStr($rname); |
2247 | $sRInfo = $this->secure->checkStr($rinfo); |
2248 | $sRInfo = $this->secure->checkStr($rinfo); |
2248 | $sRKey = $this->secure->checkStr($rkey); |
2249 | $sRKey = $this->secure->checkStr($rkey); |
2249 | $sProto = $this->secure->checkInt($proto); |
2250 | $sProto = $this->secure->checkInt($proto); |
2250 | $sRHost = $this->secure->checkInt($rhost); |
2251 | $sRHost = $this->secure->checkInt($rhost); |
2251 | $sRFolder = $this->secure->checkInt($rfolder); |
2252 | $sRFolder = $this->secure->checkInt($rfolder); |
2252 | $sRType = $this->secure->checkInt($rtype); |
2253 | $sRType = $this->secure->checkInt($rtype); |
2253 | $sRScheme = $this->secure->checkInt($scheme); |
2254 | $sRScheme = $this->secure->checkInt($scheme); |
2254 | $sRSign = $this->secure->checkInt($sign); |
2255 | $sRSign = $this->secure->checkInt($sign); |
2255 | 2256 | ||
2256 | $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."'"; |
2257 | $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."'"; |
2257 | $rq =& $this->db->query($query); |
2258 | $rq =& $this->db->query($query); |
2258 | 2259 | ||
2259 | $query = "SELECT rep_id FROM ".$this->prefix."repository ORDER BY rep_id DESC LIMIT 0, 1"; |
2260 | $query = "SELECT rep_id FROM ".$this->prefix."repository ORDER BY rep_id DESC LIMIT 0, 1"; |
2260 | $rq =& $this->db->query($query); |
2261 | $rq =& $this->db->query($query); |
2261 | $rq->fetchInto($repository); |
2262 | $rq->fetchInto($repository); |
2262 | 2263 | ||
2263 | for($i=0;$i<count($sections);$i++) { |
2264 | for($i=0;$i<count($sections);$i++) { |
2264 | $query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$repository["rep_id"]."', sect_id='".$sections[$i]."'"; |
2265 | $query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$repository["rep_id"]."', sect_id='".$sections[$i]."'"; |
2265 | $rq =& $this->db->query($query); |
2266 | $rq =& $this->db->query($query); |
2266 | }
|
2267 | }
|
2267 | 2268 | ||
2268 | for($i=0;$i<count($arch);$i++) { |
2269 | for($i=0;$i<count($arch);$i++) { |
2269 | $query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$repository["rep_id"]."', arch_id='".$arch[$i]."'"; |
2270 | $query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$repository["rep_id"]."', arch_id='".$arch[$i]."'"; |
2270 | $rq =& $this->db->query($query); |
2271 | $rq =& $this->db->query($query); |
2271 | }
|
2272 | }
|
2272 | 2273 | ||
2273 | if (PEAR::isError($this->db)) { |
2274 | if (PEAR::isError($this->db)) { |
2274 | $result["ERR"] = 1; |
2275 | $result["ERR"] = 1; |
2275 | $result["ERRINFO"] = $this->db->getMessage(); |
2276 | $result["ERRINFO"] = $this->db->getMessage(); |
2276 | } else { |
2277 | } else { |
2277 | $result["ERR"] = 0; |
2278 | $result["ERR"] = 0; |
2278 | }
|
2279 | }
|
2279 | 2280 | ||
2280 | return $result; |
2281 | return $result; |
2281 | }
|
2282 | }
|
2282 | 2283 | ||
2283 | /**
|
2284 | /**
|
2284 | * Обновление информации о репозитории
|
2285 | * Обновление информации о репозитории
|
2285 | *
|
2286 | *
|
2286 | * @author Alexander Wolf
|
2287 | * @author Alexander Wolf
|
2287 | * @category Core
|
2288 | * @category Core
|
2288 | *
|
2289 | *
|
2289 | * @param integer $repID
|
2290 | * @param integer $repID
|
2290 | * @param integer $verionID
|
2291 | * @param integer $verionID
|
2291 | * @param string $rname
|
2292 | * @param string $rname
|
2292 | * @param string $rinfo
|
2293 | * @param string $rinfo
|
2293 | * @param string $rkey
|
2294 | * @param string $rkey
|
2294 | * @param integer $proto
|
2295 | * @param integer $proto
|
2295 | * @param integer $rhost
|
2296 | * @param integer $rhost
|
2296 | * @param integer $rfolder
|
2297 | * @param integer $rfolder
|
2297 | * @param integer $rtype
|
2298 | * @param integer $rtype
|
2298 | * @param array $sections
|
2299 | * @param array $sections
|
2299 | * @param array $arch
|
2300 | * @param array $arch
|
2300 | * @param integer $scheme
|
2301 | * @param integer $scheme
|
2301 | * @param integer $sign
|
2302 | * @param integer $sign
|
2302 | * @return array
|
2303 | * @return array
|
2303 | */
|
2304 | */
|
2304 | public function updateRepository($repID, $verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) { |
2305 | public function updateRepository($repID, $verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) { |
2305 | $result = array(); |
2306 | $result = array(); |
2306 | $sRepID = $this->secure->checkInt($repID); |
2307 | $sRepID = $this->secure->checkInt($repID); |
2307 | $sVersionID = $this->secure->checkInt($verionID); |
2308 | $sVersionID = $this->secure->checkInt($verionID); |
2308 | $sRName = $this->secure->checkStr($rname); |
2309 | $sRName = $this->secure->checkStr($rname); |
2309 | $sRInfo = $this->secure->checkStr($rinfo); |
2310 | $sRInfo = $this->secure->checkStr($rinfo); |
2310 | $sRKey = $this->secure->checkStr($rkey); |
2311 | $sRKey = $this->secure->checkStr($rkey); |
2311 | $sProto = $this->secure->checkInt($proto); |
2312 | $sProto = $this->secure->checkInt($proto); |
2312 | $sRHost = $this->secure->checkInt($rhost); |
2313 | $sRHost = $this->secure->checkInt($rhost); |
2313 | $sRFolder = $this->secure->checkInt($rfolder); |
2314 | $sRFolder = $this->secure->checkInt($rfolder); |
2314 | $sRType = $this->secure->checkInt($rtype); |
2315 | $sRType = $this->secure->checkInt($rtype); |
2315 | $sRScheme = $this->secure->checkInt($scheme); |
2316 | $sRScheme = $this->secure->checkInt($scheme); |
2316 | $sRSign = $this->secure->checkInt($sign); |
2317 | $sRSign = $this->secure->checkInt($sign); |
2317 | 2318 | ||
2318 | $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."'"; |
2319 | $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."'"; |
2319 | $rq =& $this->db->query($query); |
2320 | $rq =& $this->db->query($query); |
2320 | 2321 | ||
2321 | $query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'"; |
2322 | $query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'"; |
2322 | $rq =& $this->db->query($query); |
2323 | $rq =& $this->db->query($query); |
2323 | for($i=0;$i<count($sections);$i++) { |
2324 | for($i=0;$i<count($sections);$i++) { |
2324 | $query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$sRepID."', sect_id='".$sections[$i]."'"; |
2325 | $query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$sRepID."', sect_id='".$sections[$i]."'"; |
2325 | $rq =& $this->db->query($query); |
2326 | $rq =& $this->db->query($query); |
2326 | }
|
2327 | }
|
2327 | 2328 | ||
2328 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'"; |
2329 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'"; |
2329 | $rq =& $this->db->query($query); |
2330 | $rq =& $this->db->query($query); |
2330 | for($i=0;$i<count($arch);$i++) { |
2331 | for($i=0;$i<count($arch);$i++) { |
2331 | $query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$sRepID."', arch_id='".$arch[$i]."'"; |
2332 | $query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$sRepID."', arch_id='".$arch[$i]."'"; |
2332 | $rq =& $this->db->query($query); |
2333 | $rq =& $this->db->query($query); |
2333 | }
|
2334 | }
|
2334 | 2335 | ||
2335 | if (PEAR::isError($this->db)) { |
2336 | if (PEAR::isError($this->db)) { |
2336 | $result["ERR"] = 1; |
2337 | $result["ERR"] = 1; |
2337 | $result["ERRINFO"] = $this->db->getMessage(); |
2338 | $result["ERRINFO"] = $this->db->getMessage(); |
2338 | } else { |
2339 | } else { |
2339 | $result["ERR"] = 0; |
2340 | $result["ERR"] = 0; |
2340 | }
|
2341 | }
|
2341 | 2342 | ||
2342 | return $result; |
2343 | return $result; |
2343 | }
|
2344 | }
|
2344 | 2345 | ||
2345 | /**
|
2346 | /**
|
2346 | * Удаление информации о репозитории
|
2347 | * Удаление информации о репозитории
|
2347 | *
|
2348 | *
|
2348 | * @author Alexander Wolf
|
2349 | * @author Alexander Wolf
|
2349 | * @category Core
|
2350 | * @category Core
|
2350 | *
|
2351 | *
|
2351 | * @param integer $repID
|
2352 | * @param integer $repID
|
2352 | * @return array
|
2353 | * @return array
|
2353 | */
|
2354 | */
|
2354 | public function dropRepository($repID) { |
2355 | public function dropRepository($repID) { |
2355 | $result = array(); |
2356 | $result = array(); |
2356 | $sRepID = $this->secure->checkInt($repID); |
2357 | $sRepID = $this->secure->checkInt($repID); |
2357 | 2358 | ||
2358 | // Удаление репозитория
|
2359 | // Удаление репозитория
|
2359 | $query = "DELETE FROM ".$this->prefix."repository WHERE rep_id='".$sRepID."'"; |
2360 | $query = "DELETE FROM ".$this->prefix."repository WHERE rep_id='".$sRepID."'"; |
2360 | $rq =& $this->db->query($query); |
2361 | $rq =& $this->db->query($query); |
2361 | if (PEAR::isError($this->db)) { |
2362 | if (PEAR::isError($this->db)) { |
2362 | $result["ERR"] = 1; |
2363 | $result["ERR"] = 1; |
2363 | $result["ERRINFO"] = $this->db->getMessage(); |
2364 | $result["ERRINFO"] = $this->db->getMessage(); |
2364 | } else { |
2365 | } else { |
2365 | $result["ERR"] = 0; |
2366 | $result["ERR"] = 0; |
2366 | }
|
2367 | }
|
2367 | 2368 | ||
2368 | // Удаление секций репозитория
|
2369 | // Удаление секций репозитория
|
2369 | $query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'"; |
2370 | $query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'"; |
2370 | $rq =& $this->db->query($query); |
2371 | $rq =& $this->db->query($query); |
2371 | if (PEAR::isError($this->db)) { |
2372 | if (PEAR::isError($this->db)) { |
2372 | $result["ERR"] = 1; |
2373 | $result["ERR"] = 1; |
2373 | $result["ERRINFO"] = $this->db->getMessage(); |
2374 | $result["ERRINFO"] = $this->db->getMessage(); |
2374 | } else { |
2375 | } else { |
2375 | $result["ERR"] = 0; |
2376 | $result["ERR"] = 0; |
2376 | }
|
2377 | }
|
2377 | 2378 | ||
2378 | // Удаление архитектур репозитория
|
2379 | // Удаление архитектур репозитория
|
2379 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'"; |
2380 | $query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'"; |
2380 | $rq =& $this->db->query($query); |
2381 | $rq =& $this->db->query($query); |
2381 | if (PEAR::isError($this->db)) { |
2382 | if (PEAR::isError($this->db)) { |
2382 | $result["ERR"] = 1; |
2383 | $result["ERR"] = 1; |
2383 | $result["ERRINFO"] = $this->db->getMessage(); |
2384 | $result["ERRINFO"] = $this->db->getMessage(); |
2384 | } else { |
2385 | } else { |
2385 | $result["ERR"] = 0; |
2386 | $result["ERR"] = 0; |
2386 | }
|
2387 | }
|
2387 | 2388 | ||
2388 | return $result; |
2389 | return $result; |
2389 | }
|
2390 | }
|
2390 | 2391 | ||
2391 | }
|
2392 | }
|
2392 | 2393 | ||
2393 | ?>
|
2394 | ?>
|