Хранилища Subversion ant

Сравнить редакции

Не учитывать пробелы Редакция 617 → Редакция 618

/branches/ant/0.9.x/process.php
398,6 → 398,40
}
 
break;
case 'repository-edit':
// Редактируем репозиторий
$rID = $secure->checkInt($_POST["repositoryID"]); // Версия дистрибутива
$rdist = $secure->checkInt($_POST["rdist"]); // Версия дистрибутива
$rname = $secure->checkStr($_POST["rname"]); // Название репозитория
$rinfo = $secure->checkStr($_POST["rinfo"]); // Описание репозитория
$rkey = $secure->checkStr($_POST["rkey"]); // Ключ подписи репозитория
$rproto = $secure->checkInt($_POST["rproto"]); // Протокол доступа
$rhost = $secure->checkInt($_POST["rhost"]); // Хост репозитория
$rfolder = $secure->checkInt($_POST["rfolder"]); // Корневая папка
$rtype = $secure->checkInt($_POST["rtype"]); // Тип репозитория
$rscheme = $secure->checkInt($_POST["rscheme"]); // Схема репозитория
$rsign = $secure->checkInt($_POST["rsign"]); // Подпись репозитория (для rpm/ALTLinux)
 
$r = $core->updateRepository($rID, $rdist, $rname, $rinfo, $rkey, $rproto, $rhost, $rfolder, $rtype, $rscheme, $rsign, $_POST["rsects"], $_POST["rarchs"]);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
case 'repository-delete':
// Удаляем репозиторий
$rID = $secure->checkInt($_POST["repositoryID"]); // Версия дистрибутива
 
$r = $core->dropRepository($rID);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
}
 
?>
/branches/ant/0.9.x/lib/core.php
2066,6 → 2066,114
return $result;
}
 
/**
* Обновление информации о репозитории
*
* @author Alexander Wolf
* @category Core
*
* @param integer $repID
* @param integer $verionID
* @param string $rname
* @param string $rinfo
* @param string $rkey
* @param integer $proto
* @param integer $rhost
* @param integer $rfolder
* @param integer $rtype
* @param array $sections
* @param array $arch
* @param integer $scheme
* @param integer $sign
* @return array
*/
public function updateRepository($repID, $verionID, $rname, $rinfo, $rkey, $proto, $rhost, $rfolder, $rtype, $scheme, $sign, $sections, $arch) {
$result = array();
$sRepID = $this->secure->checkInt($repID);
$sVersionID = $this->secure->checkInt($verionID);
$sRName = $this->secure->checkStr($rname);
$sRInfo = $this->secure->checkStr($rinfo);
$sRKey = $this->secure->checkStr($rkey);
$sProto = $this->secure->checkInt($proto);
$sRHost = $this->secure->checkInt($rhost);
$sRFolder = $this->secure->checkInt($rfolder);
$sRType = $this->secure->checkInt($rtype);
$sRScheme = $this->secure->checkInt($scheme);
$sRSign = $this->secure->checkInt($sign);
 
$query = "UPDATE ".$this->prefix."repository SET proto_id='".$sProto."', rhost_id='".$sRHost."', rfolder_id='".$sRFolder."', version='".$sVersionID."', rtype_id='".$sRType."', scheme_id='".$sRScheme."', sign_id='".$sRSign."', repname='".$sRName."', repinfo='".$sRInfo."', repkey='".$sRKey."' WHERE rep_id='".$sRepID."'";
$rq =& $this->db->query($query);
 
$query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'";
$rq =& $this->db->query($query);
for($i=0;$i<count($sections);$i++) {
$query = "INSERT INTO ".$this->prefix."sect2rep SET rep_id='".$sRepID."', sect_id='".$sections[$i]."'";
$rq =& $this->db->query($query);
}
 
$query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'";
$rq =& $this->db->query($query);
for($i=0;$i<count($arch);$i++) {
$query = "INSERT INTO ".$this->prefix."arch2rep SET rep_id='".$sRepID."', arch_id='".$arch[$i]."'";
$rq =& $this->db->query($query);
}
 
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$result["ERR"] = 0;
}
 
return $result;
}
 
/**
* Удаление информации о репозитории
*
* @author Alexander Wolf
* @category Core
*
* @param integer $repID
* @return array
*/
public function dropRepository($repID) {
$result = array();
$sRepID = $this->secure->checkInt($repID);
 
// Удаление репозитория
$query = "DELETE FROM ".$this->prefix."repository WHERE rep_id='".$sRepID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$result["ERR"] = 0;
}
 
// Удаление секций репозитория
$query = "DELETE FROM ".$this->prefix."sect2rep WHERE rep_id='".$sRepID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$result["ERR"] = 0;
}
 
// Удаление архитектур репозитория
$query = "DELETE FROM ".$this->prefix."arch2rep WHERE rep_id='".$sRepID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$result["ERR"] = 0;
}
 
return $result;
}
}