Редакция 581 | Редакция 586 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 581 | Редакция 582 | ||
---|---|---|---|
Строка 332... | Строка 332... | ||
332 | * @param byte $distlogo
|
332 | * @param byte $distlogo
|
333 | * @return array
|
333 | * @return array
|
334 | */
|
334 | */
|
335 | public function addDistribution($distname, $disttype, $distua = '', $distlogo = 0) { |
335 | public function addDistribution($distname, $disttype, $distua = '', $distlogo = 0) { |
336 | $result = array(); |
336 | $result = array(); |
337 | $sDName = $this->secure->checkStr($distname,1); |
337 | $sDName = $this->secure->checkStr($distname); |
338 | $sDType = $this->secure->checkInt($disttype); |
338 | $sDType = $this->secure->checkInt($disttype); |
339 | $sDUAgt = $this->secure->checkStr($distua,1); |
339 | $sDUAgt = $this->secure->checkStr($distua); |
340 | $sDLogo = $this->secure->checkInt($distlogo); |
340 | $sDLogo = $this->secure->checkInt($distlogo); |
341 | 341 | ||
342 | $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'"; |
342 | $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'"; |
343 | $rq =& $this->db->query($query); |
343 | $rq =& $this->db->query($query); |
344 | if (PEAR::isError($this->db)) { |
344 | if (PEAR::isError($this->db)) { |
Строка 437... | Строка 437... | ||
437 | * @return array
|
437 | * @return array
|
438 | */
|
438 | */
|
439 | public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
439 | public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
440 | $result = array(); |
440 | $result = array(); |
441 | $sDistID = $this->secure->checkInt($distID); |
441 | $sDistID = $this->secure->checkInt($distID); |
442 | $sDVersion = $this->secure->checkStr($version,1); |
442 | $sDVersion = $this->secure->checkStr($version); |
443 | $sDVName = $this->secure->checkStr($vname,1); |
443 | $sDVName = $this->secure->checkStr($vname); |
444 | $sDVCName = $this->secure->checkStr($vcodename,1); |
444 | $sDVCName = $this->secure->checkStr($vcodename); |
445 | 445 | ||
446 | $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'"; |
446 | $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'"; |
447 | $rq =& $this->db->query($query); |
447 | $rq =& $this->db->query($query); |
448 | if (PEAR::isError($this->db)) { |
448 | if (PEAR::isError($this->db)) { |
449 | $result["ERR"] = 1; |
449 | $result["ERR"] = 1; |
Строка 738... | Строка 738... | ||
738 | * @param string $sinfo
|
738 | * @param string $sinfo
|
739 | * @return array
|
739 | * @return array
|
740 | */
|
740 | */
|
741 | public function addSection($sname, $sinfo = "") { |
741 | public function addSection($sname, $sinfo = "") { |
742 | $result = array(); |
742 | $result = array(); |
743 | $sSName = $this->secure->checkStr($sname,1); |
743 | $sSName = $this->secure->checkStr($sname); |
744 | $sSInfo = $this->secure->checkStr($sinfo,1); |
744 | $sSInfo = $this->secure->checkStr($sinfo); |
745 | 745 | ||
746 | $query = "INSERT INTO ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."'"; |
746 | $query = "INSERT INTO ".$this->prefix."section SET secname='".$sSName."', sectinfo='".$sSInfo."'"; |
747 | $rq =& $this->db->query($query); |
747 | $rq =& $this->db->query($query); |
748 | if (PEAR::isError($this->db)) { |
748 | if (PEAR::isError($this->db)) { |
749 | $result["ERR"] = 1; |
749 | $result["ERR"] = 1; |
Строка 812... | Строка 812... | ||
812 | * @param string $arch
|
812 | * @param string $arch
|
813 | * @return array
|
813 | * @return array
|
814 | */
|
814 | */
|
815 | public function addArch($arch) { |
815 | public function addArch($arch) { |
816 | $result = array(); |
816 | $result = array(); |
817 | $sArch = $this->secure->checkStr($arch,1); |
817 | $sArch = $this->secure->checkStr($arch); |
818 | 818 | ||
819 | $query = "INSERT INTO ".$this->prefix."arch SET arch='".$sArch."'"; |
819 | $query = "INSERT INTO ".$this->prefix."arch SET arch='".$sArch."'"; |
820 | $rq =& $this->db->query($query); |
820 | $rq =& $this->db->query($query); |
821 | if (PEAR::isError($this->db)) { |
821 | if (PEAR::isError($this->db)) { |
822 | $result["ERR"] = 1; |
822 | $result["ERR"] = 1; |
Строка 969... | Строка 969... | ||
969 | * @param string $scheme
|
969 | * @param string $scheme
|
970 | * @return array
|
970 | * @return array
|
971 | */
|
971 | */
|
972 | public function addScheme($scheme) { |
972 | public function addScheme($scheme) { |
973 | $result = array(); |
973 | $result = array(); |
974 | $sScheme = $this->secure->checkStr($scheme,1); |
974 | $sScheme = $this->secure->checkStr($scheme); |
975 | 975 | ||
976 | $query = "INSERT INTO ".$this->prefix."repscheme SET scheme='".$sScheme."'"; |
976 | $query = "INSERT INTO ".$this->prefix."repscheme SET scheme='".$sScheme."'"; |
977 | $rq =& $this->db->query($query); |
977 | $rq =& $this->db->query($query); |
978 | if (PEAR::isError($this->db)) { |
978 | if (PEAR::isError($this->db)) { |
979 | $result["ERR"] = 1; |
979 | $result["ERR"] = 1; |
Строка 1117... | Строка 1117... | ||
1117 | * @param string $proto
|
1117 | * @param string $proto
|
1118 | * @return array
|
1118 | * @return array
|
1119 | */
|
1119 | */
|
1120 | public function addProto($proto) { |
1120 | public function addProto($proto) { |
1121 | $result = array(); |
1121 | $result = array(); |
1122 | $sProto = $this->secure->checkStr($proto,1); |
1122 | $sProto = $this->secure->checkStr($proto); |
1123 | 1123 | ||
1124 | $query = "INSERT INTO ".$this->prefix."protos SET proto='".$sProto."'"; |
1124 | $query = "INSERT INTO ".$this->prefix."protos SET proto='".$sProto."'"; |
1125 | $rq =& $this->db->query($query); |
1125 | $rq =& $this->db->query($query); |
1126 | if (PEAR::isError($this->db)) { |
1126 | if (PEAR::isError($this->db)) { |
1127 | $result["ERR"] = 1; |
1127 | $result["ERR"] = 1; |
Строка 1215... | Строка 1215... | ||
1215 | 1215 | ||
1216 | return $show; |
1216 | return $show; |
1217 | }
|
1217 | }
|
1218 | 1218 | ||
1219 | /**
|
1219 | /**
|
- | 1220 | * Вывод списка хостов
|
|
- | 1221 | *
|
|
- | 1222 | * @author Alexander Wolf
|
|
- | 1223 | * @category Core
|
|
- | 1224 | *
|
|
- | 1225 | * @param string $name
|
|
- | 1226 | * @param string $actor
|
|
- | 1227 | * @param string $format
|
|
- | 1228 | * @return string
|
|
- | 1229 | */
|
|
- | 1230 | public function showHostsList($name, $actor, $format = 'list') { |
|
- | 1231 | switch($format) { |
|
- | 1232 | case 'list': |
|
- | 1233 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
|
- | 1234 | $rq =& $this->db->query($query); |
|
- | 1235 | $show = "<ul>\n"; |
|
- | 1236 | while ($rq->fetchInto($element)) { |
|
- | 1237 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["rhost_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["rhost_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["rhost"],1)."</li>\n"; |
|
- | 1238 | }
|
|
- | 1239 | $show .= "</ul>"; |
|
- | 1240 | break; |
|
- | 1241 | case 'innerhtml': |
|
- | 1242 | $hostID = $this->secure->checkInt($actor); |
|
- | 1243 | $query = "SELECT * FROM ".$this->prefix."rephost"; |
|
- | 1244 | $rq =& $this->db->query($query); |
|
- | 1245 | $show = "<select name='".$name."' id='".$name."'>\n"; |
|
- | 1246 | while ($rq->fetchInto($element)) { |
|
- | 1247 | if ($element["rhost_id"]==$hostID) { |
|
- | 1248 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."' selected>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
|
- | 1249 | } else { |
|
- | 1250 | $show .= "<option value='".$this->secure->checkInt($element["rhost_id"])."'>".$this->secure->checkStr($element["rhost"],1)."</option>\n"; |
|
- | 1251 | }
|
|
- | 1252 | }
|
|
- | 1253 | $show .= "</select>"; |
|
- | 1254 | break; |
|
- | 1255 | }
|
|
- | 1256 | return $show; |
|
- | 1257 | }
|
|
- | 1258 | ||
- | 1259 | /**
|
|
- | 1260 | * Добавление нового хоста
|
|
- | 1261 | *
|
|
- | 1262 | * @author Alexander Wolf
|
|
- | 1263 | * @category Core
|
|
- | 1264 | *
|
|
- | 1265 | * @param string $host
|
|
- | 1266 | * @return array
|
|
- | 1267 | */
|
|
- | 1268 | public function addHost($host) { |
|
- | 1269 | $result = array(); |
|
- | 1270 | $sHost = $this->secure->checkStr($host); |
|
- | 1271 | ||
- | 1272 | $query = "INSERT INTO ".$this->prefix."rephost SET rhost='".$sProto."'"; |
|
- | 1273 | $rq =& $this->db->query($query); |
|
- | 1274 | if (PEAR::isError($this->db)) { |
|
- | 1275 | $result["ERR"] = 1; |
|
- | 1276 | $result["ERRINFO"] = $this->db->getMessage(); |
|
- | 1277 | } else { |
|
- | 1278 | $result["ERR"] = 0; |
|
- | 1279 | }
|
|
- | 1280 | ||
- | 1281 | return $result; |
|
- | 1282 | }
|
|
- | 1283 | ||
- | 1284 | /**
|
|
- | 1285 | * Удаление информации о хосте
|
|
- | 1286 | *
|
|
- | 1287 | * @author Alexander Wolf
|
|
- | 1288 | * @category Core
|
|
- | 1289 | *
|
|
- | 1290 | * @param integer $hostID
|
|
- | 1291 | * @return array
|
|
- | 1292 | */
|
|
- | 1293 | public function dropHost($hostID) { |
|
- | 1294 | $result = array(); |
|
- | 1295 | $sHostID = $this->secure->checkInt($hostID); |
|
- | 1296 | ||
- | 1297 | // Удаление хоста
|
|
- | 1298 | $query = "DELETE FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
|
- | 1299 | $rq =& $this->db->query($query); |
|
- | 1300 | if (PEAR::isError($this->db)) { |
|
- | 1301 | $result["ERR"] = 1; |
|
- | 1302 | $result["ERRINFO"] = $this->db->getMessage(); |
|
- | 1303 | } else { |
|
- | 1304 | $result["ERR"] = 0; |
|
- | 1305 | }
|
|
- | 1306 | ||
- | 1307 | return $result; |
|
- | 1308 | }
|
|
- | 1309 | ||
- | 1310 | /**
|
|
- | 1311 | * Обновление информации о хосте
|
|
- | 1312 | *
|
|
- | 1313 | * @author Alexander Wolf
|
|
- | 1314 | * @category Core
|
|
- | 1315 | *
|
|
- | 1316 | * @param integer $hostID
|
|
- | 1317 | * @param string $info
|
|
- | 1318 | * @return array
|
|
- | 1319 | */
|
|
- | 1320 | public function updateHost($hostID, $info) { |
|
- | 1321 | $result = array(); |
|
- | 1322 | $sHostID = $this->secure->checkInt($hostID); |
|
- | 1323 | $sHost = $this->secure->checkStr($info); |
|
- | 1324 | ||
- | 1325 | $query = "UPDATE ".$this->prefix."rephost SET rhost='".$sHost."' WHERE rhost_id='".$sHostID."'"; |
|
- | 1326 | $rq =& $this->db->query($query); |
|
- | 1327 | if (PEAR::isError($this->db)) { |
|
- | 1328 | $result["ERR"] = 1; |
|
- | 1329 | $result["ERRINFO"] = $this->db->getMessage(); |
|
- | 1330 | } else { |
|
- | 1331 | $result["ERR"] = 0; |
|
- | 1332 | }
|
|
- | 1333 | ||
- | 1334 | return $result; |
|
- | 1335 | }
|
|
- | 1336 | ||
- | 1337 | /**
|
|
- | 1338 | * Вывод формы редактирования/добавления хостов
|
|
- | 1339 | *
|
|
- | 1340 | * @author Alexander Wolf
|
|
- | 1341 | * @category Core
|
|
- | 1342 | *
|
|
- | 1343 | * @param integer $hostID
|
|
- | 1344 | * @param string $info
|
|
- | 1345 | * @return string
|
|
- | 1346 | */
|
|
- | 1347 | public function showHostForm($hostID = 0, $info = "") { |
|
- | 1348 | $sHostID = $this->secure->checkInt($hostID); |
|
- | 1349 | $sInfo = $this->secure->checkStr($info, 1); |
|
- | 1350 | if ($sInfo == "") { |
|
- | 1351 | $sInfo = "Хост репозитория"; |
|
- | 1352 | }
|
|
- | 1353 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
|
- | 1354 | if ($sHostID != 0) { |
|
- | 1355 | // Режим редактирования
|
|
- | 1356 | $query = "SELECT * FROM ".$this->prefix."rephost WHERE rhost_id='".$sHostID."'"; |
|
- | 1357 | $rq =& $this->db->query($query); |
|
- | 1358 | $rq->fetchInto($element); |
|
- | 1359 | }
|
|
- | 1360 | ||
- | 1361 | $show .= "<div class='inputbox'><label for='rhost'>Хост репозитория:</label> <input type='text' name='rhost' id='rhost' value='".$this->secure->checkStr($element["rhost"],1)."'></div>\n"; |
|
- | 1362 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
|
- | 1363 | ||
- | 1364 | return $show; |
|
- | 1365 | }
|
|
- | 1366 | ||
- | 1367 | /**
|
|
1220 | * Показывает список подписей
|
1368 | * Показывает список подписей
|
1221 | *
|
1369 | *
|
1222 | * @author Alexander Wolf
|
1370 | * @author Alexander Wolf
|
1223 | * @category Core
|
1371 | * @category Core
|
1224 | *
|
1372 | *
|
Строка 1334... | Строка 1482... | ||
1334 | * @param string $sinfo
|
1482 | * @param string $sinfo
|
1335 | * @return array
|
1483 | * @return array
|
1336 | */
|
1484 | */
|
1337 | public function addSign($sname, $sinfo = "") { |
1485 | public function addSign($sname, $sinfo = "") { |
1338 | $result = array(); |
1486 | $result = array(); |
1339 | $sSName = $this->secure->checkStr($sname,1); |
1487 | $sSName = $this->secure->checkStr($sname); |
1340 | $sSInfo = $this->secure->checkStr($sinfo,1); |
1488 | $sSInfo = $this->secure->checkStr($sinfo); |
1341 | 1489 | ||
1342 | $query = "INSERT INTO ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."'"; |
1490 | $query = "INSERT INTO ".$this->prefix."signs SET sname='".$sSName."', sinfo='".$sSInfo."'"; |
1343 | $rq =& $this->db->query($query); |
1491 | $rq =& $this->db->query($query); |
1344 | if (PEAR::isError($this->db)) { |
1492 | if (PEAR::isError($this->db)) { |
1345 | $result["ERR"] = 1; |
1493 | $result["ERR"] = 1; |