Редакция 80 | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 80 | Редакция 82 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | /**
|
3 | /**
|
4 | * Project: Ant: sources.list generator
|
4 | * Project: Ant: sources.list generator
|
5 | * File: process.php
|
5 | * File: process.php
|
6 | *
|
6 | *
|
7 | * This application is free software; you can redistribute it and/or
|
7 | * This application is free software; you can redistribute it and/or
|
8 | * modify it under the terms of the GNU Lesser General Public
|
8 | * modify it under the terms of the GNU Lesser General Public
|
9 | * License as published by the Free Software Foundation; either
|
9 | * License as published by the Free Software Foundation; either
|
10 | * version 2.1 of the License, or (at your option) any later version.
|
10 | * version 2.1 of the License, or (at your option) any later version.
|
11 | *
|
11 | *
|
12 | * This application is distributed in the hope that it will be useful,
|
12 | * This application is distributed in the hope that it will be useful,
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 | * Lesser General Public License for more details.
|
15 | * Lesser General Public License for more details.
|
16 | *
|
16 | *
|
17 | * You should have received a copy of the GNU Lesser General Public
|
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
|
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
|
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20 | *
|
20 | *
|
21 | */
|
21 | */
|
22 | 22 | ||
23 | 23 | ||
24 | require_once "./sign-valid.php"; |
24 | require_once "./sign-valid.php"; |
25 | 25 | ||
26 | $mode = abs(intval($_POST["mode"])); |
26 | $mode = abs(intval($_POST["mode"])); |
27 | 27 | ||
28 | $go = "./admin.php"; |
28 | $go = "./admin.php"; |
29 | 29 | ||
30 | switch ($mode) { |
30 | switch ($mode) { |
31 | case '0': |
31 | case '0': |
32 | break; |
32 | break; |
33 | case '1': |
33 | case '1': |
34 | // Добавление нового дистрибутива
|
34 | // Добавление нового дистрибутива
|
35 | $distname = mysql_real_escape_string($_POST["distName"]); |
35 | $distname = mysql_real_escape_string($_POST["distName"]); |
36 | $distua = mysql_real_escape_string($_POST["distUA"]); |
36 | $distua = mysql_real_escape_string($_POST["distUA"]); |
37 | $disttype = abs(intval($_POST["distType"])); |
37 | $disttype = abs(intval($_POST["distType"])); |
38 | 38 | ||
39 | $distlogo = 0; |
39 | $distlogo = 0; |
40 | if ($_FILES["distLOGO"]["type"]!=0) { |
40 | if ($_FILES["distLOGO"]["type"]!=0) { |
41 | $folder = "./img/logo/".stripslashes($distua)."-orig.gif"; |
41 | $folder = "./img/logo/".stripslashes($distua)."-orig.png"; |
42 | $folderN = "./img/logo/".stripslashes($distua).".gif"; |
42 | $folderN = "./img/logo/".stripslashes($distua).".png"; |
43 | $folderEM = "./img/logo/".stripslashes($distua)."-em.gif"; |
43 | $folderEM = "./img/logo/".stripslashes($distua)."-em.png"; |
44 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
44 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
45 | chmod($folder, 0644); |
45 | chmod($folder, 0644); |
46 | list($width, $height) = GetImageSize($folder); |
46 | list($width, $height) = GetImageSize($folder); |
47 | $percent = 32/$height; |
47 | $percent = 32/$height; |
48 | $newwidth = $width * $percent; |
48 | $newwidth = $width * $percent; |
49 | $newheight = $height * $percent; |
49 | $newheight = $height * $percent; |
50 | 50 | ||
51 | $output = ImageCreateTrueColor($newwidth, $newheight); |
51 | $output = ImageCreateTrueColor($newwidth, $newheight); |
52 | $source = ImageCreateFromGIF($folder); |
52 | $source = ImageCreateFromPNG($folder); |
53 | 53 | ||
54 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
54 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
55 | ImageGIF($output, $folderEM); |
55 | ImagePNG($output, $folderEM); |
56 | 56 | ||
57 | $percent = 15/$height; |
57 | $percent = 15/$height; |
58 | $newwidth = $width * $percent; |
58 | $newwidth = $width * $percent; |
59 | $newheight = $height * $percent; |
59 | $newheight = $height * $percent; |
60 | 60 | ||
61 | $output = ImageCreateTrueColor($newwidth, $newheight); |
61 | $output = ImageCreateTrueColor($newwidth, $newheight); |
62 | 62 | ||
63 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
63 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
64 | ImageGIF($output, $folderN); |
64 | ImagePNG($output, $folderN); |
65 | 65 | ||
66 | unlink($folder); |
66 | unlink($folder); |
67 | $distlogo = 1; |
67 | $distlogo = 1; |
68 | }
|
68 | }
|
69 | }
|
69 | }
|
70 | 70 | ||
71 | $res =& $db->query("INSERT INTO distribution SET distname='$distname', distua='$distua', disttype='$disttype', distlogo='$distlogo'"); |
71 | $res =& $db->query("INSERT INTO distribution SET distname='$distname', distua='$distua', disttype='$disttype', distlogo='$distlogo'"); |
72 | 72 | ||
73 | break; |
73 | break; |
74 | case '2': |
74 | case '2': |
75 | // Правка существующего дистрибутива
|
75 | // Правка существующего дистрибутива
|
76 | $distname = mysql_real_escape_string($_POST["distName"]); |
76 | $distname = mysql_real_escape_string($_POST["distName"]); |
77 | $distua = mysql_real_escape_string($_POST["distUA"]); |
77 | $distua = mysql_real_escape_string($_POST["distUA"]); |
78 | $disttype = abs(intval($_POST["distType"])); |
78 | $disttype = abs(intval($_POST["distType"])); |
79 | $distID = abs(intval($_POST["distID"])); |
79 | $distID = abs(intval($_POST["distID"])); |
80 | 80 | ||
81 | if ($_FILES["distLOGO"]["type"]!=0) { |
81 | if ($_FILES["distLOGO"]["type"]!=0) { |
82 | $folder = "./img/logo/".stripslashes($distua)."-orig.gif"; |
82 | $folder = "./img/logo/".stripslashes($distua)."-orig.png"; |
83 | $folderN = "./img/logo/".stripslashes($distua).".gif"; |
83 | $folderN = "./img/logo/".stripslashes($distua).".png"; |
84 | $folderEM = "./img/logo/".stripslashes($distua)."-em.gif"; |
84 | $folderEM = "./img/logo/".stripslashes($distua)."-em.png"; |
85 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
85 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
86 | chmod ($folder, 0644); |
86 | chmod ($folder, 0644); |
87 | list($width, $height) = GetImageSize($folder); |
87 | list($width, $height) = GetImageSize($folder); |
88 | $percent = 32/$height; |
88 | $percent = 32/$height; |
89 | $newwidth = $width * $percent; |
89 | $newwidth = $width * $percent; |
90 | $newheight = $height * $percent; |
90 | $newheight = $height * $percent; |
91 | 91 | ||
92 | $output = ImageCreateTrueColor($newwidth, $newheight); |
92 | $output = ImageCreateTrueColor($newwidth, $newheight); |
93 | $source = ImageCreateFromGIF($folder); |
93 | $source = ImageCreateFromPNG($folder); |
94 | 94 | ||
95 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
95 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
96 | ImageGIF($output, $folderEM); |
96 | ImagePNG($output, $folderEM); |
97 | 97 | ||
98 | $percent = 15/$height; |
98 | $percent = 15/$height; |
99 | $newwidth = $width * $percent; |
99 | $newwidth = $width * $percent; |
100 | $newheight = $height * $percent; |
100 | $newheight = $height * $percent; |
101 | 101 | ||
102 | $output = ImageCreateTrueColor($newwidth, $newheight); |
102 | $output = ImageCreateTrueColor($newwidth, $newheight); |
103 | 103 | ||
104 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
104 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
105 | ImageGIF($output, $folderN); |
105 | ImagePNG($output, $folderN); |
106 | 106 | ||
107 | unlink($folder); |
107 | unlink($folder); |
108 | 108 | ||
109 | $res =& $db->query("UPDATE distribution SET distlogo='1' WHERE dist_id='$distID'"); |
109 | $res =& $db->query("UPDATE distribution SET distlogo='1' WHERE dist_id='$distID'"); |
110 | 110 | ||
111 | }
|
111 | }
|
112 | }
|
112 | }
|
113 | 113 | ||
114 | $res =& $db->query("UPDATE distribution SET distname='$distname', distua='$distua', disttype='$disttype', WHERE dist_id='$distID'"); |
114 | $res =& $db->query("UPDATE distribution SET distname='$distname', distua='$distua', disttype='$disttype', WHERE dist_id='$distID'"); |
115 | 115 | ||
116 | break; |
116 | break; |
117 | case '3': |
117 | case '3': |
118 | // Удаление существующего дистрибутива
|
118 | // Удаление существующего дистрибутива
|
119 | $distID = abs(intval($_POST["distID"])); |
119 | $distID = abs(intval($_POST["distID"])); |
120 | $distUA = $_POST["distUA"]; |
120 | $distUA = $_POST["distUA"]; |
121 | 121 | ||
122 | $folder1 = "./img/logo/".$distUA."-em.gif"; |
122 | $folder1 = "./img/logo/".$distUA."-em.gif"; |
123 | $folder2 = "./img/logo/".$distUA.".gif"; |
123 | $folder2 = "./img/logo/".$distUA.".gif"; |
124 | 124 | ||
125 | if (file_exsists($folder1)) { unlink($folder1); } |
125 | if (file_exsists($folder1)) { unlink($folder1); } |
126 | if (file_exsists($folder2)) { unlink($folder2); } |
126 | if (file_exsists($folder2)) { unlink($folder2); } |
127 | 127 | ||
128 | $res =& $db->query("DELETE FROM distribution WHERE dist_id='$distID'"); |
128 | $res =& $db->query("DELETE FROM distribution WHERE dist_id='$distID'"); |
129 | $res =& $db->query("DELETE FROM sect2dist WHERE dist_id='$distID'"); |
129 | $res =& $db->query("DELETE FROM sect2dist WHERE dist_id='$distID'"); |
130 | 130 | ||
131 | break; |
131 | break; |
132 | case '4': |
132 | case '4': |
133 | // Добавление новой версии дистрибутива
|
133 | // Добавление новой версии дистрибутива
|
134 | $versname = mysql_real_escape_string($_POST["versNam"]); |
134 | $versname = mysql_real_escape_string($_POST["versNam"]); |
135 | $versnumb = mysql_real_escape_string($_POST["versNum"]); |
135 | $versnumb = mysql_real_escape_string($_POST["versNum"]); |
136 | $verscode = mysql_real_escape_string($_POST["versCN"]); |
136 | $verscode = mysql_real_escape_string($_POST["versCN"]); |
137 | $distname = abs(intval($_POST["distName"])); |
137 | $distname = abs(intval($_POST["distName"])); |
138 | 138 | ||
139 | $res =& $db->query("INSERT INTO version SET dist_id='$distname', vname='$versname', version='$versnumb', vcodename='$verscode'"); |
139 | $res =& $db->query("INSERT INTO version SET dist_id='$distname', vname='$versname', version='$versnumb', vcodename='$verscode'"); |
140 | 140 | ||
141 | break; |
141 | break; |
142 | case '5': |
142 | case '5': |
143 | // Правка имеющейся версии дистрибутива
|
143 | // Правка имеющейся версии дистрибутива
|
144 | $versname = mysql_real_escape_string($_POST["versNam"]); |
144 | $versname = mysql_real_escape_string($_POST["versNam"]); |
145 | $versnumb = mysql_real_escape_string($_POST["versNum"]); |
145 | $versnumb = mysql_real_escape_string($_POST["versNum"]); |
146 | $verscode = mysql_real_escape_string($_POST["versCN"]); |
146 | $verscode = mysql_real_escape_string($_POST["versCN"]); |
147 | $distname = abs(intval($_POST["distName"])); |
147 | $distname = abs(intval($_POST["distName"])); |
148 | $versID = abs(intval($_POST["versID"])); |
148 | $versID = abs(intval($_POST["versID"])); |
149 | 149 | ||
150 | $res =& $db->query("UPDATE version SET dist_id='$distname', vname='$versname', version='$versnumb', vcodename='$verscode' WHERE version_id='$versID'"); |
150 | $res =& $db->query("UPDATE version SET dist_id='$distname', vname='$versname', version='$versnumb', vcodename='$verscode' WHERE version_id='$versID'"); |
151 | 151 | ||
152 | break; |
152 | break; |
153 | case '6': |
153 | case '6': |
154 | // Удаление существующей версии дистрибутива
|
154 | // Удаление существующей версии дистрибутива
|
155 | $versID = abs(intval($_POST["versID"])); |
155 | $versID = abs(intval($_POST["versID"])); |
156 | 156 | ||
157 | $res =& $db->query("DELETE FROM version WHERE version_id='$versID'"); |
157 | $res =& $db->query("DELETE FROM version WHERE version_id='$versID'"); |
158 | $res =& $db->query("DELETE FROM ver2rep WHERE ver_id='$versID'"); |
158 | $res =& $db->query("DELETE FROM ver2rep WHERE ver_id='$versID'"); |
159 | 159 | ||
160 | break; |
160 | break; |
161 | case '7': |
161 | case '7': |
162 | // Добавление нового репозитория
|
162 | // Добавление нового репозитория
|
163 | $versID = abs(intval($_POST["vers"])); |
163 | $versID = abs(intval($_POST["vers"])); |
164 | $repname = mysql_real_escape_string($_POST["repName"]); |
164 | $repname = mysql_real_escape_string($_POST["repName"]); |
165 | $repinfo = mysql_real_escape_string($_POST["repInfo"]); |
165 | $repinfo = mysql_real_escape_string($_POST["repInfo"]); |
166 | $repsche = abs(intval($_POST["scheme"])); |
166 | $repsche = abs(intval($_POST["scheme"])); |
167 | $reptype = abs(intval($_POST["rtype"])); |
167 | $reptype = abs(intval($_POST["rtype"])); |
168 | 168 | ||
169 | $res =& $db->query("INSERT INTO repository SET repname='$repname', repdescribe='$repinfo', scheme_id='$repsche', rtype_id='$reptype'"); |
169 | $res =& $db->query("INSERT INTO repository SET repname='$repname', repdescribe='$repinfo', scheme_id='$repsche', rtype_id='$reptype'"); |
170 | $res =& $db->query("SELECT rep_id FROM repository ORDER BY rep_id DESC LIMIT 1"); |
170 | $res =& $db->query("SELECT rep_id FROM repository ORDER BY rep_id DESC LIMIT 1"); |
171 | $res->fetchInto($rep, DB_FETCHMODE_ASSOC); |
171 | $res->fetchInto($rep, DB_FETCHMODE_ASSOC); |
172 | $rep_id = $rep["rep_id"]; |
172 | $rep_id = $rep["rep_id"]; |
173 | 173 | ||
174 | $res =& $db->query("INSERT INTO ver2rep SET ver_id='$versID', rep_id='$rep_id'"); |
174 | $res =& $db->query("INSERT INTO ver2rep SET ver_id='$versID', rep_id='$rep_id'"); |
175 | 175 | ||
176 | for ($i=0;$i<count($_POST["sect"]);$i++) { |
176 | for ($i=0;$i<count($_POST["sect"]);$i++) { |
177 | $res =& $db->query("INSERT INTO sect2rep SET sect_id='".$_POST["sect"][$i]."', rep_id='$rep_id'"); |
177 | $res =& $db->query("INSERT INTO sect2rep SET sect_id='".$_POST["sect"][$i]."', rep_id='$rep_id'"); |
178 | }
|
178 | }
|
179 | break; |
179 | break; |
180 | case '8': |
180 | case '8': |
181 | // Правка репозитория
|
181 | // Правка репозитория
|
182 | $repID = abs(intval($_POST["rep"])); |
182 | $repID = abs(intval($_POST["rep"])); |
183 | $repname = mysql_real_escape_string($_POST["repName"]); |
183 | $repname = mysql_real_escape_string($_POST["repName"]); |
184 | $repinfo = mysql_real_escape_string($_POST["repInfo"]); |
184 | $repinfo = mysql_real_escape_string($_POST["repInfo"]); |
185 | $repsche = abs(intval($_POST["scheme"])); |
185 | $repsche = abs(intval($_POST["scheme"])); |
186 | $reptype = abs(intval($_POST["rtype"])); |
186 | $reptype = abs(intval($_POST["rtype"])); |
187 | 187 | ||
188 | $res =& $db->query("UPDATE repository SET repname='$repname', repdescribe='$repinfo', scheme_id='$repsche', rtype_id='$reptype' WHERE rep_id='$repID'"); |
188 | $res =& $db->query("UPDATE repository SET repname='$repname', repdescribe='$repinfo', scheme_id='$repsche', rtype_id='$reptype' WHERE rep_id='$repID'"); |
189 | $res =& $db->query("DELETE FROM sect2rep WHERE rep_id='$repID'"); |
189 | $res =& $db->query("DELETE FROM sect2rep WHERE rep_id='$repID'"); |
190 | for ($i=0;$i<count($_POST["sect"]);$i++) { |
190 | for ($i=0;$i<count($_POST["sect"]);$i++) { |
191 | $res =& $db->query("INSERT INTO sect2rep SET sect_id='".$_POST["sect"][$i]."', rep_id='$repID'"); |
191 | $res =& $db->query("INSERT INTO sect2rep SET sect_id='".$_POST["sect"][$i]."', rep_id='$repID'"); |
192 | }
|
192 | }
|
193 | break; |
193 | break; |
194 | case '9': |
194 | case '9': |
195 | // Удаление репозитория
|
195 | // Удаление репозитория
|
196 | $repID = abs(intval($_POST["rep"])); |
196 | $repID = abs(intval($_POST["rep"])); |
197 | 197 | ||
198 | $res =& $db->query("DELETE FROM repository WHERE rep_id='$repID'"); |
198 | $res =& $db->query("DELETE FROM repository WHERE rep_id='$repID'"); |
199 | $res =& $db->query("DELETE FROM sect2rep WHERE rep_id='$repID'"); |
199 | $res =& $db->query("DELETE FROM sect2rep WHERE rep_id='$repID'"); |
200 | $res =& $db->query("DELETE FROM ver2rep WHERE rep_id='$repID'"); |
200 | $res =& $db->query("DELETE FROM ver2rep WHERE rep_id='$repID'"); |
201 | 201 | ||
202 | break; |
202 | break; |
203 | case '10': |
203 | case '10': |
204 | // Создание секции
|
204 | // Создание секции
|
205 | $sectname = mysql_real_escape_string($_POST["sectName"]); |
205 | $sectname = mysql_real_escape_string($_POST["sectName"]); |
206 | $sectinfo = mysql_real_escape_string($_POST["sectInfo"]); |
206 | $sectinfo = mysql_real_escape_string($_POST["sectInfo"]); |
207 | 207 | ||
208 | $req =& $db->query("INSERT INTO section SET sectname='$sectname', sectinfo='$sectinfo'"); |
208 | $req =& $db->query("INSERT INTO section SET sectname='$sectname', sectinfo='$sectinfo'"); |
209 | $req =& $db->query("SELECT sect_id FROM section ORDER BY sect_id DESC LIMIT 1"); |
209 | $req =& $db->query("SELECT sect_id FROM section ORDER BY sect_id DESC LIMIT 1"); |
210 | $req->fetchInto($sect, DB_FETCHMODE_ASSOC); |
210 | $req->fetchInto($sect, DB_FETCHMODE_ASSOC); |
211 | 211 | ||
212 | for($i=0;$i<count($_POST["dist"]);$i++) { |
212 | for($i=0;$i<count($_POST["dist"]);$i++) { |
213 | $req =& $db->query("INSERT INTO sect2dist SET dist_id='".$_POST["dist"][$i]."', sect_id='".$sect["sect_id"]."'"); |
213 | $req =& $db->query("INSERT INTO sect2dist SET dist_id='".$_POST["dist"][$i]."', sect_id='".$sect["sect_id"]."'"); |
214 | }
|
214 | }
|
215 | 215 | ||
216 | break; |
216 | break; |
217 | case '11': |
217 | case '11': |
218 | // Правка секции
|
218 | // Правка секции
|
219 | $sectID = abs(intval($_POST["sectID"])); |
219 | $sectID = abs(intval($_POST["sectID"])); |
220 | $sectname = mysql_real_escape_string($_POST["sectName"]); |
220 | $sectname = mysql_real_escape_string($_POST["sectName"]); |
221 | $sectinfo = mysql_real_escape_string($_POST["sectInfo"]); |
221 | $sectinfo = mysql_real_escape_string($_POST["sectInfo"]); |
222 | 222 | ||
223 | $req =& $db->query("UPDATE section SET sectname='$sectname', sectinfo='$sectinfo' WHERE sect_id='$sectID'"); |
223 | $req =& $db->query("UPDATE section SET sectname='$sectname', sectinfo='$sectinfo' WHERE sect_id='$sectID'"); |
224 | $req =& $db->query("DELETE FROM sect2dist WHERE sect_id='$sectID'"); |
224 | $req =& $db->query("DELETE FROM sect2dist WHERE sect_id='$sectID'"); |
225 | 225 | ||
226 | for($i=0;$i<count($_POST["dist"]);$i++) { |
226 | for($i=0;$i<count($_POST["dist"]);$i++) { |
227 | $req =& $db->query("INSERT INTO sect2dist SET dist_id='".$_POST["dist"][$i]."', sect_id='".$sectID."'"); |
227 | $req =& $db->query("INSERT INTO sect2dist SET dist_id='".$_POST["dist"][$i]."', sect_id='".$sectID."'"); |
228 | }
|
228 | }
|
229 | 229 | ||
230 | break; |
230 | break; |
231 | case '12': |
231 | case '12': |
232 | // Удаление секции
|
232 | // Удаление секции
|
233 | $sectID = abs(intval($_POST["sectID"])); |
233 | $sectID = abs(intval($_POST["sectID"])); |
234 | 234 | ||
235 | $req =& $db->query("DELETE FROM section WHERE sect_id='$sectID'"); |
235 | $req =& $db->query("DELETE FROM section WHERE sect_id='$sectID'"); |
236 | $req =& $db->query("DELETE FROM sect2dist WHERE sect_id='$sectID'"); |
236 | $req =& $db->query("DELETE FROM sect2dist WHERE sect_id='$sectID'"); |
237 | $req =& $db->query("DELETE FROM sect2rep WHERE sect_id='$sectID'"); |
237 | $req =& $db->query("DELETE FROM sect2rep WHERE sect_id='$sectID'"); |
238 | 238 | ||
239 | break; |
239 | break; |
240 | case '13': |
240 | case '13': |
241 | // Добавление новой схемы
|
241 | // Добавление новой схемы
|
242 | $scheme = mysql_real_escape_string($_POST["scheme"]); |
242 | $scheme = mysql_real_escape_string($_POST["scheme"]); |
243 | 243 | ||
244 | $req =& $db->query("INSERT INTO scheme SET scheme='$scheme'"); |
244 | $req =& $db->query("INSERT INTO scheme SET scheme='$scheme'"); |
245 | 245 | ||
246 | break; |
246 | break; |
247 | case '14': |
247 | case '14': |
248 | // Правка схемы
|
248 | // Правка схемы
|
249 | $schemeID = abs(intval($_POST["schemeID"])); |
249 | $schemeID = abs(intval($_POST["schemeID"])); |
250 | $scheme = mysql_real_escape_string($_POST["scheme"]); |
250 | $scheme = mysql_real_escape_string($_POST["scheme"]); |
251 | 251 | ||
252 | $req =& $db->query("UPDATE scheme SET scheme='$scheme' WHERE scheme_id='$schemeID'"); |
252 | $req =& $db->query("UPDATE scheme SET scheme='$scheme' WHERE scheme_id='$schemeID'"); |
253 | 253 | ||
254 | break; |
254 | break; |
255 | case '15': |
255 | case '15': |
256 | // Удаление схемы
|
256 | // Удаление схемы
|
257 | $schemeID = abs(intval($_POST["schemeID"])); |
257 | $schemeID = abs(intval($_POST["schemeID"])); |
258 | 258 | ||
259 | $req =& $db->query("DELETE FROM scheme WHERE scheme_id='$schemeID'"); |
259 | $req =& $db->query("DELETE FROM scheme WHERE scheme_id='$schemeID'"); |
260 | 260 | ||
261 | break; |
261 | break; |
262 | case '16': |
262 | case '16': |
263 | // Добавление новой настройки Ant
|
263 | // Добавление новой настройки Ant
|
264 | $option = mysql_real_escape_string($_POST["setoption"]); |
264 | $option = mysql_real_escape_string($_POST["setoption"]); |
265 | $value = mysql_real_escape_string($_POST["setvalue"]); |
265 | $value = mysql_real_escape_string($_POST["setvalue"]); |
266 | 266 | ||
267 | $req =& $db->query("INSERT INTO settings SET opt='$option', optvalue='$value'"); |
267 | $req =& $db->query("INSERT INTO settings SET opt='$option', optvalue='$value'"); |
268 | 268 | ||
269 | break; |
269 | break; |
270 | case '17': |
270 | case '17': |
271 | // Правка настройки Ant
|
271 | // Правка настройки Ant
|
272 | $optID = abs(intval($_POST["optID"])); |
272 | $optID = abs(intval($_POST["optID"])); |
273 | $option = mysql_real_escape_string($_POST["setoption"]); |
273 | $option = mysql_real_escape_string($_POST["setoption"]); |
274 | $value = mysql_real_escape_string($_POST["setvalue"]); |
274 | $value = mysql_real_escape_string($_POST["setvalue"]); |
275 | 275 | ||
276 | $req =& $db->query("UPDATE settings SET opt='$option', optvalue='$value' WHERE opt_id='$optID'"); |
276 | $req =& $db->query("UPDATE settings SET opt='$option', optvalue='$value' WHERE opt_id='$optID'"); |
277 | 277 | ||
278 | break; |
278 | break; |
279 | case '18': |
279 | case '18': |
280 | // Удаление настройки
|
280 | // Удаление настройки
|
281 | $optID = abs(intval($_POST["optID"])); |
281 | $optID = abs(intval($_POST["optID"])); |
282 | 282 | ||
283 | $req =& $db->query("DELETE FROM settings WHERE opt_id='$optID'"); |
283 | $req =& $db->query("DELETE FROM settings WHERE opt_id='$optID'"); |
284 | 284 | ||
285 | break; |
285 | break; |
286 | case '19': |
286 | case '19': |
287 | // Добавление нового типа репозитория
|
287 | // Добавление нового типа репозитория
|
288 | $rtype = mysql_real_escape_string($_POST["rtype"]); |
288 | $rtype = mysql_real_escape_string($_POST["rtype"]); |
289 | 289 | ||
290 | $req =& $db->query("INSERT INTO rtype SET rtype='$rtype'"); |
290 | $req =& $db->query("INSERT INTO rtype SET rtype='$rtype'"); |
291 | 291 | ||
292 | break; |
292 | break; |
293 | case '20': |
293 | case '20': |
294 | // Правка существующего типа репозитория
|
294 | // Правка существующего типа репозитория
|
295 | $rtypeID = abs(intval($_POST["rtypeID"])); |
295 | $rtypeID = abs(intval($_POST["rtypeID"])); |
296 | $rtype = mysql_real_escape_string($_POST["rtype"]); |
296 | $rtype = mysql_real_escape_string($_POST["rtype"]); |
297 | 297 | ||
298 | $req =& $db->query("UPDATE rtype SET rtype='$rtype' WHERE rtype_id='$rtypeID'"); |
298 | $req =& $db->query("UPDATE rtype SET rtype='$rtype' WHERE rtype_id='$rtypeID'"); |
299 | 299 | ||
300 | break; |
300 | break; |
301 | case '21': |
301 | case '21': |
302 | // Удаление типа репозитория
|
302 | // Удаление типа репозитория
|
303 | $rtypeID = abs(intval($_POST["rtypeID"])); |
303 | $rtypeID = abs(intval($_POST["rtypeID"])); |
304 | 304 | ||
305 | $req =& $db->query("DELETE FROM rtype WHERE rtype_id='$rtypeID'"); |
305 | $req =& $db->query("DELETE FROM rtype WHERE rtype_id='$rtypeID'"); |
306 | 306 | ||
307 | break; |
307 | break; |
308 | case '22': |
308 | case '22': |
309 | // Смена пароля
|
309 | // Смена пароля
|
310 | // $OID = abs(intval($_POST["OID"]));
|
310 | // $OID = abs(intval($_POST["OID"]));
|
311 | $oldpass = mysql_real_escape_string($_POST["oldPW"]); |
311 | $oldpass = mysql_real_escape_string($_POST["oldPW"]); |
312 | $newpass1 = mysql_real_escape_string($_POST["newPW1"]); |
312 | $newpass1 = mysql_real_escape_string($_POST["newPW1"]); |
313 | $newpass2 = mysql_real_escape_string($_POST["newPW2"]); |
313 | $newpass2 = mysql_real_escape_string($_POST["newPW2"]); |
314 | 314 | ||
315 | $errpwd = 0; |
315 | $errpwd = 0; |
316 | $spass = md5($newpass1."ANT"); |
316 | $spass = md5($newpass1."ANT"); |
317 | $soldpass = md5($oldpass."ANT"); |
317 | $soldpass = md5($oldpass."ANT"); |
318 | if ($soldpass != $_COOKIE[$CookiePasswd]) { |
318 | if ($soldpass != $_COOKIE[$CookiePasswd]) { |
319 | $go .= "?error=1"; |
319 | $go .= "?error=1"; |
320 | $errpwd = 1; |
320 | $errpwd = 1; |
321 | }
|
321 | }
|
322 | if ($newpass1 != $newpass2) { |
322 | if ($newpass1 != $newpass2) { |
323 | $go .= "?error=2"; |
323 | $go .= "?error=2"; |
324 | $errpwd = 2; |
324 | $errpwd = 2; |
325 | }
|
325 | }
|
326 | 326 | ||
327 | if ($errpwd==0) { |
327 | if ($errpwd==0) { |
328 | // fix: Для многопользовательского варианта придется запрос переписать
|
328 | // fix: Для многопользовательского варианта придется запрос переписать
|
329 | $req =& $db->query("UPDATE owner SET passwd='$spass' WHERE login='admin'"); |
329 | $req =& $db->query("UPDATE owner SET passwd='$spass' WHERE login='admin'"); |
330 | }
|
330 | }
|
331 | 331 | ||
332 | break; |
332 | break; |
333 | case '23': |
333 | case '23': |
334 | // Добавление интерфейса
|
334 | // Добавление интерфейса
|
335 | $ifname = mysql_real_escape_string($_POST["ifname"]); |
335 | $ifname = mysql_real_escape_string($_POST["ifname"]); |
336 | $ifinfo = mysql_real_escape_string($_POST["ifinfo"]); |
336 | $ifinfo = mysql_real_escape_string($_POST["ifinfo"]); |
337 | $ifname = str_replace(".php","",$ifname); |
337 | $ifname = str_replace(".php","",$ifname); |
338 | $req =& $db->query("INSERT INTO interfaces SET interface='$ifname', interfaceinfo='$ifinfo'"); |
338 | $req =& $db->query("INSERT INTO interfaces SET interface='$ifname', interfaceinfo='$ifinfo'"); |
339 | break; |
339 | break; |
340 | case '24': |
340 | case '24': |
341 | // Правка интерфейса
|
341 | // Правка интерфейса
|
342 | $ifname = mysql_real_escape_string($_POST["ifname"]); |
342 | $ifname = mysql_real_escape_string($_POST["ifname"]); |
343 | $ifinfo = mysql_real_escape_string($_POST["ifinfo"]); |
343 | $ifinfo = mysql_real_escape_string($_POST["ifinfo"]); |
344 | $if = abs(intval($_POST["if"])); |
344 | $if = abs(intval($_POST["if"])); |
345 | $ifname = str_replace(".php","",$ifname); |
345 | $ifname = str_replace(".php","",$ifname); |
346 | $req =& $db->query("UPDATE interfaces SET interface='$ifname', interfaceinfo='$ifinfo' WHERE if_id='$if'"); |
346 | $req =& $db->query("UPDATE interfaces SET interface='$ifname', interfaceinfo='$ifinfo' WHERE if_id='$if'"); |
347 | break; |
347 | break; |
348 | case '25': |
348 | case '25': |
349 | // Удаление интерфейса
|
349 | // Удаление интерфейса
|
350 | $if = abs(intval($_POST["if"])); |
350 | $if = abs(intval($_POST["if"])); |
351 | $req =& $db->query("DELETE FROM interfaces WHERE if_id='$if'"); |
351 | $req =& $db->query("DELETE FROM interfaces WHERE if_id='$if'"); |
352 | break; |
352 | break; |
353 | }
|
353 | }
|
354 | 354 | ||
355 | header("Location: $go\n\n"); |
355 | header("Location: $go\n\n"); |
356 | 356 | ||
357 | ?>
|
357 | ?>
|
358 | 358 |