Хранилища Subversion ant

Редакция

Редакция 524 | Редакция 526 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 524 Редакция 525
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
            $DLogo = $core->uploadPicture($picture, $DUA, $_FILES["distlogo"]);
32
            $folder   = $picture.$DUA."-orig.png";
-
 
33
            $folderN  = $picture.$DUA.".png";
-
 
34
            $folderEM = $picture.$DUA."-em.png";
-
 
35
-
 
36
            if (move_uploaded_file($datafile["distlogo"]["tmp_name"],$folder)) {
-
 
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
            }
33
        }
61
        }
34
62
35
        $r = $core->addDistribution($DName, $DType, $DUA, $DLogo);
63
        $r = $core->addDistribution($DName, $DType, $DUA, $DLogo);
36
        if ($r["ERR"]==0) {
64
        if ($r["ERR"]==0) {
37
            header("Location: ".$manager."\n\n");
65
            header("Location: ".$manager."\n\n");
38
        } else {
66
        } else {
39
            echo $r["ERRINFO"];
67
            echo $r["ERRINFO"];
40
        }
68
        }
41
69
42
        break;
70
        break;
43
    case 'distributive-edit':
71
    case 'distributive-edit':
44
        // Редактирование информации о дистрибутиве
72
        // Редактирование информации о дистрибутиве
45
        $ID     = $secure->checkInt($_POST["distID"]);
73
        $ID     = $secure->checkInt($_POST["distID"]);
46
        $DName  = $secure->checkStr($_POST["dname"],1);
74
        $DName  = $secure->checkStr($_POST["dname"],1);
47
        $DUA    = $secure->checkStr($_POST["dua"],1);
75
        $DUA    = $secure->checkStr($_POST["dua"],1);
48
        $DType  = $secure->checkInt($_POST["dtype"]);
76
        $DType  = $secure->checkInt($_POST["dtype"]);
49
        $DLogo  = 0;
77
        $DLogo  = 0;
50
78
51
        if ($_FILES["distlogo"]["type"]!=0) {
79
        if ($_FILES["distlogo"]["type"]!=0) {
52
            $DLogo = $core->uploadPicture($picture, $DUA, $_FILES["distlogo"]);
80
            $folder   = $picture.$DUA."-orig.png";
-
 
81
            $folderN  = $picture.$DUA.".png";
-
 
82
            $folderEM = $picture.$DUA."-em.png";
-
 
83
-
 
84
            if (move_uploaded_file($datafile["distlogo"]["tmp_name"],$folder)) {
-
 
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
            }
53
        }
109
        }
54
110
55
        $r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo);
111
        $r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo);
56
        if ($r["ERR"]==0) {
112
        if ($r["ERR"]==0) {
57
            header("Location: ".$manager."\n\n");
113
            header("Location: ".$manager."\n\n");
58
        } else {
114
        } else {
59
            echo $r["ERRINFO"];
115
            echo $r["ERRINFO"];
60
        }
116
        }
61
117
62
        break;
118
        break;
63
    case 'distributive-delete':
119
    case 'distributive-delete':
64
        // Удаление информации о дистрибутиве
120
        // Удаление информации о дистрибутиве
65
        $ID     = $secure->checkInt($_POST["distID"]);
121
        $ID     = $secure->checkInt($_POST["distID"]);
66
122
67
        $r = $core->dropDistribution($ID);
123
        $r = $core->dropDistribution($ID);
68
        if ($r["ERR"]==0) {
124
        if ($r["ERR"]==0) {
69
            header("Location: ".$manager."\n\n");
125
            header("Location: ".$manager."\n\n");
70
        } else {
126
        } else {
71
            echo $r["ERRINFO"];
127
            echo $r["ERRINFO"];
72
        }
128
        }
73
129
74
        break;
130
        break;
75
    case 'version-add':
131
    case 'version-add':
76
        // Добавление новой версии дистрибутива
132
        // Добавление новой версии дистрибутива
77
        $DistID = $secure->checkInt($_POST["distname"]);
133
        $DistID = $secure->checkInt($_POST["distname"]);
78
        $VName  = $secure->checkStr($_POST["vname"],1);
134
        $VName  = $secure->checkStr($_POST["vname"],1);
79
        $VNmbr  = $secure->checkStr($_POST["version"],1);
135
        $VNmbr  = $secure->checkStr($_POST["version"],1);
80
        $VCNme  = $secure->checkStr($_POST["vcodename"],1);
136
        $VCNme  = $secure->checkStr($_POST["vcodename"],1);
81
137
82
        $r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme);
138
        $r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme);
83
        if ($r["ERR"]==0) {
139
        if ($r["ERR"]==0) {
84
            header("Location: ".$manager."\n\n");
140
            header("Location: ".$manager."\n\n");
85
        } else {
141
        } else {
86
            echo $r["ERRINFO"];
142
            echo $r["ERRINFO"];
87
        }
143
        }
