Хранилища Subversion ant

Редакция

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

<?php

include "lib/init.php";
$status = abs(intval($_GET["step"]));
$dist   = abs(intval($_GET["d"]));
$vers   = abs(intval($_GET["v"]));

$query =& $db->query("SELECT * FROM distribution");
while ($query->fetchInto($data, DB_FETCHMODE_ASSOC)) {
        $linux .= "<input type='radio' name='d' value='".$data["dist_id"]."'>".stripslashes($data["distname"])."<br>\n";
}

if (!isset($status)) { $status = 0; };

if (isset($dist)) {
        $query =& $db->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id WHERE v.dist_id='$dist'");
        $distvers = "<input type='hidden' name='d' value='".$dist."'>\n";
        while ($query->fetchInto($version, DB_FETCHMODE_ASSOC)) {
                if ($version["vname"]!="") {
                        $distname = "&#8220;".stripslashes($version["vname"])."&#8221;";
                } else {
                        $distname = "";
                }
                $distvers .= "<input type='radio' name='v' value='".$version["version_id"]."'>".stripslashes($version["distname"])." ".stripslashes($version["version"])." ".$distname."<br>\n";
        }
}

if (isset($vers)) {
        $query =& $db->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id JOIN dtype p ON d.disttype=p.type_id WHERE v.dist_id='$dist' AND v.version_id='$vers'");
        $query->fetchInto($infodist, DB_FETCHMODE_ASSOC);
        $distname = "";
        if ($infodist["vname"]!="") {
                $distname = "&#8220;".stripslashes($infodist["vname"])."&#8221;";
        }
        $info = "Доступные репозитории для <em>".stripslashes($infodist["distname"])." ".stripslashes($infodist["version"])." ".$distname."</em>";
        $query =& $db->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN version v2 ON v.ver_id=v2.version_id  WHERE v.ver_id='$vers' ORDER BY r.reptype ASC");
        $result = "<pre>";
        while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC)) {
            switch ($resinfo["reptype"]) {
                case '1':
                        $result .= stripslashes($infodist["type"])." http://apt.nix-files.org.ru/".stripslashes($resinfo["repname"])." ".stripslashes($resinfo["vcodename"])." ";
                        break;
                case '2':
                        if ($infodist["dist_id"]==1) {
                            $result .= stripslashes($infodist["type"])." http://apt.nix-files.org.ru/".stripslashes($resinfo["repname"])." ".stripslashes($resinfo["vcodename"])."/updates ";
                        } else {
                            $result .= stripslashes($infodist["type"])." http://apt.nix-files.org.ru/".stripslashes($resinfo["repname"])." ".stripslashes($resinfo["vcodename"])."-security ";
                        }
                        break;
                case '3':
                        if ($infodist["dist_id"]==1) {
                            $result .= stripslashes($infodist["type"])." http://apt.nix-files.org.ru/".stripslashes($resinfo["repname"])." ".stripslashes($resinfo["vcodename"])."-proposed-updates ";
                        } else {
                            $result .= stripslashes($infodist["type"])." http://apt.nix-files.org.ru/".stripslashes($resinfo["repname"])." ".stripslashes($resinfo["vcodename"])."-updates ";
                        }
                        break;
                case '4':
                        $result .= stripslashes($infodist["type"])." http://apt.nix-files.org.ru/".stripslashes($resinfo["repname"])." ".stripslashes($resinfo["vcodename"])."-backports ";
                        break;
                case '5':
                        $result .= stripslashes($infodist["type"])." http://apt.nix-files.org.ru/".stripslashes($resinfo["repname"])." ".stripslashes($resinfo["vcodename"])." ";
                        break;
           }
            $querysect =& $db->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE r.rep_id='$resinfo[rep_id]'");
            while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) {
                    $result .= stripslashes($section["sectname"])." ";
            }
        $result .= "\n";
        }
        $result .= "</pre>";
        $result = $info.$result;
}

$smarty->assign('status',$status);
$smarty->assign('linux',$linux);
$smarty->assign('version',$distvers);
$smarty->assign('result',$result);

$smarty->display('index.tpl');

?>