Редакция 52 |
К новейшей редакции |
Авторство |
Сравнить с предыдущей |
Последнее изменение |
Открыть журнал
| Скачать
| RSS
<?php
/**
* Project: Ant: sources.list generator
* File: m-process.php
*
* This application is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
include "lib/init.php";
$dist = abs(intval($_GET["d"]));
$vers = abs(intval($_GET["v"]));
$status = abs(intval($_GET["status"]));
header('Content-Type: text/html; charset=utf-8');
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
switch($status) {
case '1':
$result = '[{value:"",text:"Выбрать версию дистрибутива"}';
$query =& $db->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id WHERE v.dist_id='$dist'");
while ($query->fetchInto($version, DB_FETCHMODE_ASSOC
)) {
if ($version["vname"]!="") {
$distname = stripslashes($version["vname"]);
} else {
$distname = "";
}
$result .= ',{value:"'.$version["version_id"].'",text:"'.stripslashes($version["version"]).' '.$distname.'"}';
}
$result .= ']';
break;
case '2':
$query =& $db->query("SELECT * FROM settings");
$settings = array();
$result = "# Ant: sources.list generator :: http://track.altlug.ru/projects/show/ant\n\n";
while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC
)) {
$settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]);
};
$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
);
$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 JOIN scheme s ON s.scheme_id=r.scheme_id WHERE v.ver_id='$vers' ORDER BY r.rtype_id, r.scheme_id ASC");
while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC
)) {
$repscheme = stripslashes($resinfo["scheme"]);
$querysect =& $db->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE
r.rep_id='$resinfo[rep_id]'");
$sections = "";
while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC
)) {
$sections .= stripslashes($section["sectname"])." ";
}
$repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme);
$repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme);
$repscheme = str_replace("{URL}",$settings["url"],$repscheme);
$repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme);
$repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme);
$repscheme = str_replace("{SECT}",$sections,$repscheme);
$result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n";
}
break;
case '3':
$result = "<a href='./get.php?id=".$dist.",".$vers."'>Получить sources.list файлом</a>";
break;
}
print $result;
}
?>