Редакция 528 | Редакция 531 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 528 | Редакция 529 | ||
---|---|---|---|
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 ($_POST["distlogo"]!="") { |
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 | // debug on
|
79 | // debug on
|
- | 80 | phpinfo(); |
|
80 | echo $_FILES["distlogo"]["type"].":".$_FILES["distlogo"]["tmp_name"]; |
81 | echo $_FILES["distlogo"]["type"].":".$_FILES["distlogo"]["tmp_name"]; |
81 | 82 | ||
82 | if ($_POST["distlogo"]!="") { |
83 | if ($_FILES["distlogo"]["type"]!=0) { |
83 | $folder = $picture.$DUA."-orig.png"; |
84 | $folder = $picture.$DUA."-orig.png"; |
84 | $folderN = $picture.$DUA.".png"; |
85 | $folderN = $picture.$DUA.".png"; |
85 | $folderEM = $picture.$DUA."-em.png"; |
86 | $folderEM = $picture.$DUA."-em.png"; |
86 | 87 | ||
87 | if (move_uploaded_file($_FILES["distlogo"]["tmp_name"],$folder)) { |
88 | if (move_uploaded_file($_FILES["distlogo"]["tmp_name"],$folder)) { |
88 | chmod($folder, 0644); |
89 | chmod($folder, 0644); |
89 | list($width, $height) = GetImageSize($folder); |
90 | list($width, $height) = GetImageSize($folder); |
90 | $percent = 32/$height; |
91 | $percent = 32/$height; |
91 | $newwidth = $width * $percent; |
92 | $newwidth = $width * $percent; |
92 | $newheight = $height * $percent; |
93 | $newheight = $height * $percent; |
93 | 94 | ||
94 | $output = ImageCreateTrueColor($newwidth, $newheight); |
95 | $output = ImageCreateTrueColor($newwidth, $newheight); |
95 | $source = ImageCreateFromPNG($folder); |
96 | $source = ImageCreateFromPNG($folder); |
96 | 97 | ||
97 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
98 | ImageCopyResampled($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
98 | ImagePNG($output, $folderEM); |
99 | ImagePNG($output, $folderEM); |
99 | 100 | ||
100 | $percent = 15/$height; |
101 | $percent = 15/$height; |
101 | $newwidth = $width * $percent; |
102 | $newwidth = $width * $percent; |
102 | $newheight = $height * $percent; |
103 | $newheight = $height * $percent; |
103 | 104 | ||
104 | $output = ImageCreateTrueColor($newwidth, $newheight); |
105 | $output = ImageCreateTrueColor($newwidth, $newheight); |
105 | 106 | ||
106 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
107 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
107 | ImagePNG($output, $folderN); |
108 | ImagePNG($output, $folderN); |
108 | 109 | ||
109 | unlink($folder); |
110 | unlink($folder); |
110 | $DLogo = 1; |
111 | $DLogo = 1; |
111 | }
|
112 | }
|
112 | }
|
113 | }
|
113 | 114 | ||
114 | $r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo); |
115 | $r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo); |
115 | if ($r["ERR"]==0) { |
116 | if ($r["ERR"]==0) { |
116 | //header("Location: ".$manager."\n\n");
|
117 | //header("Location: ".$manager."\n\n");
|
117 | } else { |
118 | } else { |
118 | echo $r["ERRINFO"]; |
119 | echo $r["ERRINFO"]; |
119 | }
|
120 | }
|
120 | 121 | ||
121 | break; |
122 | break; |
122 | case 'distributive-delete': |
123 | case 'distributive-delete': |
123 | // Удаление информации о дистрибутиве
|
124 | // Удаление информации о дистрибутиве
|
124 | $ID = $secure->checkInt($_POST["distID"]); |
125 | $ID = $secure->checkInt($_POST["distID"]); |
125 | 126 | ||
126 | $r = $core->dropDistribution($ID); |
127 | $r = $core->dropDistribution($ID); |
127 | if ($r["ERR"]==0) { |
128 | if ($r["ERR"]==0) { |
128 | header("Location: ".$manager."\n\n"); |
129 | header("Location: ".$manager."\n\n"); |
129 | } else { |
130 | } else { |
130 | echo $r["ERRINFO"]; |
131 | echo $r["ERRINFO"]; |
131 | }
|
132 | }
|
132 | 133 | ||
133 | break; |
134 | break; |
134 | case 'version-add': |
135 | case 'version-add': |
135 | // Добавление новой версии дистрибутива
|
136 | // Добавление новой версии дистрибутива
|
136 | $DistID = $secure->checkInt($_POST["distname"]); |
137 | $DistID = $secure->checkInt($_POST["distname"]); |
137 | $VName = $secure->checkStr($_POST["vname"],1); |
138 | $VName = $secure->checkStr($_POST["vname"],1); |
138 | $VNmbr = $secure->checkStr($_POST["version"],1); |
139 | $VNmbr = $secure->checkStr($_POST["version"],1); |
139 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
140 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
140 | 141 | ||
141 | $r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme); |
142 | $r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme); |
142 | if ($r["ERR"]==0) { |
143 | if ($r["ERR"]==0) { |
143 | header("Location: ".$manager."\n\n"); |
144 | header("Location: ".$manager."\n\n"); |
144 | } else { |
145 | } else { |
145 | echo $r["ERRINFO"]; |
146 | echo $r["ERRINFO"]; |
146 | }
|
147 | }
|
147 | 148 | ||
148 | break; |
149 | break; |
149 | case 'version-edit': |
150 | case 'version-edit': |
150 | // Редактирование версии дистрибутива
|
151 | // Редактирование версии дистрибутива
|
151 | $versID = $secure->checkInt($_POST["versionID"]); |
152 | $versID = $secure->checkInt($_POST["versionID"]); |
152 | $VName = $secure->checkStr($_POST["vname"],1); |
153 | $VName = $secure->checkStr($_POST["vname"],1); |
153 | $VNmbr = $secure->checkStr($_POST["version"],1); |
154 | $VNmbr = $secure->checkStr($_POST["version"],1); |
154 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
155 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
155 | 156 | ||
156 | $r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme); |
157 | $r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme); |
157 | if ($r["ERR"]==0) { |
158 | if ($r["ERR"]==0) { |
158 | header("Location: ".$manager."\n\n"); |
159 | header("Location: ".$manager."\n\n"); |
159 | } else { |
160 | } else { |
160 | echo $r["ERRINFO"]; |
161 | echo $r["ERRINFO"]; |
161 | }
|
162 | }
|
162 | 163 | ||
163 | break; |
164 | break; |
164 | case 'version-delete': |
165 | case 'version-delete': |
165 | // Удаление версии дистрибутива
|
166 | // Удаление версии дистрибутива
|
166 | $versID = $secure->checkInt($_POST["versionID"]); |
167 | $versID = $secure->checkInt($_POST["versionID"]); |
167 | 168 | ||
168 | $r = $core->dropDistVersion($versID); |
169 | $r = $core->dropDistVersion($versID); |
169 | if ($r["ERR"]==0) { |
170 | if ($r["ERR"]==0) { |
170 | header("Location: ".$manager."\n\n"); |
171 | header("Location: ".$manager."\n\n"); |
171 | } else { |
172 | } else { |
172 | echo $r["ERRINFO"]; |
173 | echo $r["ERRINFO"]; |
173 | }
|
174 | }
|
174 | 175 | ||
175 | break; |
176 | break; |
176 | case 'section-add': |
177 | case 'section-add': |
177 | // Добавление новой секции
|
178 | // Добавление новой секции
|
178 | $SName = $secure->checkStr($_POST["sname"],1); |
179 | $SName = $secure->checkStr($_POST["sname"],1); |
179 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
180 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
180 | 181 | ||
181 | $r = $core->addSection($SName, $SInfo); |
182 | $r = $core->addSection($SName, $SInfo); |
182 | if ($r["ERR"]==0) { |
183 | if ($r["ERR"]==0) { |
183 | header("Location: ".$manager."\n\n"); |
184 | header("Location: ".$manager."\n\n"); |
184 | } else { |
185 | } else { |
185 | echo $r["ERRINFO"]; |
186 | echo $r["ERRINFO"]; |
186 | }
|
187 | }
|
187 | 188 | ||
188 | break; |
189 | break; |
189 | case 'section-edit': |
190 | case 'section-edit': |
190 | // Редактирование информации о секции
|
191 | // Редактирование информации о секции
|
191 | $sectID = $secure->checkInt($_POST["sectionID"]); |
192 | $sectID = $secure->checkInt($_POST["sectionID"]); |
192 | $SName = $secure->checkStr($_POST["sname"],1); |
193 | $SName = $secure->checkStr($_POST["sname"],1); |
193 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
194 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
194 | 195 | ||
195 | $r = $core->updateSection($sectID, $SName, $SInfo); |
196 | $r = $core->updateSection($sectID, $SName, $SInfo); |
196 | if ($r["ERR"]==0) { |
197 | if ($r["ERR"]==0) { |
197 | header("Location: ".$manager."\n\n"); |
198 | header("Location: ".$manager."\n\n"); |
198 | } else { |
199 | } else { |
199 | echo $r["ERRINFO"]; |
200 | echo $r["ERRINFO"]; |
200 | }
|
201 | }
|
201 | 202 | ||
202 | break; |
203 | break; |
203 | case 'section-delete': |
204 | case 'section-delete': |
204 | // Удаление информации о секции
|
205 | // Удаление информации о секции
|
205 | $sectID = $secure->checkInt($_POST["sectionID"]); |
206 | $sectID = $secure->checkInt($_POST["sectionID"]); |
206 | 207 | ||
207 | $r = $core->dropSection($sectID); |
208 | $r = $core->dropSection($sectID); |
208 | if ($r["ERR"]==0) { |
209 | if ($r["ERR"]==0) { |
209 | header("Location: ".$manager."\n\n"); |
210 | header("Location: ".$manager."\n\n"); |
210 | } else { |
211 | } else { |
211 | echo $r["ERRINFO"]; |
212 | echo $r["ERRINFO"]; |
212 | }
|
213 | }
|
213 | 214 | ||
214 | break; |
215 | break; |
215 | }
|
216 | }
|
216 | 217 | ||
217 | ?>
|
218 | ?>
|
218 | 219 |