Хранилища Subversion ant

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

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

/branches/ant/0.9.x/manager.php
27,8 → 27,6
$uuid = $secure->checkInt($_GET["uuid"]);
 
$valid = $core->checkCookieSign($_COOKIE[$cookie]);
$manager = "./manager.php";
$process = "./process.php";
 
$scripts = "";
 
/branches/ant/0.9.x/process.php
21,6 → 21,91
$r = $core->checkSign($_POST["word"]);
header("Location: ".$r["Location"]."\n\n");
break;
case 'distributive-add':
// Добавление нового дистрибутива
$DName = $secure->checkStr($_POST["dname"],1);
$DUA = $secure->checkStr($_POST["dua"],1);
$DType = $secure->checkInt($_POST["dtype"]);
// TODO Обработка файла с логотипом дистрибутива
 
$r = $core->addDistribution($DName, $DType, $DUA, $DLogo);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
case 'distributive-edit':
// Редактирование информации о дистрибутиве
$ID = $secure->checkInt($_POST["distID"]);
$DName = $secure->checkStr($_POST["dname"],1);
$DUA = $secure->checkStr($_POST["dua"],1);
$DType = $secure->checkInt($_POST["dtype"]);
// TODO Обработка файла с логотипом дистрибутива
 
$r = $core->updateDistribution($ID, $DName, $DType, $DUA, $DLogo);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
case 'distributive-delete':
// Удаление информации о дистрибутиве
$ID = $secure->checkInt($_POST["distID"]);
 
$r = $core->dropDistribution($ID);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
case 'version-add':
// Добавление новой версии дистрибутива
$DistID = $secure->checkInt($_POST["distname"]);
$VName = $secure->checkStr($_POST["vname"],1);
$VNmbr = $secure->checkStr($_POST["version"],1);
$VCNme = $secure->checkStr($_POST["vcodename"],1);
 
$r = $core->addDistVersion($DistID, $VNmbr, $VName, $VCNme);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
case 'version-edit':
// Редактирование версии дистрибутива
$versID = $secure->checkInt($_POST["versionID"]);
$VName = $secure->checkStr($_POST["vname"],1);
$VNmbr = $secure->checkStr($_POST["version"],1);
$VCNme = $secure->checkStr($_POST["vcodename"],1);
 
$r = $core->updateDistVersion($versID, $VNmbr, $VName, $VCNme);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
case 'version-delete':
// Удаление версии дистрибутива
$versID = $secure->checkInt($_POST["versionID"]);
 
$r = $core->dropDistVersion($versID);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
}
 
?>
/branches/ant/0.9.x/lib/core.php
333,12 → 333,12
* @param byte $distlogo
* @return array
*/
public function addDistribution($distname, $disttype, $distua = 1, $distlogo = 0) {
public function addDistribution($distname, $disttype, $distua = '', $distlogo = 0) {
$result = array();
$sDName = $this->secure->checkStr($distname);
$sDType = $this->secure->checkInt($disttype);
$sDUAgt = $this->secure->checkStr($distua);
$sDLogo = $this->secure->checkInt($distname);
$sDLogo = $this->secure->checkInt($distlogo);
 
$query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'";
$rq =& $this->db->query($query);
354,6 → 354,78
}
 
/**
* Обновление информации о дистрибутиве
*
* @author Alexander Wolf
* @category Core
*
* @param integer $distID
* @param string $distname
* @param integer $disttype
* @param string $distua
* @param integer $distlogo
* @return array
*/
public function updateDistribution($distID, $distname, $disttype, $distua, $distlogo) {
$result = array();
$sDID = $this->secure->checkInt($distID);
$sDName = $this->secure->checkStr($distname);
$sDType = $this->secure->checkInt($disttype);
$sDUAgt = $this->secure->checkStr($distua);
$sDLogo = $this->secure->checkInt($distlogo);
 
$query = "UPDATE ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."' WHERE dist_id='".$sDID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$rq->fetchInto($element);
$result["ERR"] = 0;
}
 
return $result;
}
 
/**
* Удаление информации о дистрибутиве
*
* @author Alexander Wolf
* @category Core
*
* @param integer $distID
* @return array
*/
public function dropDistribution($distID) {
$result = array();
$sDID = $this->secure->checkInt($distID);
 
// Удаление дистрибутива
$query = "DELETE FROM ".$this->prefix."distribution WHERE dist_id='".$sDID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$rq->fetchInto($element);
$result["ERR"] = 0;
}
 
// Удаление версий дистрибутива
$query = "DELETE FROM ".$this->prefix."version WHERE dist_id='".$sDID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$rq->fetchInto($element);
$result["ERR"] = 0;
}
 
return $result;
}
 
/**
* Добавление поддержки новой версии apt-дистрибутива
*
* @author Alexander Wolf
386,6 → 458,76
}
 
/**
* Редактирование информации о версии дистрибутива
*
* @author Alexander Wolf
* @category Core
*
* @param integer $versionID
* @param string $version
* @param string $vname
* @param string $vcodename
* @return array
*/
public function updateDistVersion($versionID, $version, $vname = "", $vcodename = "") {
$result = array();
$sVersID = $this->secure->checkInt($versionID);
$sDVersion = $this->secure->checkStr($version);
$sDVName = $this->secure->checkStr($vname);
$sDVCName = $this->secure->checkInt($vcodename);
 
$query = "UPDATE ".$this->prefix."version SET vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."' WHERE version_id='".$sVersID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$rq->fetchInto($element);
$result["ERR"] = 0;
}
 
return $result;
}
 
/**
* Удаление информации о версии дистрибутива
*
* @author Alexander Wolf
* @category Core
*
* @param integer $versionID
* @return array
*/
public function dropDistVersion($versionID) {
$result = array();
$sVersID = $this->secure->checkInt($versionID);
 
// Удаление версии дистрибутива
$query = "DELETE FROM ".$this->prefix."version WHERE version_id='".$sVersID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$rq->fetchInto($element);
$result["ERR"] = 0;
}
 
// Удаление репозиториев этой версии дистрибутива
$query = "DELETE FROM ".$this->prefix."repository WHERE version='".$sVersID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$rq->fetchInto($element);
$result["ERR"] = 0;
}
 
return $result;
}
 
/**
* Отображение типа дистрибутива
*
* @author Alexander Wolf
/branches/ant/0.9.x/init.php
43,6 → 43,8
 
$cookie = "asHash";
$webroot = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/";
$manager = "./manager.php";
$process = "./process.php";
 
$secure = new Security();
$core = new Core($db, PREFIX, $secure, $cookie);