Хранилища Subversion ant

Редакция

Редакция 475 | Авторство | Сравнить с предыдущей | Последнее изменение | Открыть журнал | Скачать | RSS

<?php

/**
 *  
 *  Codename: ant-ng - generator of sources.list for Debian and
 *  distributives, based on Debian
 *  http://alex-w.org.ru/p/antng/
 *
 *  Copyright (c) 2009 Alexander Wolf
 *  Dual licensed under the MIT and GNU LGPL licenses.
 *  http://alex-w.org.ru/p/antng/license
 *
 */


require_once dirname(__FILE__)."/init.php";

$mode = $_POST["mode"];

switch ($mode) {
    case 'authorize':
        $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;
}

?>