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