Редакция 2 | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 2 | Редакция 3 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | include "./sign-valid.php"; |
3 | include "./sign-valid.php"; |
4 | 4 | ||
5 | $mode = abs(intval($_GET["mode"])); |
5 | $mode = abs(intval($_GET["mode"])); |
6 | $act = abs(intval($_GET["action"])); |
6 | $act = abs(intval($_GET["action"])); |
7 | $uid = abs(intval($_GET["uid"])); |
7 | $uid = abs(intval($_GET["uid"])); |
8 | 8 | ||
9 | switch ($mode) { |
9 | switch ($mode) { |
10 | case '0': |
10 | case '0': |
11 | $display = "<ul><li><a href='./admin.php?mode=1'>Управление дистрибутивами</a></li><li><a href='./admin.php?mode=2'>Управление версиями дистрибутивов</a></li><li><a href='./admin.php?mode=3'>Управление репозиториями</a></li><li><a href='./admin.php?mode=4'>Управление секциями репозиториев</a></li></ul>"; |
11 | $display = "<ul><li><a href='./admin.php?mode=1'>Управление дистрибутивами</a></li><li><a href='./admin.php?mode=2'>Управление версиями дистрибутивов</a></li><li><a href='./admin.php?mode=3'>Управление репозиториями</a></li><li><a href='./admin.php?mode=4'>Управление секциями репозиториев</a></li></ul>"; |
12 | break; |
12 | break; |
13 | case '1': |
13 | case '1': |
14 | // Работа с дистрибутивами
|
14 | // Работа с дистрибутивами
|
15 | switch ($act) { |
15 | switch ($act) { |
16 | case '0': |
16 | case '0': |
17 | // Список дистрибутивов
|
17 | // Список дистрибутивов
|
18 | $dist =& $db->query("SELECT * FROM distribution"); |
18 | $dist =& $db->query("SELECT * FROM distribution"); |
19 | if ($dist->numRows()>0) { |
19 | if ($dist->numRows()>0) { |
20 | $display = "В наличии есть:<ul id='distlist'>"; |
20 | $display = "В наличии есть:<ul id='distlist'>"; |
21 | while ($dist->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
21 | while ($dist->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
22 | $display .= "<li>".stripslashes($info["distname"])." — [<a href='./admin.php?mode=1&action=2&uid=".$info["dist_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=1&action=3&uid=".$info["dist_id"]."' class='delete'>удалить</a>]</li>"; |
22 | $display .= "<li>".stripslashes($info["distname"])." — [<a href='./admin.php?mode=1&action=2&uid=".$info["dist_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=1&action=3&uid=".$info["dist_id"]."' class='delete'>удалить</a>]</li>"; |
23 | }
|
23 | }
|
24 | $display .= "</ul><p><a href='./admin.php?mode=1&action=1'>Добавить новый apt-дистрибутив</a></p>"; |
24 | $display .= "</ul><p><a href='./admin.php?mode=1&action=1'>Добавить новый apt-дистрибутив</a></p>"; |
25 | }
|
25 | }
|
26 | break; |
26 | break; |
27 | case '1': |
27 | case '1': |
28 | // Добавление нового дистрибутива
|
28 | // Добавление нового дистрибутива
|
29 | $dtype =& $db->query("SELECT * FROM dtype"); |
29 | $dtype =& $db->query("SELECT * FROM dtype"); |
30 | $type = "<select name='distType'>"; |
30 | $type = "<select name='distType'>"; |
31 | while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
31 | while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
32 | $type .= "<option value='".$dtinfo["type_id"]."'>".stripslashes($dtinfo["type"])."</option>"; |
32 | $type .= "<option value='".$dtinfo["type_id"]."'>".stripslashes($dtinfo["type"])."</option>"; |
33 | }
|
33 | }
|
34 | $type .= "</select>\n"; |
34 | $type .= "</select>\n"; |
35 | $display = "<h3>Добавление нового apt-дистрибутива</h3>"; |
35 | $display = "<h3>Добавление нового apt-дистрибутива</h3>"; |
36 | $display .= "<form action='./process.php' method='POST'>\n"; |
36 | $display .= "<form action='./process.php' method='POST'>\n"; |
37 | $display .= "<input type='hidden' name='mode' value='1'>\n"; |
37 | $display .= "<input type='hidden' name='mode' value='1'>\n"; |
38 | $display .= "Название дистрибутива: <input type='text' name='distName'><br>\n"; |
38 | $display .= "Название дистрибутива: <input type='text' name='distName'><br>\n"; |
39 | $display .= "Тип дистрибутива: ".$type."<br>"; |
39 | $display .= "Тип дистрибутива: ".$type."<br>"; |
40 | $display .= "<input type='submit' value='Создать'></form>\n"; |
40 | $display .= "<input type='submit' value='Создать'></form>\n"; |
41 | break; |
41 | break; |
42 | case '2': |
42 | case '2': |
43 | // Правка существующего дистрибутива
|
43 | // Правка существующего дистрибутива
|
44 | $dist =& $db->query("SELECT * FROM distribution WHERE dist_id='$uid'"); |
44 | $dist =& $db->query("SELECT * FROM distribution WHERE dist_id='$uid'"); |
45 | $dist->fetchInto($info, DB_FETCHMODE_ASSOC); |
45 | $dist->fetchInto($info, DB_FETCHMODE_ASSOC); |
46 | $dtype =& $db->query("SELECT * FROM dtype"); |
46 | $dtype =& $db->query("SELECT * FROM dtype"); |
47 | $type = "<select name='distType'>"; |
47 | $type = "<select name='distType'>"; |
48 | while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
48 | while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
49 | if ($info["disttype"]==$dtinfo["type_id"]) { |
49 | if ($info["disttype"]==$dtinfo["type_id"]) { |
50 | $type .= "<option value='".$dtinfo["type_id"]."' selected>".stripslashes($dtinfo["type"])."</option>"; |
50 | $type .= "<option value='".$dtinfo["type_id"]."' selected>".stripslashes($dtinfo["type"])."</option>"; |
51 | } else { |
51 | } else { |
52 | $type .= "<option value='".$dtinfo["type_id"]."'>".stripslashes($dtinfo["type"])."</option>"; |
52 | $type .= "<option value='".$dtinfo["type_id"]."'>".stripslashes($dtinfo["type"])."</option>"; |
53 | }
|
53 | }
|
54 | }
|
54 | }
|
55 | $type .= "</select>\n"; |
55 | $type .= "</select>\n"; |
56 | $display = "<h3>Правка apt-дистрибутива <em>".stripslashes($info["distname"])."</em></h3>"; |
56 | $display = "<h3>Правка apt-дистрибутива <em>".stripslashes($info["distname"])."</em></h3>"; |
57 | $display .= "<form action='./process.php' method='POST'>\n"; |
57 | $display .= "<form action='./process.php' method='POST'>\n"; |
58 | $display .= "<input type='hidden' name='mode' value='2'>\n"; |
58 | $display .= "<input type='hidden' name='mode' value='2'>\n"; |
59 | $display .= "<input type='hidden' name='distID' value='$uid'>\n"; |
59 | $display .= "<input type='hidden' name='distID' value='$uid'>\n"; |
60 | $display .= "Название дистрибутива: <input type='text' name='distName' value='".stripslashes($info["distname"])."'><br>\n"; |
60 | $display .= "Название дистрибутива: <input type='text' name='distName' value='".stripslashes($info["distname"])."'><br>\n"; |
61 | $display .= "Тип дистрибутива: ".$type."<br>"; |
61 | $display .= "Тип дистрибутива: ".$type."<br>"; |
62 | $display .= "<input type='submit' value='Править'></form>\n"; |
62 | $display .= "<input type='submit' value='Править'></form>\n"; |
63 | break; |
63 | break; |
64 | case '3': |
64 | case '3': |
65 | // Удаление существующего дистрибутива
|
65 | // Удаление существующего дистрибутива
|
66 | $dist =& $db->query("SELECT * FROM distribution WHERE dist_id='$uid'"); |
66 | $dist =& $db->query("SELECT * FROM distribution WHERE dist_id='$uid'"); |
67 | $dist->fetchInto($info, DB_FETCHMODE_ASSOC); |
67 | $dist->fetchInto($info, DB_FETCHMODE_ASSOC); |
68 | $display = "<h3>Удаление apt-дистрибутива <em>".stripslashes($info["distname"])."</em></h3>"; |
68 | $display = "<h3>Удаление apt-дистрибутива <em>".stripslashes($info["distname"])."</em></h3>"; |
69 | $display .= "<form action='./process.php' method='POST'>\n"; |
69 | $display .= "<form action='./process.php' method='POST'>\n"; |
70 | $display .= "<input type='hidden' name='mode' value='3'>\n"; |
70 | $display .= "<input type='hidden' name='mode' value='3'>\n"; |
71 | $display .= "<input type='hidden' name='distID' value='$uid'>\n"; |
71 | $display .= "<input type='hidden' name='distID' value='$uid'>\n"; |
72 | $display .= "<input type='submit' value='Удалить'></form>\n"; |
72 | $display .= "<input type='submit' value='Удалить'></form>\n"; |
73 | break; |
73 | break; |
74 | }
|
74 | }
|
75 | break; |
75 | break; |
76 | case '2': |
76 | case '2': |
77 | // Работа с версиями дистрибутивов
|
77 | // Работа с версиями дистрибутивов
|
78 | switch ($act) { |
78 | switch ($act) { |
79 | case '0': |
79 | case '0': |
80 | // Все версии имеющихся дистрибутивов
|
80 | // Все версии имеющихся дистрибутивов
|
81 | $dist =& $db->query("SELECT * FROM distribution d JOIN version v ON d.dist_id=v.dist_id ORDER BY d.dist_id,v.version ASC"); |
81 | $dist =& $db->query("SELECT * FROM distribution d JOIN version v ON d.dist_id=v.dist_id ORDER BY d.dist_id,v.version ASC"); |
82 | $display = "В наличии есть следующие версии apt-дистрибутивов:<ul id='distlist'>"; |
82 | $display = "В наличии есть следующие версии apt-дистрибутивов:<ul id='distlist'>"; |
83 | while ($dist->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
83 | while ($dist->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
84 | $display .= "<li>".stripslashes($info["distname"])." ".stripslashes($info["version"])." “".stripslashes($info["vname"])."” — [<a href='./admin.php?mode=2&action=2&uid=".$info["version_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=2&action=3&uid=".$info["version_id"]."' class='delete'>удалить</a>]</li>"; |
84 | $display .= "<li>".stripslashes($info["distname"])." ".stripslashes($info["version"])." “".stripslashes($info["vname"])."” — [<a href='./admin.php?mode=2&action=2&uid=".$info["version_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=2&action=3&uid=".$info["version_id"]."' class='delete'>удалить</a>]</li>"; |
85 | }
|
85 | }
|
86 | $display .= "</ul><p><a href='./admin.php?mode=2&action=1'>Добавить новую версию дистрибутива</a></p>"; |
86 | $display .= "</ul><p><a href='./admin.php?mode=2&action=1'>Добавить новую версию дистрибутива</a></p>"; |
87 | break; |
87 | break; |
88 | case '1': |
88 | case '1': |
89 | // Добавление новой версии дистрибутива
|
89 | // Добавление новой версии дистрибутива
|
90 | $dtype =& $db->query("SELECT * FROM distribution"); |
90 | $dtype =& $db->query("SELECT * FROM distribution"); |
91 | $type = "<select name='distName'>"; |
91 | $type = "<select name='distName'>"; |
92 | while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
92 | while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
93 | $type .= "<option value='".$dtinfo["dist_id"]."'>".stripslashes($dtinfo["distname"])."</option>"; |
93 | $type .= "<option value='".$dtinfo["dist_id"]."'>".stripslashes($dtinfo["distname"])."</option>"; |
94 | }
|
94 | }
|
95 | $type .= "</select>\n"; |
95 | $type .= "</select>\n"; |
96 | $display = "<h3>Добавление новой версии apt-дистрибутива</h3>"; |
96 | $display = "<h3>Добавление новой версии apt-дистрибутива</h3>"; |
97 | $display .= "<form action='./process.php' method='POST'>\n"; |
97 | $display .= "<form action='./process.php' method='POST'>\n"; |
98 | $display .= "<input type='hidden' name='mode' value='4'>\n"; |
98 | $display .= "<input type='hidden' name='mode' value='4'>\n"; |
99 | $display .= "Номер версии: <input type='text' name='versNum'><br>\n"; |
99 | $display .= "Номер версии: <input type='text' name='versNum'><br>\n"; |
100 | $display .= "Название версии: <input type='text' name='versNam'><br>\n"; |
100 | $display .= "Название версии: <input type='text' name='versNam'><br>\n"; |
101 | $display .= "Кодовое имя версии: <input type='text' name='versCN'><br>\n"; |
101 | $display .= "Кодовое имя версии: <input type='text' name='versCN'><br>\n"; |
102 | $display .= "Дистрибутив: ".$type."<br>"; |
102 | $display .= "Дистрибутив: ".$type."<br>"; |
103 | $display .= "<input type='submit' value='Создать'></form>\n"; |
103 | $display .= "<input type='submit' value='Создать'></form>\n"; |
104 | break; |
104 | break; |
105 | case '2': |
105 | case '2': |
106 | // Правка имеющейся версии дистрибутива
|
106 | // Правка имеющейся версии дистрибутива
|
107 | $vers =& $db->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id WHERE version_id='$uid'"); |
107 | $vers =& $db->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id WHERE version_id='$uid'"); |
108 | $vers->fetchInto($info, DB_FETCHMODE_ASSOC); |
108 | $vers->fetchInto($info, DB_FETCHMODE_ASSOC); |
109 | $display = "<h3>Правка имеющейся версии <em>".stripslashes($info["distname"])."</em></h3>"; |
109 | $display = "<h3>Правка имеющейся версии <em>".stripslashes($info["distname"])."</em></h3>"; |
110 | $display .= "<form action='./process.php' method='POST'>\n"; |
110 | $display .= "<form action='./process.php' method='POST'>\n"; |
111 | $display .= "<input type='hidden' name='mode' value='5'>\n"; |
111 | $display .= "<input type='hidden' name='mode' value='5'>\n"; |
112 | $display .= "<input type='hidden' name='versID' value='$uid'>\n"; |
112 | $display .= "<input type='hidden' name='versID' value='$uid'>\n"; |
113 | $display .= "Номер версии: <input type='text' name='versNum' value='".stripslashes($info["version"])."'><br>\n"; |
113 | $display .= "Номер версии: <input type='text' name='versNum' value='".stripslashes($info["version"])."'><br>\n"; |
114 | $display .= "Название версии: <input type='text' name='versNam' value='".stripslashes($info["vname"])."'><br>\n"; |
114 | $display .= "Название версии: <input type='text' name='versNam' value='".stripslashes($info["vname"])."'><br>\n"; |
115 | $display .= "Кодовое имя версии: <input type='text' name='versCN' value='".stripslashes($info["vcodename"])."'><br>\n"; |
115 | $display .= "Кодовое имя версии: <input type='text' name='versCN' value='".stripslashes($info["vcodename"])."'><br>\n"; |
116 | $display .= "<input type='submit' value='Править'></form>\n"; |
116 | $display .= "<input type='submit' value='Править'></form>\n"; |
117 | break; |
117 | break; |
118 | case '3': |
118 | case '3': |
119 | // Удаление существующей версии дистрибутива
|
119 | // Удаление существующей версии дистрибутива
|
120 | $dist =& $db->query("SELECT * FROM version v JOIN distribution d ON v.dist_id=d.dist_id WHERE v.version_id='$uid'"); |
120 | $dist =& $db->query("SELECT * FROM version v JOIN distribution d ON v.dist_id=d.dist_id WHERE v.version_id='$uid'"); |
121 | $dist->fetchInto($info, DB_FETCHMODE_ASSOC); |
121 | $dist->fetchInto($info, DB_FETCHMODE_ASSOC); |
122 | $display = "<h3>Удаление версии ".stripslashes($info["version"])." (“".stripslashes($info["vname"])."”) <em>".stripslashes($info["distname"])."</em></h3>"; |
122 | $display = "<h3>Удаление версии ".stripslashes($info["version"])." (“".stripslashes($info["vname"])."”) <em>".stripslashes($info["distname"])."</em></h3>"; |
123 | $display .= "<form action='./process.php' method='POST'>\n"; |
123 | $display .= "<form action='./process.php' method='POST'>\n"; |
124 | $display .= "<input type='hidden' name='mode' value='6'>\n"; |
124 | $display .= "<input type='hidden' name='mode' value='6'>\n"; |
125 | $display .= "<input type='hidden' name='versID' value='$uid'>\n"; |
125 | $display .= "<input type='hidden' name='versID' value='$uid'>\n"; |
126 | $display .= "<input type='submit' value='Удалить'></form>\n"; |
126 | $display .= "<input type='submit' value='Удалить'></form>\n"; |
127 | break; |
127 | break; |
128 | }
|
128 | }
|
129 | break; |
129 | break; |
130 | case '3': |
130 | case '3': |
131 | // Работа с репозиториями
|
131 | // Работа с репозиториями
|
132 | switch ($act) { |
132 | switch ($act) { |
133 | case '0': |
133 | case '0': |
134 | // Выбор дистрибутива
|
134 | // Выбор дистрибутива
|
135 | $dist =& $db->query("SELECT * FROM distribution d JOIN version v ON v.dist_id=d.dist_id"); |
135 | $dist =& $db->query("SELECT * FROM distribution d JOIN version v ON v.dist_id=d.dist_id"); |
136 | $display = "В наличии есть следующие версии apt-дистрибутивов:<ul id='distlist'>"; |
136 | $display = "В наличии есть следующие версии apt-дистрибутивов:<ul id='distlist'>"; |
137 | while ($dist->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
137 | while ($dist->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
138 | $display .= "<li><a href='./admin.php?mode=3&action=1&uid=".$info["version_id"]."'>".stripslashes($info["distname"])." ".stripslashes($info["version"])." “".stripslashes($info["vname"])."”</a></li>"; |
138 | $display .= "<li><a href='./admin.php?mode=3&action=1&uid=".$info["version_id"]."'>".stripslashes($info["distname"])." ".stripslashes($info["version"])." “".stripslashes($info["vname"])."”</a></li>"; |
139 | }
|
139 | }
|
140 | $display .= "</ul>"; |
140 | $display .= "</ul>"; |
141 | break; |
141 | break; |
142 | case '1': |
142 | case '1': |
143 | // Список доступных репозиториев для конкретной версии дистрибутива
|
143 | // Список доступных репозиториев для конкретной версии дистрибутива
|
144 | $reps =& $db->query("SELECT * FROM repository r JOIN ver2rep a ON a.rep_id=r.rep_id JOIN rtype t ON r.reptype=t.rtype_id WHERE a.ver_id='$uid'"); |
144 | $reps =& $db->query("SELECT * FROM repository r JOIN ver2rep a ON a.rep_id=r.rep_id JOIN rtype t ON r.reptype=t.rtype_id WHERE a.ver_id='$uid'"); |
145 | $display = "Доступные репозитории для выбранного дистрибутива: <ul id='replist'>"; |
145 | $display = "Доступные репозитории для выбранного дистрибутива: <ul id='replist'>"; |
146 | if ($reps->numRows()>0) { |
146 | if ($reps->numRows()>0) { |
147 | while ($reps->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
147 | while ($reps->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
148 | $display .= "<li>[<a href='./admin.php?mode=3&action=3&uid=".$info["rep_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=3&action=4&uid=".$info["rep_id"]."' class='delete'>удалить</a>] ".stripslashes($info["repname"])." (".stripslashes($info["rtype"]).") — ".stripslashes($info["repdescribe"])."</li>"; |
148 | $display .= "<li>[<a href='./admin.php?mode=3&action=3&uid=".$info["rep_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=3&action=4&uid=".$info["rep_id"]."' class='delete'>удалить</a>] ".stripslashes($info["repname"])." (".stripslashes($info["rtype"]).") — ".stripslashes($info["repdescribe"])."</li>"; |
149 | }
|
149 | }
|
150 | }
|
150 | }
|
151 | $display .= "</ul><p><a href='./admin.php?mode=3&action=2&uid=".$uid."'>Добавить новый репозиторий</a></p>"; |
151 | $display .= "</ul><p><a href='./admin.php?mode=3&action=2&uid=".$uid."'>Добавить новый репозиторий</a></p>"; |
152 | break; |
152 | break; |
153 | case '2': |
153 | case '2': |
154 | // Новый репозиторий
|
154 | // Новый репозиторий
|
155 | $rep =& $db->query("SELECT * FROM distribution d JOIN version v ON v.dist_id=d.dist_id WHERE v.version_id='$uid'"); |
155 | $rep =& $db->query("SELECT * FROM distribution d JOIN version v ON v.dist_id=d.dist_id WHERE v.version_id='$uid'"); |
156 | $rep->fetchInto($dist, DB_FETCHMODE_ASSOC); |
156 | $rep->fetchInto($dist, DB_FETCHMODE_ASSOC); |
157 | $dist_id = $dist["dist_id"]; |
157 | $dist_id = $dist["dist_id"]; |
158 | $dist_vname = stripslashes($dist["distname"])." ".stripslashes($dist["version"])." “".stripslashes($dist["vname"])."”"; |
158 | $dist_vname = stripslashes($dist["distname"])." ".stripslashes($dist["version"])." “".stripslashes($dist["vname"])."”"; |
159 | $dtype =& $db->query("SELECT * FROM rtype"); |
159 | $dtype =& $db->query("SELECT * FROM rtype"); |
160 | $type = "<select name='repType'>"; |
160 | $type = "<select name='repType'>"; |
161 | while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
161 | while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
162 | $type .= "<option value='".$dtinfo["rtype_id"]."'>".stripslashes($dtinfo["rtype"])."</option>"; |
162 | $type .= "<option value='".$dtinfo["rtype_id"]."'>".stripslashes($dtinfo["rtype"])."</option>"; |
163 | }
|
163 | }
|
164 | $sect =& $db->query("SELECT * FROM section s JOIN sect2dist d ON d.sect_id=s.sect_id WHERE d.dist_id='$dist_id'"); |
164 | $sect =& $db->query("SELECT * FROM section s JOIN sect2dist d ON d.sect_id=s.sect_id WHERE d.dist_id='$dist_id'"); |
165 | $list = ""; |
165 | $list = ""; |
166 | while ($sect->fetchInto($slist, DB_FETCHMODE_ASSOC)) { |
166 | while ($sect->fetchInto($slist, DB_FETCHMODE_ASSOC)) { |
167 | $list .= "<input type='checkbox' name='sect[]' value='".$slist["sect_id"]."'> <span title='".stripslashes($slist["sectinfo"])."'>".stripslashes($slist["sectname"])."</span> "; |
167 | $list .= "<input type='checkbox' name='sect[]' value='".$slist["sect_id"]."'> <span title='".stripslashes($slist["sectinfo"])."'>".stripslashes($slist["sectname"])."</span> "; |
168 | }
|
168 | }
|
169 | $type .= "</select>\n"; |
169 | $type .= "</select>\n"; |
170 | $display = "<h3>Добавление нового репозитория для ".$dist_vname."</h3>"; |
170 | $display = "<h3>Добавление нового репозитория для ".$dist_vname."</h3>"; |
171 | $display .= "<form action='./process.php' method='POST'>\n"; |
171 | $display .= "<form action='./process.php' method='POST'>\n"; |
172 | $display .= "<input type='hidden' name='mode' value='7'>\n"; |
172 | $display .= "<input type='hidden' name='mode' value='7'>\n"; |
173 | $display .= "<input type='hidden' name='vers' value='$uid'>\n"; |
173 | $display .= "<input type='hidden' name='vers' value='$uid'>\n"; |
174 | $display .= "Название репозитория (codename): <input type='text' name='repName'><br>\n"; |
174 | $display .= "Название репозитория (codename): <input type='text' name='repName'><br>\n"; |
175 | $display .= "Описание репозитория:<br> <textarea name='repInfo'></textarea><br>\n"; |
175 | $display .= "Описание репозитория:<br> <textarea name='repInfo'></textarea><br>\n"; |
176 | $display .= "Тип репозитория: ".$type."<br>"; |
176 | $display .= "Тип репозитория: ".$type."<br>"; |
177 | $display .= "Секции: ".$list; |
177 | $display .= "Секции: ".$list; |
178 | $display .= "<br><input type='submit' value='Создать'></form>\n"; |
178 | $display .= "<br><input type='submit' value='Создать'></form>\n"; |
179 | break; |
179 | break; |
180 | case '3': |
180 | case '3': |
181 | // Редактирование репозитория
|
181 | // Редактирование репозитория
|
182 | $rep =& $db->query("SELECT * FROM repository WHERE rep_id='$uid'"); |
182 | $rep =& $db->query("SELECT * FROM repository WHERE rep_id='$uid'"); |
183 | $rep->fetchInto($info, DB_FETCHMODE_ASSOC); |
183 | $rep->fetchInto($info, DB_FETCHMODE_ASSOC); |
184 | $tlist = "<select name='repType'>"; |
184 | $tlist = "<select name='repType'>"; |
185 | $sq =& $db->query("SELECT * FROM rtype"); |
185 | $sq =& $db->query("SELECT * FROM rtype"); |
186 | while ($sq->fetchInto($type, DB_FETCHMODE_ASSOC)) { |
186 | while ($sq->fetchInto($type, DB_FETCHMODE_ASSOC)) { |
187 | if ($type["rtype_id"]==$info["reptype"]) { |
187 | if ($type["rtype_id"]==$info["reptype"]) { |
188 | $tlist .= "<option value='".$type["rtype_id"]."' selected>".stripslashes($type["rtype"])."</option>"; |
188 | $tlist .= "<option value='".$type["rtype_id"]."' selected>".stripslashes($type["rtype"])."</option>"; |
189 | } else { |
189 | } else { |
190 | $tlist .= "<option value='".$type["rtype_id"]."'>".stripslashes($type["rtype"])."</option>"; |
190 | $tlist .= "<option value='".$type["rtype_id"]."'>".stripslashes($type["rtype"])."</option>"; |
191 | }
|
191 | }
|
192 | }
|
192 | }
|
193 | $tlist .= "</select>"; |
193 | $tlist .= "</select>"; |
194 | $list = ""; |
194 | $list = ""; |
195 | $req =& $db->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$uid'"); |
195 | $req =& $db->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$uid'"); |
196 | if ($req->numRows()>0) { |
196 | if ($req->numRows()>0) { |
197 | while ($req->fetchInto($sect, DB_FETCHMODE_ASSOC)) { |
197 | while ($req->fetchInto($sect, DB_FETCHMODE_ASSOC)) { |
198 | $list .= "<input type='checkbox' name='sect[]' value='".$sect["sect_id"]."' checked><span title='".stripslashes($sect["sectinfo"])."'>".stripslashes($sect["sectname"])."</span> "; |
198 | $list .= "<input type='checkbox' name='sect[]' value='".$sect["sect_id"]."' checked><span title='".stripslashes($sect["sectinfo"])."'>".stripslashes($sect["sectname"])."</span> "; |
199 | }
|
199 | }
|
200 | }
|
200 | }
|
201 | $req =& $db->query("SELECT s.* FROM section s WHERE s.sect_id NOT IN (SELECT sect_id FROM sect2rep WHERE rep_id='$uid')"); |
201 | $req =& $db->query("SELECT s.* FROM section s WHERE s.sect_id NOT IN (SELECT sect_id FROM sect2rep WHERE rep_id='$uid')"); |
202 | if ($req->numRows()>0) { |
202 | if ($req->numRows()>0) { |
203 | while ($req->fetchInto($sect, DB_FETCHMODE_ASSOC)) { |
203 | while ($req->fetchInto($sect, DB_FETCHMODE_ASSOC)) { |
204 | $list .= "<input type='checkbox' name='sect[]' value='".$sect["sect_id"]."'><span title='".stripslashes($sect["sectinfo"])."'>".stripslashes($sect["sectname"])."</span> "; |
204 | $list .= "<input type='checkbox' name='sect[]' value='".$sect["sect_id"]."'><span title='".stripslashes($sect["sectinfo"])."'>".stripslashes($sect["sectname"])."</span> "; |
205 | }
|
205 | }
|
206 | }
|
206 | }
|
207 | $display = "<h3>Правка репозитория ".$info["repname"]." для <em>".$dist_name."</em></h3>"; |
207 | $display = "<h3>Правка репозитория ".$info["repname"]." для <em>".$dist_name."</em></h3>"; |
208 | $display .= "<form action='./process.php' method='POST'>\n"; |
208 | $display .= "<form action='./process.php' method='POST'>\n"; |
209 | $display .= "<input type='hidden' name='mode' value='8'>\n"; |
209 | $display .= "<input type='hidden' name='mode' value='8'>\n"; |
210 | $display .= "<input type='hidden' name='rep' value='$uid'>\n"; |
210 | $display .= "<input type='hidden' name='rep' value='$uid'>\n"; |
211 | $display .= "Название репозитория (codename): <input type='text' name='repName' value='".stripslashes($info["repname"])."'><br>\n"; |
211 | $display .= "Название репозитория (codename): <input type='text' name='repName' value='".stripslashes($info["repname"])."'><br>\n"; |
212 | $display .= "Описание репозитория:<br> <textarea name='repInfo'>".stripslashes($info["repdescribe"])."</textarea><br>\n"; |
212 | $display .= "Описание репозитория:<br> <textarea name='repInfo'>".stripslashes($info["repdescribe"])."</textarea><br>\n"; |
213 | $display .= "Тип репозитория: ".$tlist."<br>"; |
213 | $display .= "Тип репозитория: ".$tlist."<br>"; |
214 | $display .= "Секции: ".$list; |
214 | $display .= "Секции: ".$list; |
215 | $display .= "<br><input type='submit' value='Править'></form>\n"; |
215 | $display .= "<br><input type='submit' value='Править'></form>\n"; |
216 | break; |
216 | break; |
217 | case '4': |
217 | case '4': |
218 | // Удаление репозитория
|
218 | // Удаление репозитория
|
219 | $rep =& $db->query("SELECT * FROM repository WHERE rep_id='$uid'"); |
219 | $rep =& $db->query("SELECT * FROM repository WHERE rep_id='$uid'"); |
220 | $rep->fetchInto($info, DB_FETCHMODE_ASSOC); |
220 | $rep->fetchInto($info, DB_FETCHMODE_ASSOC); |
221 | $display = "<h3>Удаление репозитория ".$info["repname"]." для <em>".$dist_name."</em></h3>"; |
221 | $display = "<h3>Удаление репозитория ".$info["repname"]." для <em>".$dist_name."</em></h3>"; |
222 | $display .= "<form action='./process.php' method='POST'>\n"; |
222 | $display .= "<form action='./process.php' method='POST'>\n"; |
223 | $display .= "<input type='hidden' name='mode' value='9'>\n"; |
223 | $display .= "<input type='hidden' name='mode' value='9'>\n"; |
224 | $display .= "<input type='hidden' name='rep' value='$uid'>\n"; |
224 | $display .= "<input type='hidden' name='rep' value='$uid'>\n"; |
225 | $display .= "<input type='submit' value='Удалить'></form>\n"; |
225 | $display .= "<input type='submit' value='Удалить'></form>\n"; |
226 | 226 | ||
227 | break; |
227 | break; |
228 | }
|
228 | }
|
229 | break; |
229 | break; |
230 | case '4': |
230 | case '4': |
231 | // Управление разделами
|
231 | // Управление разделами
|
232 | switch ($act) { |
232 | switch ($act) { |
233 | case '0': |
233 | case '0': |
234 | // Список секций
|
234 | // Список секций
|
235 | $req =& $db->query("SELECT * FROM section"); |
235 | $req =& $db->query("SELECT * FROM section"); |
236 | $display = "<p>Имеющиеся секции в репозиториях</p><ul class='sectlist'>"; |
236 | $display = "<p>Имеющиеся секции в репозиториях</p><ul class='sectlist'>"; |
237 | while ($req->fetchInto($sect, DB_FETCHMODE_ASSOC)) { |
237 | while ($req->fetchInto($sect, DB_FETCHMODE_ASSOC)) { |
238 | $sreq =& $db->query("SELECT * FROM distribution d JOIN sect2dist s ON s.dist_id=d.dist_id WHERE s.sect_id='".$sect["sect_id"]."'"); |
238 | $sreq =& $db->query("SELECT * FROM distribution d JOIN sect2dist s ON s.dist_id=d.dist_id WHERE s.sect_id='".$sect["sect_id"]."'"); |
239 | $replist = "<small>Используется в "; |
239 | $replist = "<small>Используется в "; |
240 | while ($sreq->fetchInto($rep, DB_FETCHMODE_ASSOC)) { |
240 | while ($sreq->fetchInto($rep, DB_FETCHMODE_ASSOC)) { |
241 | $replist .= "<em>".stripslashes($rep["distname"])."</em>, "; |
241 | $replist .= "<em>".stripslashes($rep["distname"])."</em>, "; |
242 | }
|
242 | }
|
243 | $replist = substr($replist, 0, -2); |
243 | $replist = substr($replist, 0, -2); |
244 | $replist .= "</small>"; |
244 | $replist .= "</small>"; |
245 | $display .= "<li><strong>".stripslashes($sect["sectname"])."</strong> — [<a href='./admin.php?mode=4&action=2&uid=".$sect["sect_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=4&action=3&uid=".$sect["sect_id"]."' class='delete'>удалить</a>] — ".stripslashes($sect["sectinfo"])."<br>".$replist."</li>"; |
245 | $display .= "<li><strong>".stripslashes($sect["sectname"])."</strong> — [<a href='./admin.php?mode=4&action=2&uid=".$sect["sect_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=4&action=3&uid=".$sect["sect_id"]."' class='delete'>удалить</a>] — ".stripslashes($sect["sectinfo"])."<br>".$replist."</li>"; |
246 | }
|
246 | }
|
247 | $display .= "</ul><p><a href='./admin.php?mode=4&action=1'>Добавить секцию</a></p>"; |
247 | $display .= "</ul><p><a href='./admin.php?mode=4&action=1'>Добавить секцию</a></p>"; |
248 | break; |
248 | break; |
249 | case '1': |
249 | case '1': |
250 | $req =& $db->query("SELECT * FROM distribution"); |
250 | $req =& $db->query("SELECT * FROM distribution"); |
251 | while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) { |
251 | while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) { |
252 | $list .= "<br><input type='checkbox' name='dist' value='".$dist["dist_id"]."'>".stripslashes($dist["distname"])." "; |
252 | $list .= "<br><input type='checkbox' name='dist' value='".$dist["dist_id"]."'>".stripslashes($dist["distname"])." "; |
253 | }
|
253 | }
|
254 | $display = "<h3>Создание секции репозитория</h3>"; |
254 | $display = "<h3>Создание секции репозитория</h3>"; |
255 | $display .= "<form action='./process.php' method='POST'>\n"; |
255 | $display .= "<form action='./process.php' method='POST'>\n"; |
256 | $display .= "<input type='hidden' name='mode' value='10'>\n"; |
256 | $display .= "<input type='hidden' name='mode' value='10'>\n"; |
257 | $display .= "Название секции (codename): <input type='text' name='sectName'><br>\n"; |
257 | $display .= "Название секции (codename): <input type='text' name='sectName'><br>\n"; |
258 | $display .= "Описание секции:<br> <textarea name='sectInfo'></textarea><br>\n"; |
258 | $display .= "Описание секции:<br> <textarea name='sectInfo'></textarea><br>\n"; |
259 | $display .= "Используется в дистрибутивах: ".$list; |
259 | $display .= "Используется в дистрибутивах: ".$list; |
260 | $display .= "<br><input type='submit' value='Добавить'></form>\n"; |
260 | $display .= "<br><input type='submit' value='Добавить'></form>\n"; |
261 | break; |
261 | break; |
262 | case '2': |
262 | case '2': |
263 | $req =& $db->query("SELECT * FROM distribution d JOIN sect2dist s ON s.dist_id=d.dist_id WHERE s.sect_id='$uid'"); |
263 | $req =& $db->query("SELECT * FROM distribution d JOIN sect2dist s ON s.dist_id=d.dist_id WHERE s.sect_id='$uid'"); |
264 | if ($req->numRows()>0) { |
264 | if ($req->numRows()>0) { |
265 | while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) { |
265 | while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) { |
266 | $list .= "<br><input type='checkbox' name='dist[]' value='".$dist["dist_id"]."' checked>".stripslashes($dist["distname"])." "; |
266 | $list .= "<br><input type='checkbox' name='dist[]' value='".$dist["dist_id"]."' checked>".stripslashes($dist["distname"])." "; |
267 | }
|
267 | }
|
268 | }
|
268 | }
|
269 | $req =& $db->query("SELECT d.* FROM distribution d WHERE dist_id NOT IN (SELECT dist_id FROM sect2dist WHERE sect_id='$uid')"); |
269 | $req =& $db->query("SELECT d.* FROM distribution d WHERE dist_id NOT IN (SELECT dist_id FROM sect2dist WHERE sect_id='$uid')"); |
270 | if ($req->numRows()>0) { |
270 | if ($req->numRows()>0) { |
271 | while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) { |
271 | while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) { |
272 | $list .= "<br><input type='checkbox' name='dist[]' value='".$dist["dist_id"]."'>".stripslashes($dist["distname"])." "; |
272 | $list .= "<br><input type='checkbox' name='dist[]' value='".$dist["dist_id"]."'>".stripslashes($dist["distname"])." "; |
273 | }
|
273 | }
|
274 | }
|
274 | }
|
275 | $req =& $db->query("SELECT * FROM section WHERE sect_id='$uid'"); |
275 | $req =& $db->query("SELECT * FROM section WHERE sect_id='$uid'"); |
276 | $req->fetchInto($sect, DB_FETCHMODE_ASSOC); |
276 | $req->fetchInto($sect, DB_FETCHMODE_ASSOC); |
277 | $display = "<h3>Правка секции репозитория</h3>"; |
277 | $display = "<h3>Правка секции репозитория</h3>"; |
278 | $display .= "<form action='./process.php' method='POST'>\n"; |
278 | $display .= "<form action='./process.php' method='POST'>\n"; |
279 | $display .= "<input type='hidden' name='mode' value='11'>\n"; |
279 | $display .= "<input type='hidden' name='mode' value='11'>\n"; |
280 | $display .= "<input type='hidden' name='sectID' value='$uid'>\n"; |
280 | $display .= "<input type='hidden' name='sectID' value='$uid'>\n"; |
281 | $display .= "Название секции (codename): <input type='text' name='sectName' value='".stripslashes($sect["sectname"])."'><br>\n"; |
281 | $display .= "Название секции (codename): <input type='text' name='sectName' value='".stripslashes($sect["sectname"])."'><br>\n"; |
282 | $display .= "Описание секции:<br> <textarea name='sectInfo'>".stripslashes($sect["sectinfo"])."</textarea><br>\n"; |
282 | $display .= "Описание секции:<br> <textarea name='sectInfo'>".stripslashes($sect["sectinfo"])."</textarea><br>\n"; |
283 | $display .= "Используется в дистрибутивах: ".$list; |
283 | $display .= "Используется в дистрибутивах: ".$list; |
284 | $display .= "<br><input type='submit' value='Править'></form>\n"; |
284 | $display .= "<br><input type='submit' value='Править'></form>\n"; |
285 | break; |
285 | break; |
286 | case '3': |
286 | case '3': |
287 | $req =& $db->query("SELECT * FROM section WHERE sect_id='$uid'"); |
287 | $req =& $db->query("SELECT * FROM section WHERE sect_id='$uid'"); |
288 | $req->fetchInto($sect, DB_FETCHMODE_ASSOC); |
288 | $req->fetchInto($sect, DB_FETCHMODE_ASSOC); |
289 | $display = "<h3>Удаление секции <em>".stripslashes($sect["sectname"])."</em></h3>"; |
289 | $display = "<h3>Удаление секции <em>".stripslashes($sect["sectname"])."</em></h3>"; |
290 | $display .= "<form action='./process.php' method='POST'>\n"; |
290 | $display .= "<form action='./process.php' method='POST'>\n"; |
291 | $display .= "<input type='hidden' name='mode' value='12'>\n"; |
291 | $display .= "<input type='hidden' name='mode' value='12'>\n"; |
292 | $display .= "<input type='hidden' name='sectID' value='$uid'>\n"; |
292 | $display .= "<input type='hidden' name='sectID' value='$uid'>\n"; |
293 | $display .= "<br><input type='submit' value='Удалить'></form>\n"; |
293 | $display .= "<br><input type='submit' value='Удалить'></form>\n"; |
294 | break; |
294 | break; |
295 | }
|
295 | }
|
296 | break; |
296 | break; |
297 | }
|
297 | }
|
298 | 298 | ||
299 | $smarty->assign('display',$display); |
299 | $smarty->assign('display',$display); |
300 | $smarty->display('admin.tpl'); |
300 | $smarty->display('admin.tpl'); |
301 | 301 | ||
302 | ?>
|
302 | ?>
|
303 | 303 |