Хранилища Subversion ant

Редакция

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

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