Хранилища Subversion ant

Редакция

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