Редакция 535 | Редакция 537 | К новейшей редакции | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 535 | Редакция 536 | ||
---|---|---|---|
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"]!="") { |
31 | if ($_FILES["distlogo"]["type"]!="") { |
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"]!="") { |
79 | if ($_FILES["distlogo"]["type"]!="") { |
80 | $DLogo = $core->uploadPicture($picture, $DUA, $_FILES); |
80 | $DLogo = $core->uploadPicture($picture, $DUA, $_FILES); |
81 | }
|
81 | }
|
82 | 82 | ||
83 | $r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo); |
83 | $r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo); |
84 | if ($r["ERR"]==0) { |
84 | if ($r["ERR"]==0) { |
85 | //header("Location: ".$manager."\n\n");
|
85 | header("Location: ".$manager."\n\n"); |
86 | } else { |
86 | } else { |
87 | echo $r["ERRINFO"]; |
87 | echo $r["ERRINFO"]; |
88 | }
|
88 | }
|
89 | 89 | ||
90 | break; |
90 | break; |
91 | case 'distributive-delete': |
91 | case 'distributive-delete': |
92 | // Удаление информации о дистрибутиве
|
92 | // Удаление информации о дистрибутиве
|
93 | $ID = $secure->checkInt($_POST["distID"]); |
93 | $ID = $secure->checkInt($_POST["distID"]); |
94 | 94 | ||
95 | $r = $core->dropDistribution($ID); |
95 | $r = $core->dropDistribution($ID); |
96 | if ($r["ERR"]==0) { |
96 | if ($r["ERR"]==0) { |
97 | header("Location: ".$manager."\n\n"); |
97 | header("Location: ".$manager."\n\n"); |
98 | } else { |
98 | } else { |
99 | echo $r["ERRINFO"]; |
99 | echo $r["ERRINFO"]; |
100 | }
|
100 | }
|
101 | 101 | ||
102 | break; |
102 | break; |
103 | case 'version-add': |
103 | case 'version-add': |
104 | // Добавление новой версии дистрибутива
|
104 | // Добавление новой версии дистрибутива
|
105 | $DistID = $secure->checkInt($_POST["distname"]); |
105 | $DistID = $secure->checkInt($_POST["distname"]); |
106 | $VName = $secure->checkStr($_POST["vname"],1); |
106 | $VName = $secure->checkStr($_POST["vname"],1); |
107 | $VNmbr = $secure->checkStr($_POST["version"],1); |
107 | $VNmbr = $secure->checkStr($_POST["version"],1); |
108 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
108 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
109 | 109 | ||
110 | $r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme); |
110 | $r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme); |
111 | if ($r["ERR"]==0) { |
111 | if ($r["ERR"]==0) { |
112 | header("Location: ".$manager."\n\n"); |
112 | header("Location: ".$manager."\n\n"); |
113 | } else { |
113 | } else { |
114 | echo $r["ERRINFO"]; |
114 | echo $r["ERRINFO"]; |
115 | }
|
115 | }
|
116 | 116 | ||
117 | break; |
117 | break; |
118 | case 'version-edit': |
118 | case 'version-edit': |
119 | // Редактирование версии дистрибутива
|
119 | // Редактирование версии дистрибутива
|
120 | $versID = $secure->checkInt($_POST["versionID"]); |
120 | $versID = $secure->checkInt($_POST["versionID"]); |
121 | $VName = $secure->checkStr($_POST["vname"],1); |
121 | $VName = $secure->checkStr($_POST["vname"],1); |
122 | $VNmbr = $secure->checkStr($_POST["version"],1); |
122 | $VNmbr = $secure->checkStr($_POST["version"],1); |
123 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
123 | $VCNme = $secure->checkStr($_POST["vcodename"],1); |
124 | 124 | ||
125 | $r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme); |
125 | $r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme); |
126 | if ($r["ERR"]==0) { |
126 | if ($r["ERR"]==0) { |
127 | header("Location: ".$manager."\n\n"); |
127 | header("Location: ".$manager."\n\n"); |
128 | } else { |
128 | } else { |
129 | echo $r["ERRINFO"]; |
129 | echo $r["ERRINFO"]; |
130 | }
|
130 | }
|
131 | 131 | ||
132 | break; |
132 | break; |
133 | case 'version-delete': |
133 | case 'version-delete': |
134 | // Удаление версии дистрибутива
|
134 | // Удаление версии дистрибутива
|
135 | $versID = $secure->checkInt($_POST["versionID"]); |
135 | $versID = $secure->checkInt($_POST["versionID"]); |
136 | 136 | ||
137 | $r = $core->dropDistVersion($versID); |
137 | $r = $core->dropDistVersion($versID); |
138 | if ($r["ERR"]==0) { |
138 | if ($r["ERR"]==0) { |
139 | header("Location: ".$manager."\n\n"); |
139 | header("Location: ".$manager."\n\n"); |
140 | } else { |
140 | } else { |
141 | echo $r["ERRINFO"]; |
141 | echo $r["ERRINFO"]; |
142 | }
|
142 | }
|
143 | 143 | ||
144 | break; |
144 | break; |
145 | case 'section-add': |
145 | case 'section-add': |
146 | // Добавление новой секции
|
146 | // Добавление новой секции
|
147 | $SName = $secure->checkStr($_POST["sname"],1); |
147 | $SName = $secure->checkStr($_POST["sname"],1); |
148 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
148 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
149 | 149 | ||
150 | $r = $core->addSection($SName, $SInfo); |
150 | $r = $core->addSection($SName, $SInfo); |
151 | if ($r["ERR"]==0) { |
151 | if ($r["ERR"]==0) { |
152 | header("Location: ".$manager."\n\n"); |
152 | header("Location: ".$manager."\n\n"); |
153 | } else { |
153 | } else { |
154 | echo $r["ERRINFO"]; |
154 | echo $r["ERRINFO"]; |
155 | }
|
155 | }
|
156 | 156 | ||
157 | break; |
157 | break; |
158 | case 'section-edit': |
158 | case 'section-edit': |
159 | // Редактирование информации о секции
|
159 | // Редактирование информации о секции
|
160 | $sectID = $secure->checkInt($_POST["sectionID"]); |
160 | $sectID = $secure->checkInt($_POST["sectionID"]); |
161 | $SName = $secure->checkStr($_POST["sname"],1); |
161 | $SName = $secure->checkStr($_POST["sname"],1); |
162 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
162 | $SInfo = $secure->checkStr($_POST["sinfo"],1); |
163 | 163 | ||
164 | $r = $core->updateSection($sectID, $SName, $SInfo); |
164 | $r = $core->updateSection($sectID, $SName, $SInfo); |
165 | if ($r["ERR"]==0) { |
165 | if ($r["ERR"]==0) { |
166 | header("Location: ".$manager."\n\n"); |
166 | header("Location: ".$manager."\n\n"); |
167 | } else { |
167 | } else { |
168 | echo $r["ERRINFO"]; |
168 | echo $r["ERRINFO"]; |
169 | }
|
169 | }
|
170 | 170 | ||
171 | break; |
171 | break; |
172 | case 'section-delete': |
172 | case 'section-delete': |
173 | // Удаление информации о секции
|
173 | // Удаление информации о секции
|
174 | $sectID = $secure->checkInt($_POST["sectionID"]); |
174 | $sectID = $secure->checkInt($_POST["sectionID"]); |
175 | 175 | ||
176 | $r = $core->dropSection($sectID); |
176 | $r = $core->dropSection($sectID); |
177 | if ($r["ERR"]==0) { |
177 | if ($r["ERR"]==0) { |
178 | header("Location: ".$manager."\n\n"); |
178 | header("Location: ".$manager."\n\n"); |
179 | } else { |
179 | } else { |
180 | echo $r["ERRINFO"]; |
180 | echo $r["ERRINFO"]; |
181 | }
|
181 | }
|
182 | 182 | ||
183 | break; |
183 | break; |
184 | }
|
184 | }
|
185 | 185 | ||
186 | ?>
|
186 | ?>
|
187 | 187 |