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