88
144
89
        break;
145
        break;
90
    case 'version-edit':
146
    case 'version-edit':
91
        // Редактирование версии дистрибутива
147
        // Редактирование версии дистрибутива
92
        $versID = $secure->checkInt($_POST["versionID"]);
148
        $versID = $secure->checkInt($_POST["versionID"]);
93
        $VName  = $secure->checkStr($_POST["vname"],1);
149
        $VName  = $secure->checkStr($_POST["vname"],1);
94
        $VNmbr  = $secure->checkStr($_POST["version"],1);
150
        $VNmbr  = $secure->checkStr($_POST["version"],1);
95
        $VCNme  = $secure->checkStr($_POST["vcodename"],1);
151
        $VCNme  = $secure->checkStr($_POST["vcodename"],1);
96
152
97
        $r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme);
153
        $r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme);
98
        if ($r["ERR"]==0) {
154
        if ($r["ERR"]==0) {
99
            header("Location: ".$manager."\n\n");
155
            header("Location: ".$manager."\n\n");
100
        } else {
156
        } else {
101
            echo $r["ERRINFO"];
157
            echo $r["ERRINFO"];
102
        }
158
        }
103
159
104
        break;
160
        break;
105
    case 'version-delete':
161
    case 'version-delete':
106
        // Удаление версии дистрибутива
162
        // Удаление версии дистрибутива
107
        $versID = $secure->checkInt($_POST["versionID"]);
163
        $versID = $secure->checkInt($_POST["versionID"]);
108
164
109
        $r = $core->dropDistVersion($versID);
165
        $r = $core->dropDistVersion($versID);
110
        if ($r["ERR"]==0) {
166
        if ($r["ERR"]==0) {
111
            header("Location: ".$manager."\n\n");
167
            header("Location: ".$manager."\n\n");
112
        } else {
168
        } else {
113
            echo $r["ERRINFO"];
169
            echo $r["ERRINFO"];
114
        }
170
        }
115
171
116
        break;
172
        break;
117
    case 'section-add':
173
    case 'section-add':
118
        // Добавление новой секции
174
        // Добавление новой секции
119
        $SName  = $secure->checkStr($_POST["sname"],1);
175
        $SName  = $secure->checkStr($_POST["sname"],1);
120
        $SInfo  = $secure->checkStr($_POST["sinfo"],1);
176
        $SInfo  = $secure->checkStr($_POST["sinfo"],1);
121
177
122
        $r = $core->addSection($SName, $SInfo);
178
        $r = $core->addSection($SName, $SInfo);
123
        if ($r["ERR"]==0) {
179
        if ($r["ERR"]==0) {
124
            header("Location: ".$manager."\n\n");
180
            header("Location: ".$manager."\n\n");
125
        } else {
181
        } else {
126
            echo $r["ERRINFO"];
182
            echo $r["ERRINFO"];
127
        }
183
        }
128
184
129
        break;
185
        break;
130
    case 'section-edit':
186
    case 'section-edit':
131
        // Редактирование информации о секции
187
        // Редактирование информации о секции
132
        $sectID = $secure->checkInt($_POST["sectionID"]);
188
        $sectID = $secure->checkInt($_POST["sectionID"]);
133
        $SName  = $secure->checkStr($_POST["sname"],1);
189
        $SName  = $secure->checkStr($_POST["sname"],1);
134
        $SInfo  = $secure->checkStr($_POST["sinfo"],1);
190
        $SInfo  = $secure->checkStr($_POST["sinfo"],1);
135
191
136
        $r = $core->updateSection($sectID, $SName, $SInfo);
192
        $r = $core->updateSection($sectID, $SName, $SInfo);
137
        if ($r["ERR"]==0) {
193
        if ($r["ERR"]==0) {
138
            header("Location: ".$manager."\n\n");
194
            header("Location: ".$manager."\n\n");
139
        } else {
195
        } else {
140
            echo $r["ERRINFO"];
196
            echo $r["ERRINFO"];
141
        }
197
        }
142
198
143
        break;
199
        break;
144
    case 'section-delete':
200
    case 'section-delete':
145
        // Удаление информации о секции
201
        // Удаление информации о секции
146
        $sectID = $secure->checkInt($_POST["sectionID"]);
202
        $sectID = $secure->checkInt($_POST["sectionID"]);
147
203
148
        $r = $core->dropSection($sectID);
204
        $r = $core->dropSection($sectID);
149
        if ($r["ERR"]==0) {
205
        if ($r["ERR"]==0) {
150
            header("Location: ".$manager."\n\n");
206
            header("Location: ".$manager."\n\n");
151
        } else {
207
        } else {
152
            echo $r["ERRINFO"];
208
            echo $r["ERRINFO"];
153
        }
209
        }
154
210
155
        break;
211
        break;
156
}
212
}
157
213
158
?>
214
?>
159
 
215