Редакция 531 | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 531 | Редакция 532 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | /**
|
3 | /**
|
4 | *
|
4 | *
|
5 | * Codename: ant-ng - generator of sources.list for Debian and
|
5 | * Codename: ant-ng - generator of sources.list for Debian and
|
6 | * distributives, based on Debian
|
6 | * distributives, based on Debian
|
7 | * http://alex-w.org.ru/p/antng/
|
7 | * http://alex-w.org.ru/p/antng/
|
8 | *
|
8 | *
|
9 | * Copyright (c) 2009 Alexander Wolf
|
9 | * Copyright (c) 2009 Alexander Wolf
|
10 | * Dual licensed under the MIT and GNU LGPL licenses.
|
10 | * Dual licensed under the MIT and GNU LGPL licenses.
|
11 | * http://alex-w.org.ru/p/antng/license
|
11 | * http://alex-w.org.ru/p/antng/license
|
12 | *
|
12 | *
|
13 | */
|
13 | */
|
14 | 14 | ||
15 | require_once dirname(__FILE__)."/init.php"; |
15 | require_once dirname(__FILE__)."/init.php"; |
16 | 16 | ||
17 | $mode = $_POST["mode"]; |
17 | $mode = $_POST["mode"]; |
18 | 18 | ||
19 | switch ($mode) { |
19 | switch ($mode) { |
20 | case 'authorize': |
20 | case 'authorize': |
21 | $r = $core->checkSign($_POST["word"]); |
21 | $r = $core->checkSign($_POST["word"]); |
22 | header("Location: ".$r["Location"]."\n\n"); |
22 | header("Location: ".$r["Location"]."\n\n"); |
23 | break; |
23 | break; |
24 | case 'distributive-add': |
24 | case 'distributive-add': |
25 | // Добавление нового дистрибутива
|
25 | // Добавление нового дистрибутива
|
26 | $DName = $secure->checkStr($_POST["dname"],1); |
26 | $DName = $secure->checkStr($_POST["dname"],1); |
27 | $DUA = $secure->checkStr($_POST["dua"],1); |
27 | $DUA = $secure->checkStr($_POST["dua"],1); |
28 | $DType = $secure->checkInt($_POST["dtype"]); |
28 | $DType = $secure->checkInt($_POST["dtype"]); |
29 | $DLogo = 0; |
29 | $DLogo = 0; |
30 | 30 | ||
31 | if ($_FILES["distlogo"]["type"]!=0) { |
31 | if ($_FILES["distlogo"]["type"]!=0) { |
32 | $folder = $picture.$DUA."-orig.png"; |
32 | $folder = $picture.$DUA."-orig.png"; |
33 | $folderN = $picture.$DUA.".png"; |
33 | $folderN = $picture.$DUA.".png"; |
34 | $folderEM = $picture.$DUA."-em.png"; |
34 | $folderEM = $picture.$DUA."-em.png"; |
35 | 35 | ||
36 | if (move_uploaded_file($_FILES["distlogo"]["tmp_name"],$folder)) { |
36 | if (move_uploaded_file($_FILES["distlogo"]["tmp_name"],$folder)) { |
37 | chmod($folder, 0644); |
37 | chmod($folder, 0644); |
38 | list($width, $height) = GetImageSize($folder); |
38 | list($width, $height) = GetImageSize($folder); |
39 | $percent = 32/$height; |
39 | $percent = 32/$height; |
40 | $newwidth = $width * $percent; |
40 | $newwidth = $width * $percent; |
41 | $newheight = $height * $percent; |
41 | $newheight = $height * $percent; |
42 | 42 | ||
43 | $output = ImageCreateTrueColor($newwidth, $newheight); |
43 | $output = ImageCreateTrueColor($newwidth, $newheight); |
44 | $source = ImageCreateFromPNG($folder); |
44 | $source = ImageCreateFromPNG($folder); |
45 | 45 | ||
46 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
46 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
47 | ImagePNG($output, $folderEM); |
47 | ImagePNG($output, $folderEM); |
48 | 48 | ||
49 | $percent = 15/$height; |
49 | $percent = 15/$height; |
50 | $newwidth = $width * $percent; |
50 | $newwidth = $width * $percent; |
51 | $newheight = $height * $percent; |
51 | $newheight = $height * $percent; |
52 | 52 | ||
53 | $output = ImageCreateTrueColor($newwidth, $newheight); |
53 | $output = ImageCreateTrueColor($newwidth, $newheight); |
54 | 54 | ||
55 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
55 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
56 | ImagePNG($output, $folderN); |
56 | ImagePNG($output, $folderN); |
57 | 57 | ||
58 | unlink($folder); |
58 | unlink($folder); |
59 | $DLogo = 1; |
59 | $DLogo = 1; |
60 | }
|
60 | }
|
61 | }
|
61 | }
|
62 | 62 | ||
63 | $r = $core->addDistribution($DName, $DType, $DUA, $DLogo); |
63 | $r = $core->addDistribution($DName, $DType, $DUA, $DLogo); |
64 | if ($r["ERR"]==0) { |
64 | if ($r["ERR"]==0) { |
65 | header("Location: ".$manager."\n\n"); |
65 | header("Location: ".$manager."\n\n"); |
66 | } else { |
66 | } else { |
67 | echo $r["ERRINFO"]; |
67 | echo $r["ERRINFO"]; |
68 | }
|
68 | }
|
69 | 69 | ||
70 | break; |
70 | break; |
71 | case 'distributive-edit': |
71 | case 'distributive-edit': |
72 | // Редактирование информации о дистрибутиве
|
72 | // Редактирование информации о дистрибутиве
|
73 | $ID = $secure->checkInt($_POST["distID"]); |
73 | $ID = $secure->checkInt($_POST["distID"]); |
74 | $DName = $secure->checkStr($_POST["dname"],1); |
74 | $DName = $secure->checkStr($_POST["dname"],1); |
75 | $DUA = $secure->checkStr($_POST["dua"],1); |
75 | $DUA = $secure->checkStr($_POST["dua"],1); |
76 | $DType = $secure->checkInt($_POST["dtype"]); |
76 | $DType = $secure->checkInt($_POST["dtype"]); |
77 | $DLogo = 0; |
77 | $DLogo = 0; |
78 | 78 | ||
79 | if ($_FILES["distlogo"]["type"]!=0) { |
79 | if ($_FILES["distlogo"]["type"]!=0) { |
80 | $folder = $picture.$DUA."-orig.png"; |
80 | $folder = $picture.$DUA."-orig.png"; |
81 | $folderN = $picture.$DUA.".png"; |
81 | $folderN = $picture.$DUA.".png"; |
82 | $folderEM = $picture.$DUA."-em.png"; |
82 | $folderEM = $picture.$DUA."-em.png"; |
83 | 83 | ||
- | 84 | // debug on
|
|
- | 85 | echo $folder; |
|
- | 86 | ||
84 | if (move_uploaded_file($_FILES["distlogo"]["tmp_name"],$folder)) { |
87 | if (move_uploaded_file($_FILES["distlogo"]["tmp_name"],$folder)) { |
85 | chmod($folder, 0644); |
88 | chmod($folder, 0644); |
86 | list($width, $height) = GetImageSize($folder); |
89 | list($width, $height) = GetImageSize($folder); |
87 | $percent = 32/$height; |
90 | $percent = 32/$height; |
88 | $newwidth = $width * $percent; |
91 | $newwidth = $width * $percent; |
89 | $newheight = $height * $percent; |
92 | $newheight = $height * $percent; |
90 | 93 | ||
91 | $output = ImageCreateTrueColor($newwidth, $newheight); |
94 | $output = ImageCreateTrueColor($newwidth, $newheight); |
92 | $source = ImageCreateFromPNG($folder); |
95 | $source = ImageCreateFromPNG($folder); |
93 | 96 | ||
94 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
97 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
95 | ImagePNG($output, $folderEM); |
98 | ImagePNG($output, $folderEM); |
96 | 99 | ||
97 | $percent = 15/$height; |
100 | $percent = 15/$height; |
98 | $newwidth = $width * $percent; |
101 | $newwidth = $width * $percent; |
99 | $newheight = $height * $percent; |
102 | $newheight = $height * $percent; |
100 | 103 | ||
101 | $output = ImageCreateTrueColor($newwidth, $newheight); |
104 | $output = ImageCreateTrueColor($newwidth, $newheight); |
102 | 105 | ||
103 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
106 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
104 | ImagePNG($output, $folderN); |
107 | ImagePNG($output, $folderN); |
105 | 108 | ||
106 | unlink($folder); |
109 | unlink($folder); |
107 | $DLogo = 1; |
110 | $DLogo = 1; |
108 | }
|
111 | }
|
109 | }
|
112 | }
|
110 | 113 | ||
111 | $r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo); |
114 | $r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo); |
112 | if ($r["ERR"]==0) { |
115 | if ($r["ERR"]==0) { |
113 | header("Location: ".$manager."\n\n"); |
116 | //header("Location: ".$manager."\n\n");
|
114 | } else { |
117 | } else { |
115 | echo $r["ERRINFO"]; |
118 | echo $r["ERRINFO"]; |
116 | }
|
119 | }
|
117 | 120 | ||
118 | break; |
121 | break; |
119 | case 'distributive-delete': |
122 | case 'distributive-delete': |
120 | // Удаление информации о дистрибутиве
|
123 | // Удаление информации о дистрибутиве
|
121 | $ID = $secure->checkInt($_POST["distID"]); |
124 | $ID = $secure->checkInt($_POST["distID"]); |
122 | 125 | ||
123 | $r = $core->dropDistribution($ID); |
126 | $r = $core->dropDistribution($ID); |
124 | if ($r["ERR"]==0) { |
127 | if ($r["ERR"]==0) { |
125 | header("Location: ".$manager."\n\n"); |
128 | header("Location: ".$manager."\n\n"); |
126 | } else { |
129 | } else { |
127 | echo $r["ERRINFO"]; |
130 | echo $r["ERRINFO"]; |
128 | }
|
131 | }
|
129 | 132 | ||
130 | break; |
133 | break; |
131 | case 'version-add': |
134 | case 'version-add': |
132 | // Добавление новой версии дистрибутива
|
135 | // Добавление новой версии дистрибутива
|
133 | $DistID = $secure->checkInt($_POST["distname"]); |
136 | $DistID = $secure->checkInt($_POST["distname"]); |
134 | $VName = $secure->checkStr($_POST["vname"],1); |
137 | $VName = $secure->checkStr($_POST["vname"],1); |
135 | $VNmbr = $secure->checkStr($_POST["version"],1); |
138 | $VNmbr = $secure->checkStr($_POST["version"],1); |
136 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
139 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
137 | 140 | ||
138 | $r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme); |
141 | $r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme); |
139 | if ($r["ERR"]==0) { |
142 | if ($r["ERR"]==0) { |
140 | header("Location: ".$manager."\n\n"); |
143 | header("Location: ".$manager."\n\n"); |
141 | } else { |
144 | } else { |
142 | echo $r["ERRINFO"]; |
145 | echo $r["ERRINFO"]; |
143 | }
|
146 | }
|
144 | 147 | ||
145 | break; |
148 | break; |
146 | case 'version-edit': |
149 | case 'version-edit': |
147 | // Редактирование версии дистрибутива
|
150 | // Редактирование версии дистрибутива
|
148 | $versID = $secure->checkInt($_POST["versionID"]); |
151 | $versID = $secure->checkInt($_POST["versionID"]); |
149 | $VName = $secure->checkStr($_POST["vname"],1); |
152 | $VName = $secure->checkStr($_POST["vname"],1); |
150 | $VNmbr = $secure->checkStr($_POST["version"],1); |
153 | $VNmbr = $secure->checkStr($_POST["version"],1); |
151 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
154 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
152 | 155 | ||
153 | $r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme); |
156 | $r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme); |
154 | if ($r["ERR"]==0) { |
157 | if ($r["ERR"]==0) { |
155 | header("Location: ".$manager."\n\n"); |
158 | header("Location: ".$manager."\n\n"); |
156 | } else { |
159 | } else { |
157 | echo $r["ERRINFO"]; |
160 | echo $r["ERRINFO"]; |
158 | }
|
161 | }
|
159 | 162 | ||
160 | break; |
163 | break; |
161 | case 'version-delete': |
164 | case 'version-delete': |
162 | // Удаление версии дистрибутива
|
165 | // Удаление версии дистрибутива
|
163 | $versID = $secure->checkInt($_POST["versionID"]); |
166 | $versID = $secure->checkInt($_POST["versionID"]); |
164 | 167 | ||
165 | $r = $core->dropDistVersion($versID); |
168 | $r = $core->dropDistVersion($versID); |
166 | if ($r["ERR"]==0) { |
169 | if ($r["ERR"]==0) { |
167 | header("Location: ".$manager."\n\n"); |
170 | header("Location: ".$manager."\n\n"); |
168 | } else { |
171 | } else { |
169 | echo $r["ERRINFO"]; |
172 | echo $r["ERRINFO"]; |
170 | }
|
173 | }
|
171 | 174 | ||
172 | break; |
175 | break; |
173 | case 'section-add': |
176 | case 'section-add': |
174 | // Добавление новой секции
|
177 | // Добавление новой секции
|
175 | $SName = $secure->checkStr($_POST["sname"],1); |
178 | $SName = $secure->checkStr($_POST["sname"],1); |
176 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
179 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
177 | 180 | ||
178 | $r = $core->addSection($SName, $SInfo); |
181 | $r = $core->addSection($SName, $SInfo); |
179 | if ($r["ERR"]==0) { |
182 | if ($r["ERR"]==0) { |
180 | header("Location: ".$manager."\n\n"); |
183 | header("Location: ".$manager."\n\n"); |
181 | } else { |
184 | } else { |
182 | echo $r["ERRINFO"]; |
185 | echo $r["ERRINFO"]; |
183 | }
|
186 | }
|
184 | 187 | ||
185 | break; |
188 | break; |
186 | case 'section-edit': |
189 | case 'section-edit': |
187 | // Редактирование информации о секции
|
190 | // Редактирование информации о секции
|
188 | $sectID = $secure->checkInt($_POST["sectionID"]); |
191 | $sectID = $secure->checkInt($_POST["sectionID"]); |
189 | $SName = $secure->checkStr($_POST["sname"],1); |
192 | $SName = $secure->checkStr($_POST["sname"],1); |
190 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
193 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
191 | 194 | ||
192 | $r = $core->updateSection($sectID, $SName, $SInfo); |
195 | $r = $core->updateSection($sectID, $SName, $SInfo); |
193 | if ($r["ERR"]==0) { |
196 | if ($r["ERR"]==0) { |
194 | header("Location: ".$manager."\n\n"); |
197 | header("Location: ".$manager."\n\n"); |
195 | } else { |
198 | } else { |
196 | echo $r["ERRINFO"]; |
199 | echo $r["ERRINFO"]; |
197 | }
|
200 | }
|
198 | 201 | ||
199 | break; |
202 | break; |
200 | case 'section-delete': |
203 | case 'section-delete': |
201 | // Удаление информации о секции
|
204 | // Удаление информации о секции
|
202 | $sectID = $secure->checkInt($_POST["sectionID"]); |
205 | $sectID = $secure->checkInt($_POST["sectionID"]); |
203 | 206 | ||
204 | $r = $core->dropSection($sectID); |
207 | $r = $core->dropSection($sectID); |
205 | if ($r["ERR"]==0) { |
208 | if ($r["ERR"]==0) { |
206 | header("Location: ".$manager."\n\n"); |
209 | header("Location: ".$manager."\n\n"); |
207 | } else { |
210 | } else { |
208 | echo $r["ERRINFO"]; |
211 | echo $r["ERRINFO"]; |
209 | }
|
212 | }
|
210 | 213 | ||
211 | break; |
214 | break; |
212 | }
|
215 | }
|
213 | 216 | ||
214 | ?>
|
217 | ?>
|
215 | 218 |