Редакция 167 | К новейшей редакции | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS
Редакция | Автор | № строки | Строка |
---|---|---|---|
2 | alex-w | 1 | <?php |
2 | |||
31 | alex-w | 3 | /** |
4 | * Project: Ant: sources.list generator |
||
5 | * File: process.php |
||
6 | * |
||
60 | alex-w | 7 | * This application is free software; you can redistribute it and/or |
31 | alex-w | 8 | * modify it under the terms of the GNU Lesser General Public |
9 | * License as published by the Free Software Foundation; either |
||
10 | * version 2.1 of the License, or (at your option) any later version. |
||
11 | * |
||
60 | alex-w | 12 | * This application is distributed in the hope that it will be useful, |
31 | alex-w | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||
15 | * Lesser General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU Lesser General Public |
||
18 | * License along with this library; if not, write to the Free Software |
||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
20 | * |
||
21 | */ |
||
22 | |||
23 | |||
101 | alex-w | 24 | require_once dirname(__FILE__)."/sign-valid.php"; |
2 | alex-w | 25 | |
26 | $mode = abs(intval($_POST["mode"])); |
||
166 | diffor | 27 | $act = abs(intval($_POST["act"])); |
2 | alex-w | 28 | |
29 | $go = "./admin.php"; |
||
30 | |||
167 | diffor | 31 | switch ($mode) { |
2 | alex-w | 32 | case '0': |
167 | diffor | 33 | break; |
34 | case '1': |
||
166 | diffor | 35 | switch ($act) { |
36 | case '0': |
||
2 | alex-w | 37 | break; |
166 | diffor | 38 | case '1': |
39 | // Добавление нового дистрибутива |
||
40 | $distname = mysql_real_escape_string($_POST["distName"]); |
||
41 | $distua = mysql_real_escape_string($_POST["distUA"]); |
||
42 | $disttype = abs(intval($_POST["distType"])); |
||
80 | alex-w | 43 | |
166 | diffor | 44 | $distlogo = 0; |
45 | if ($_FILES["distLOGO"]["type"]!=0) { |
||
46 | $folder = dirname(__FILE__)."/img/logo/".stripslashes($distua)."-orig.png"; |
||
47 | $folderN = dirname(__FILE__)."/img/logo/".stripslashes($distua).".png"; |
||
48 | $folderEM = dirname(__FILE__)."/img/logo/".stripslashes($distua)."-em.png"; |
||
49 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
||
80 | alex-w | 50 | chmod($folder, 0644); |
51 | list($width, $height) = GetImageSize($folder); |
||
52 | $percent = 32/$height; |
||
53 | $newwidth = $width * $percent; |
||
54 | $newheight = $height * $percent; |
||
55 | |||
56 | $output = ImageCreateTrueColor($newwidth, $newheight); |
||
82 | alex-w | 57 | $source = ImageCreateFromPNG($folder); |
80 | alex-w | 58 | |
95 | alex-w | 59 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
82 | alex-w | 60 | ImagePNG($output, $folderEM); |
80 | alex-w | 61 | |
62 | $percent = 15/$height; |
||
63 | $newwidth = $width * $percent; |
||
64 | $newheight = $height * $percent; |
||
65 | |||
66 | $output = ImageCreateTrueColor($newwidth, $newheight); |
||
67 | |||
68 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
||
82 | alex-w | 69 | ImagePNG($output, $folderN); |
80 | alex-w | 70 | |
71 | unlink($folder); |
||
72 | $distlogo = 1; |
||
166 | diffor | 73 | } |
80 | alex-w | 74 | } |
93 | alex-w | 75 | |
166 | diffor | 76 | $res =& $db->query("INSERT INTO distribution SET distname='$distname', distua='$distua', disttype='$disttype', distlogo='$distlogo'"); |
108 | alex-w | 77 | |
166 | diffor | 78 | // ChangeLog recording |
79 | $res =& $db->query("SELECT * FROM dtype WHERE type_id='$disttype'"); |
||
80 | $res->fetchInto($log, DB_FETCHMODE_ASSOC); |
||
81 | $title = "Добавлен новый дистрибутив"; |
||
82 | $dinfo = "В Ant добавлена поддержка основанного на ".stripslashes($log["type"])."-пакетах дистрибутива ".$distname."."; |
||
83 | $res =& $db->query("INSERT INTO changelog SET log_record=NOW(), log_title='$title', log_desc='$dinfo'"); |
||
80 | alex-w | 84 | |
167 | diffor | 85 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 86 | |
87 | break; |
||
88 | case '2': |
||
89 | // Правка существующего дистрибутива |
||
90 | $distname = mysql_real_escape_string($_POST["distName"]); |
||
91 | $distua = mysql_real_escape_string($_POST["distUA"]); |
||
92 | $disttype = abs(intval($_POST["distType"])); |
||
93 | $distID = abs(intval($_POST["distID"])); |
||
94 | |||
95 | if ($_FILES["distLOGO"]["type"]!='') { |
||
96 | $folder = dirname(__FILE__)."/img/logo/".$distua."-orig.png"; |
||
97 | $folderN = dirname(__FILE__)."/img/logo/".$distua.".png"; |
||
98 | $folderEM = dirname(__FILE__)."/img/logo/".$distua."-em.png"; |
||
99 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
||
80 | alex-w | 100 | chmod ($folder, 0644); |
101 | list($width, $height) = GetImageSize($folder); |
||
102 | $percent = 32/$height; |
||
103 | $newwidth = $width * $percent; |
||
104 | $newheight = $height * $percent; |
||
105 | |||
106 | $output = ImageCreateTrueColor($newwidth, $newheight); |
||
83 | alex-w | 107 | $black = ImageColorAllocate($output, 0, 0, 0); |
82 | alex-w | 108 | $source = ImageCreateFromPNG($folder); |
80 | alex-w | 109 | |
95 | alex-w | 110 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
83 | alex-w | 111 | ImageColorTransparent($output, $black); |
82 | alex-w | 112 | ImagePNG($output, $folderEM); |
80 | alex-w | 113 | |
114 | $percent = 15/$height; |
||
115 | $newwidth = $width * $percent; |
||
116 | $newheight = $height * $percent; |
||
117 | |||
118 | $output = ImageCreateTrueColor($newwidth, $newheight); |
||
83 | alex-w | 119 | $black = ImageColorAllocate($output, 0, 0, 0); |
80 | alex-w | 120 | |
121 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
||
83 | alex-w | 122 | ImageColorTransparent($output, $black); |
82 | alex-w | 123 | ImagePNG($output, $folderN); |
80 | alex-w | 124 | |
125 | unlink($folder); |
||
126 | |||
127 | $res =& $db->query("UPDATE distribution SET distlogo='1' WHERE dist_id='$distID'"); |
||
128 | |||
166 | diffor | 129 | } |
80 | alex-w | 130 | } |
108 | alex-w | 131 | |
166 | diffor | 132 | $res =& $db->query("UPDATE distribution SET distname='$distname', distua='$distua', disttype='$disttype' WHERE dist_id='$distID'"); |
133 | |||
167 | diffor | 134 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 135 | |
2 | alex-w | 136 | break; |
166 | diffor | 137 | case '3': |
138 | // Удаление существующего дистрибутива |
||
139 | $distID = abs(intval($_POST["distID"])); |
||
140 | $distUA = $_POST["distUA"]; |
||
80 | alex-w | 141 | |
166 | diffor | 142 | $folder1 = dirname(__FILE__)."/img/logo/".$distUA."-em.png"; |
143 | $folder2 = dirname(__FILE__)."/img/logo/".$distUA.".png"; |
||
80 | alex-w | 144 | |
166 | diffor | 145 | if (file_exists($folder1)) { unlink($folder1); } |
146 | if (file_exists($folder2)) { unlink($folder2); } |
||
93 | alex-w | 147 | |
166 | diffor | 148 | $res =& $db->query("SELECT * FROM distribution d JOIN dtype t ON d.disttype=t.type_id WHERE d.dist_id='$distID'"); |
149 | $res->fetchInto($log, DB_FETCHMODE_ASSOC); |
||
93 | alex-w | 150 | |
166 | diffor | 151 | $res =& $db->query("DELETE FROM distribution WHERE dist_id='$distID'"); |
152 | $res =& $db->query("DELETE FROM sect2dist WHERE dist_id='$distID'"); |
||
153 | $res =& $db->query("DELETE FROM version WHERE dist_id='$distID'"); |
||
93 | alex-w | 154 | |
166 | diffor | 155 | // ChangeLog recording |
156 | $title = "Удаление поддержки дистрибутива"; |
||
157 | $dinfo = "Из Ant удалена поддержка основанного на ".stripslashes($log["type"])."-пакетах дистрибутива ".stripslashes($log["distname"])."."; |
||
158 | $res =& $db->query("INSERT INTO changelog SET log_record=NOW(), log_title='$title', log_desc='$dinfo'"); |
||
108 | alex-w | 159 | |
167 | diffor | 160 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 161 | |
2 | alex-w | 162 | break; |
166 | diffor | 163 | } |
164 | break; |
||
167 | diffor | 165 | case '2': |
166 | diffor | 166 | switch ($act) { |
167 | case '0': |
||
168 | break; |
||
169 | case '1': |
||
170 | // Добавление новой версии дистрибутива |
||
171 | $versname = mysql_real_escape_string($_POST["versNam"]); |
||
172 | $versnumb = mysql_real_escape_string($_POST["versNum"]); |
||
173 | $verscode = mysql_real_escape_string($_POST["versCN"]); |
||
174 | $distname = abs(intval($_POST["distName"])); |
||
93 | alex-w | 175 | |
166 | diffor | 176 | $res =& $db->query("INSERT INTO version SET dist_id='$distname', vname='$versname', version='$versnumb', vcodename='$verscode'"); |
108 | alex-w | 177 | |
166 | diffor | 178 | // ChangeLog recording |
179 | $res =& $db->query("SELECT * FROM distribution WHERE dist_id='$distname'"); |
||
180 | $res->fetchInto($log, DB_FETCHMODE_ASSOC); |
||
181 | $title = "Добавлена новая версия ".$log["distname"]; |
||
182 | $dinfo = "В Ant добавлена поддержка новой версии дистрибутива ".$log["distname"]." – ".$versnumb; |
||
183 | if ($versname!="") { |
||
184 | $dinfo .= " с кодовым названием “".$versname."”."; |
||
185 | } else { |
||
186 | $dinfo .= "."; |
||
187 | } |
||
188 | $res =& $db->query("INSERT INTO changelog SET log_record=NOW(), log_title='$title', log_desc='$dinfo'"); |
||
189 | |||
167 | diffor | 190 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 191 | |
2 | alex-w | 192 | break; |
166 | diffor | 193 | case '2': |
194 | // Правка имеющейся версии дистрибутива |
||
195 | $versname = mysql_real_escape_string($_POST["versNam"]); |
||
196 | $versnumb = mysql_real_escape_string($_POST["versNum"]); |
||
197 | $verscode = mysql_real_escape_string($_POST["versCN"]); |
||
198 | $distname = abs(intval($_POST["distName"])); |
||
199 | $versID = abs(intval($_POST["versID"])); |
||
108 | alex-w | 200 | |
166 | diffor | 201 | $res =& $db->query("UPDATE version SET dist_id='$distname', vname='$versname', version='$versnumb', vcodename='$verscode' WHERE version_id='$versID'"); |
202 | |||
167 | diffor | 203 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 204 | |
2 | alex-w | 205 | break; |
166 | diffor | 206 | case '3': |
207 | // Удаление существующей версии дистрибутива |
||
208 | $versID = abs(intval($_POST["versID"])); |
||
93 | alex-w | 209 | |
166 | diffor | 210 | $res =& $db->query("SELECT * FROM version v JOIN distribution d ON v.dist_id=d.dist_id WHERE v.version_id='$versID'"); |
211 | $res->fetchInto($log, DB_FETCHMODE_ASSOC); |
||
93 | alex-w | 212 | |
166 | diffor | 213 | $res =& $db->query("DELETE FROM version WHERE version_id='$versID'"); |
214 | $res =& $db->query("DELETE FROM ver2rep WHERE ver_id='$versID'"); |
||
108 | alex-w | 215 | |
166 | diffor | 216 | // ChangeLog recording |
217 | $title = "Удалена поддержка ".$log["distname"]." ".$log["version"]; |
||
218 | $dinfo = "Из Ant удалена поддержка версии ".$log["version"]."{CNAME} дистрибутива ".$log["distname"]."."; |
||
219 | if ($log["vname"]!="") { |
||
220 | $dinfo = str_replace("{CNAME}","(“".$log["vname"]."”)",$dinfo); |
||
221 | } else { |
||
222 | $dinfo = str_replace("{CNAME}","",$dinfo); |
||
223 | } |
||
224 | $res =& $db->query("INSERT INTO changelog SET log_record=NOW(), log_title='$title', log_desc='$dinfo'"); |
||
225 | |||
167 | diffor | 226 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 227 | |
2 | alex-w | 228 | break; |
166 | diffor | 229 | } |
167 | diffor | 230 | case '3': |
166 | diffor | 231 | switch ($act) { |
232 | case '0': |
||
233 | break; |
||
234 | case '1': |
||
167 | diffor | 235 | // Добавление нового источника |
236 | $origin = mysql_real_escape_string($_POST["origin"]); |
||
237 | $res =& $db->query("INSERT INTO origin SET origin='$origin'"); |
||
238 | $go .= "?mode=".$mode."&action=0"; |
||
239 | break; |
||
240 | case '2': |
||
241 | // Правка существующего источника |
||
242 | $origin = mysql_real_escape_string($_POST["origin"]); |
||
243 | $id = abs(intval($_POST["originID"])); |
||
244 | $res =& $db->query("UPDATE origin SET origin='$origin' WHERE origin_id='$id'"); |
||
245 | $go .= "?mode=$mode&action=0"; |
||
246 | break; |
||
247 | case '3': |
||
248 | // Удаление существующего источника |
||
249 | $id = abs(intval($_POST["originID"])); |
||
250 | $res =& $db->query("DELETE FROM rep2orig WHERE origin_id='$id'"); |
||
251 | $res =& $db->query("DELETE FROM origin WHERE origin_id='$id'"); |
||
252 | $go .= "?mode=".$mode."&action=0"; |
||
253 | break; |
||
254 | } |
||
255 | break; |
||
256 | case '4': |
||
257 | switch ($act) { |
||
258 | case '0': |
||
259 | break; |
||
260 | case '1': |
||
261 | break; |
||
262 | case '2': |
||
166 | diffor | 263 | // Добавление нового репозитория |
264 | $versID = abs(intval($_POST["vers"])); |
||
265 | $repname = mysql_real_escape_string($_POST["repName"]); |
||
266 | $repinfo = mysql_real_escape_string($_POST["repInfo"]); |
||
267 | $repsche = abs(intval($_POST["scheme"])); |
||
268 | $reptype = abs(intval($_POST["rtype"])); |
||
269 | $reproot = abs(intval($_POST["rootFolder"])); |
||
2 | alex-w | 270 | |
166 | diffor | 271 | $res =& $db->query("INSERT INTO repository SET repname='$repname', repdescribe='$repinfo', scheme_id='$repsche', rtype_id='$reptype', root_id='$reproot'"); |
272 | $res =& $db->query("SELECT rep_id FROM repository ORDER BY rep_id DESC LIMIT 1"); |
||
273 | $res->fetchInto($rep, DB_FETCHMODE_ASSOC); |
||
274 | $rep_id = $rep["rep_id"]; |
||
2 | alex-w | 275 | |
166 | diffor | 276 | $res =& $db->query("INSERT INTO ver2rep SET ver_id='$versID', rep_id='$rep_id'"); |
2 | alex-w | 277 | |
166 | diffor | 278 | for ($i=0;$i<count($_POST["sect"]);$i++) { |
279 | $res =& $db->query("INSERT INTO sect2rep SET sect_id='".$_POST["sect"][$i]."', rep_id='$rep_id'"); |
||
280 | } |
||
108 | alex-w | 281 | |
167 | diffor | 282 | $go .= "?mode=".$mode."&action=0"; |
108 | alex-w | 283 | |
2 | alex-w | 284 | break; |
167 | diffor | 285 | case '3': |
166 | diffor | 286 | // Правка репозитория |
287 | $repID = abs(intval($_POST["rep"])); |
||
288 | $repname = mysql_real_escape_string($_POST["repName"]); |
||
289 | $repinfo = mysql_real_escape_string($_POST["repInfo"]); |
||
290 | $repsche = abs(intval($_POST["scheme"])); |
||
291 | $reptype = abs(intval($_POST["rtype"])); |
||
292 | $reproot = abs(intval($_POST["rootFolder"])); |
||
108 | alex-w | 293 | |
166 | diffor | 294 | $res =& $db->query("UPDATE repository SET repname='$repname', repdescribe='$repinfo', scheme_id='$repsche', rtype_id='$reptype', root_id='$reproot' WHERE rep_id='$repID'"); |
295 | $res =& $db->query("DELETE FROM sect2rep WHERE rep_id='$repID'"); |
||
296 | for ($i=0;$i<count($_POST["sect"]);$i++) { |
||
297 | $res =& $db->query("INSERT INTO sect2rep SET sect_id='".$_POST["sect"][$i]."', rep_id='$repID'"); |
||
298 | } |
||
108 | alex-w | 299 | |
167 | diffor | 300 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 301 | |
2 | alex-w | 302 | break; |
167 | diffor | 303 | case '4': |
166 | diffor | 304 | // Удаление репозитория |
167 | diffor | 305 | $repID = abs(intval($_POST["rep"])); |
2 | alex-w | 306 | |
166 | diffor | 307 | $res =& $db->query("DELETE FROM repository WHERE rep_id='$repID'"); |
308 | $res =& $db->query("DELETE FROM sect2rep WHERE rep_id='$repID'"); |
||
309 | $res =& $db->query("DELETE FROM ver2rep WHERE rep_id='$repID'"); |
||
108 | alex-w | 310 | |
167 | diffor | 311 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 312 | |
2 | alex-w | 313 | break; |
166 | diffor | 314 | } |
315 | break; |
||
167 | diffor | 316 | case '5': |
166 | diffor | 317 | switch ($act) { |
318 | case '0': |
||
319 | break; |
||
320 | case '1': |
||
321 | // Создание секции |
||
322 | $sectname = mysql_real_escape_string($_POST["sectName"]); |
||
323 | $sectinfo = mysql_real_escape_string($_POST["sectInfo"]); |
||
108 | alex-w | 324 | |
166 | diffor | 325 | $req =& $db->query("INSERT INTO section SET sectname='$sectname', sectinfo='$sectinfo'"); |
326 | $req =& $db->query("SELECT sect_id FROM section ORDER BY sect_id DESC LIMIT 1"); |
||
327 | $req->fetchInto($sect, DB_FETCHMODE_ASSOC); |
||
328 | |||
329 | for($i=0;$i<count($_POST["dist"]);$i++) { |
||
330 | $req =& $db->query("INSERT INTO sect2dist SET dist_id='".$_POST["dist"][$i]."', sect_id='".$sect["sect_id"]."'"); |
||
331 | } |
||
332 | |||
167 | diffor | 333 | $go .= "?mode=".$mode."&act=0"; |
166 | diffor | 334 | |
2 | alex-w | 335 | break; |
166 | diffor | 336 | case '2': |
337 | // Правка секции |
||
338 | $sectID = abs(intval($_POST["sectID"])); |
||
339 | $sectname = mysql_real_escape_string($_POST["sectName"]); |
||
340 | $sectinfo = mysql_real_escape_string($_POST["sectInfo"]); |
||
108 | alex-w | 341 | |
166 | diffor | 342 | $req =& $db->query("UPDATE section SET sectname='$sectname', sectinfo='$sectinfo' WHERE sect_id='$sectID'"); |
343 | $req =& $db->query("DELETE FROM sect2dist WHERE sect_id='$sectID'"); |
||
344 | |||
345 | for($i=0;$i<count($_POST["dist"]);$i++) { |
||
346 | $req =& $db->query("INSERT INTO sect2dist SET dist_id='".$_POST["dist"][$i]."', sect_id='".$sectID."'"); |
||
347 | } |
||
348 | |||
167 | diffor | 349 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 350 | |
2 | alex-w | 351 | break; |
166 | diffor | 352 | case '3': |
353 | // Удаление секции |
||
354 | $sectID = abs(intval($_POST["sectID"])); |
||
108 | alex-w | 355 | |
166 | diffor | 356 | $req =& $db->query("DELETE FROM section WHERE sect_id='$sectID'"); |
357 | $req =& $db->query("DELETE FROM sect2dist WHERE sect_id='$sectID'"); |
||
358 | $req =& $db->query("DELETE FROM sect2rep WHERE sect_id='$sectID'"); |
||
359 | |||
167 | diffor | 360 | $go .= "?mode=".$mode."&action=0"; |
166 | diffor | 361 | |
2 | alex-w | 362 | break; |
166 | diffor | 363 | } |
364 | break; |
||
167 | diffor | 365 | case '6': |
166 | diffor | 366 | switch ($act) { |
367 | case '0': |
||
368 | break; |
||
369 | case '1': |
||
370 | // Добавление новой схемы |
||
371 | $scheme = mysql_real_escape_string($_POST["scheme"]); |
||
7 | alex-w | 372 | |
166 | diffor | 373 | $req =& $db->query("INSERT INTO scheme SET scheme='$scheme'"); |
374 | |||
167 | diffor | 375 | $go .= "?mode=".$mode."&act=0"; |
166 | diffor | 376 | |
7 | alex-w | 377 | break; |
166 | diffor | 378 | case '2': |
379 | // Правка схемы |
||
380 | $schemeID = abs(intval($_POST["schemeID"])); |
||
381 | $scheme = mysql_real_escape_string($_POST["scheme"]); |
||
382 | |||
383 | $req =& $db->query("UPDATE scheme SET scheme='$scheme' WHERE scheme_id='$schemeID'"); |
||
384 | |||
167 | diffor | 385 | $go .= "?mode=".$mode."&act=0"; |
166 | diffor | 386 | |
7 | alex-w | 387 | break; |
166 | diffor | 388 | case '3': |
389 | // Удаление схемы |
||
390 | $schemeID = abs(intval($_POST["schemeID"])); |
||
7 | alex-w | 391 | |
166 | diffor | 392 | $req =& $db->query("DELETE FROM scheme WHERE scheme_id='$schemeID'"); |
393 | |||
167 | diffor | 394 | $go .= "?mode=".$mode."&act=0"; |
166 | diffor | 395 | |
7 | alex-w | 396 | break; |
166 | diffor | 397 | } |
398 | break; |
||
177 | diffor | 399 | |
400 | |||
401 | |||
402 | case '21': |
||
403 | switch ($act) { |
||
404 | case '0': |
||
405 | break; |
||
406 | case '1': |
||
407 | // Добавление интерфейса |
||
408 | $ifname = mysql_real_escape_string($_POST["ifname"]); |
||
409 | $ifinfo = mysql_real_escape_string($_POST["ifinfo"]); |
||
410 | $ifname = str_replace(".php","",$ifname); |
||
411 | $req =& $db->query("INSERT INTO interfaces SET interface='$ifname', interfaceinfo='$ifinfo'"); |
||
412 | break; |
||
413 | case '2': |
||
414 | // Правка интерфейса |
||
415 | $ifname = mysql_real_escape_string($_POST["ifname"]); |
||
416 | $ifinfo = mysql_real_escape_string($_POST["ifinfo"]); |
||
417 | $if = abs(intval($_POST["if"])); |
||
418 | $ifname = str_replace(".php","",$ifname); |
||
419 | $req =& $db->query("UPDATE interfaces SET interface='$ifname', interfaceinfo='$ifinfo' WHERE if_id='$if'"); |
||
420 | break; |
||
421 | case '3': |
||
422 | // Удаление интерфейса |
||
423 | $if = abs(intval($_POST["if"])); |
||
424 | $req =& $db->query("DELETE FROM interfaces WHERE if_id='$if'"); |
||
425 | break; |
||
426 | } |
||
427 | break; |
||
11 | alex-w | 428 | |
108 | alex-w | 429 | |
430 | |||
177 | diffor | 431 | /*-------------------------------------------------------------------------------------------------------*/ |
167 | diffor | 432 | /* case '7': |
166 | diffor | 433 | switch ($act) { |
434 | case '0': |
||
435 | break; |
||
436 | case '1': |
||
437 | // Добавление нового типа репозитория |
||
438 | $rtype = mysql_real_escape_string($_POST["rtype"]); |
||
16 | alex-w | 439 | |
166 | diffor | 440 | $req =& $db->query("INSERT INTO rtype SET rtype='$rtype'"); |
16 | alex-w | 441 | |
166 | diffor | 442 | $go .= "?mode=7&act=0"; |
16 | alex-w | 443 | |
91 | alex-w | 444 | break; |
166 | diffor | 445 | case '2': |
446 | // Правка существующего типа репозитория |
||
447 | $rtypeID = abs(intval($_POST["rtypeID"])); |
||
448 | $rtype = mysql_real_escape_string($_POST["rtype"]); |
||
449 | |||
450 | $req =& $db->query("UPDATE rtype SET rtype='$rtype' WHERE rtype_id='$rtypeID'"); |
||
451 | |||
452 | $go .= "?mode=7&act=0"; |
||
453 | |||
91 | alex-w | 454 | break; |
166 | diffor | 455 | case '3': |
456 | // Удаление типа репозитория |
||
457 | $rtypeID = abs(intval($_POST["rtypeID"])); |
||
458 | |||
459 | $req =& $db->query("DELETE FROM rtype WHERE rtype_id='$rtypeID'"); |
||
460 | |||
461 | $go .= "?mode=7&act=0"; |
||
462 | |||
91 | alex-w | 463 | break; |
166 | diffor | 464 | } |
465 | break; |
||
466 | case '8': |
||
467 | switch ($act) { |
||
468 | case '0': |
||
147 | diffor | 469 | break; |
166 | diffor | 470 | case '1': |
167 | diffor | 471 | // Создание корневой папки репозиториев |
472 | $root = mysql_real_escape_string($_POST["rootFolder"]); |
||
473 | $req =& $db->query("INSERT INTO root SET root_folder='$root'"); |
||
474 | $go .= "?mode=10&act=0"; |
||
147 | diffor | 475 | break; |
167 | diffor | 476 | case '2': |
477 | // Редактирование корневой папки репозиториев |
||
478 | $root_id = abs(intval($_POST["rootID"])); |
||
479 | $root_fd = mysql_real_escape_string($_POST["rootFolder"]); |
||
480 | $req =& $db->query("UPDATE root SET root_folder='$root_fd' WHERE root_id='$root_id'"); |
||
481 | $go .= "?mode=10&act=0"; |
||
482 | break; |
||
483 | case '3': |
||
484 | // Удаление корневой папки репозиториев |
||
485 | $root_id = abs(intval($_POST["rootID"])); |
||
486 | $req =& $db->query("DELETE FROM root WHERE root_id='$root_id'"); |
||
487 | $go .= "?mode=10&act=0"; |
||
488 | break; |
||
166 | diffor | 489 | } |
490 | break; |
||
167 | diffor | 491 | case '13': |
166 | diffor | 492 | switch ($act) { |
493 | case '0': |
||
494 | break; |
||
495 | case '1': |
||
167 | diffor | 496 | // Добавление новой настройки Ant |
497 | $option = mysql_real_escape_string($_POST["setoption"]); |
||
498 | $value = mysql_real_escape_string($_POST["setvalue"]); |
||
499 | |||
500 | $req =& $db->query("INSERT INTO settings SET opt='$option', optvalue='$value'"); |
||
501 | |||
166 | diffor | 502 | break; |
503 | case '2': |
||
167 | diffor | 504 | // Правка настройки Ant |
505 | $optID = abs(intval($_POST["optID"])); |
||
506 | $option = mysql_real_escape_string($_POST["setoption"]); |
||
507 | $value = mysql_real_escape_string($_POST["setvalue"]); |
||
508 | |||
509 | $req =& $db->query("UPDATE settings SET opt='$option', optvalue='$value' WHERE opt_id='$optID'"); |
||
510 | |||
166 | diffor | 511 | break; |
512 | case '3': |
||
167 | diffor | 513 | // Удаление настройки |
514 | $optID = abs(intval($_POST["optID"])); |
||
515 | |||
516 | $req =& $db->query("DELETE FROM settings WHERE opt_id='$optID'"); |
||
517 | |||
166 | diffor | 518 | break; |
519 | } |
||
520 | break; |
||
167 | diffor | 521 | case '14': |
166 | diffor | 522 | switch ($act) { |
523 | case '0': |
||
524 | break; |
||
525 | case '1': |
||
167 | diffor | 526 | // Смена пароля |
527 | // $OID = abs(intval($_POST["OID"])); |
||
528 | $oldpass = mysql_real_escape_string($_POST["oldPW"]); |
||
529 | $newpass1 = mysql_real_escape_string($_POST["newPW1"]); |
||
530 | $newpass2 = mysql_real_escape_string($_POST["newPW2"]); |
||
531 | |||
532 | $errpwd = 0; |
||
533 | $spass = md5($newpass1."ANT"); |
||
534 | $soldpass = md5($oldpass."ANT"); |
||
535 | if ($soldpass != $_COOKIE[$CookiePasswd]) { |
||
536 | $go .= "?error=1"; |
||
537 | $errpwd = 1; |
||
538 | } |
||
539 | if ($newpass1 != $newpass2) { |
||
540 | $go .= "?error=2"; |
||
541 | $errpwd = 2; |
||
542 | } |
||
543 | |||
544 | if ($errpwd==0) { |
||
545 | // fix: Для многопользовательского варианта придется запрос переписать |
||
546 | $req =& $db->query("UPDATE owner SET passwd='$spass' WHERE login='admin'"); |
||
547 | } |
||
548 | |||
166 | diffor | 549 | break; |
550 | } |
||
167 | diffor | 551 | break;*/ |
2 | alex-w | 552 | } |
553 | |||
554 | header("Location: $go\n\n"); |
||
555 | |||
60 | alex-w | 556 | ?> |