Хранилища Subversion ant

Редакция

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

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