/trunk/process.php |
---|
68,9 → 68,9 |
$versID = abs(intval($_POST["vers"])); |
$repname = mysql_real_escape_string($_POST["repName"]); |
$repinfo = mysql_real_escape_string($_POST["repInfo"]); |
$reptype = abs(intval($_POST["repType"])); |
$repsche = abs(intval($_POST["scheme"])); |
$res =& $db->query("INSERT INTO repository SET repname='$repname', repdescribe='$repinfo', reptype='$reptype'"); |
$res =& $db->query("INSERT INTO repository SET repname='$repname', repdescribe='$repinfo', scheme_id='$repsche'"); |
$res =& $db->query("SELECT rep_id FROM repository ORDER BY rep_id DESC LIMIT 1"); |
$res->fetchInto($rep, DB_FETCHMODE_ASSOC); |
$rep_id = $rep["rep_id"]; |
86,9 → 86,9 |
$repID = abs(intval($_POST["rep"])); |
$repname = mysql_real_escape_string($_POST["repName"]); |
$repinfo = mysql_real_escape_string($_POST["repInfo"]); |
$reptype = abs(intval($_POST["repType"])); |
$repsche = abs(intval($_POST["scheme"])); |
$res =& $db->query("UPDATE repository SET repname='$repname', repdescribe='$repinfo', reptype='$reptype' WHERE rep_id='$repID'"); |
$res =& $db->query("UPDATE repository SET repname='$repname', repdescribe='$repinfo', scheme_id='$repsche' WHERE rep_id='$repID'"); |
$res =& $db->query("DELETE FROM sect2rep WHERE rep_id='$repID'"); |
for ($i=0;$i<count($_POST["sect"]);$i++) { |
$res =& $db->query("INSERT INTO sect2rep SET sect_id='".$_POST["sect"][$i]."', rep_id='$repID'"); |
/trunk/index.php |
---|
26,6 → 26,11 |
} |
if (isset($vers)) { |
$query =& $db->query("SELECT * FROM settings"); |
$settings = array(); |
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); |
$distname = ""; |
33,39 → 38,26 |
$distname = "“".stripslashes($infodist["vname"])."”"; |
} |
$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"); |
$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.scheme_id 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]'"); |
$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)) { |
$result .= stripslashes($section["sectname"])." "; |
$sections .= stripslashes($section["sectname"])." "; |
} |
$result .= "\n"; |
$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 .= $repscheme."\n"; |
} |
$result .= "</pre>"; |
$result = $info.$result; |
/trunk/admin.php |
---|
141,11 → 141,11 |
break; |
case '1': |
// Список доступных репозиториев для конкретной версии дистрибутива |
$reps =& $db->query("SELECT * FROM repository r JOIN ver2rep a ON a.rep_id=r.rep_id JOIN rtype t ON r.reptype=t.rtype_id WHERE a.ver_id='$uid'"); |
$reps =& $db->query("SELECT * FROM repository r JOIN ver2rep a ON a.rep_id=r.rep_id WHERE a.ver_id='$uid'"); |
$display = "Доступные репозитории для выбранного дистрибутива: <ul id='replist'>"; |
if ($reps->numRows()>0) { |
while ($reps->fetchInto($info, DB_FETCHMODE_ASSOC)) { |
$display .= "<li>[<a href='./admin.php?mode=3&action=3&uid=".$info["rep_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=3&action=4&uid=".$info["rep_id"]."' class='delete'>удалить</a>] ".stripslashes($info["repname"])." (".stripslashes($info["rtype"]).") — ".stripslashes($info["repdescribe"])."</li>"; |
$display .= "<li>[<a href='./admin.php?mode=3&action=3&uid=".$info["rep_id"]."' class='edit'>править</a>][<a href='./admin.php?mode=3&action=4&uid=".$info["rep_id"]."' class='delete'>удалить</a>] ".stripslashes($info["repname"])." — ".stripslashes($info["repdescribe"])."</li>"; |
} |
} |
$display .= "</ul><p><a href='./admin.php?mode=3&action=2&uid=".$uid."'>Добавить новый репозиторий</a></p>"; |
156,10 → 156,10 |
$rep->fetchInto($dist, DB_FETCHMODE_ASSOC); |
$dist_id = $dist["dist_id"]; |
$dist_vname = stripslashes($dist["distname"])." ".stripslashes($dist["version"])." “".stripslashes($dist["vname"])."”"; |
$dtype =& $db->query("SELECT * FROM rtype"); |
$type = "<select name='repType'>"; |
$dtype =& $db->query("SELECT * FROM scheme"); |
$type = "<select name='scheme'>"; |
while ($dtype->fetchInto($dtinfo, DB_FETCHMODE_ASSOC)) { |
$type .= "<option value='".$dtinfo["rtype_id"]."'>".stripslashes($dtinfo["rtype"])."</option>"; |
$type .= "<option value='".$dtinfo["scheme_id"]."'>".stripslashes($dtinfo["scheme"])."</option>"; |
} |
$sect =& $db->query("SELECT * FROM section s JOIN sect2dist d ON d.sect_id=s.sect_id WHERE d.dist_id='$dist_id'"); |
$list = ""; |
173,7 → 173,7 |
$display .= "<input type='hidden' name='vers' value='$uid'>\n"; |
$display .= "Название репозитория (codename): <input type='text' name='repName'><br>\n"; |
$display .= "Описание репозитория:<br> <textarea name='repInfo'></textarea><br>\n"; |
$display .= "Тип репозитория: ".$type."<br>"; |
$display .= "Схема репозитория: ".$type."<br>"; |
$display .= "Секции: ".$list; |
$display .= "<br><input type='submit' value='Создать'></form>\n"; |
break; |
181,13 → 181,13 |
// Редактирование репозитория |
$rep =& $db->query("SELECT * FROM repository WHERE rep_id='$uid'"); |
$rep->fetchInto($info, DB_FETCHMODE_ASSOC); |
$tlist = "<select name='repType'>"; |
$sq =& $db->query("SELECT * FROM rtype"); |
$tlist = "<select name='scheme'>"; |
$sq =& $db->query("SELECT * FROM scheme"); |
while ($sq->fetchInto($type, DB_FETCHMODE_ASSOC)) { |
if ($type["rtype_id"]==$info["reptype"]) { |
$tlist .= "<option value='".$type["rtype_id"]."' selected>".stripslashes($type["rtype"])."</option>"; |
if ($type["scheme_id"]==$info["scheme_id"]) { |
$tlist .= "<option value='".$type["scheme_id"]."' selected>".stripslashes($type["scheme"])."</option>"; |
} else { |
$tlist .= "<option value='".$type["rtype_id"]."'>".stripslashes($type["rtype"])."</option>"; |
$tlist .= "<option value='".$type["scheme_id"]."'>".stripslashes($type["scheme"])."</option>"; |
} |
} |
$tlist .= "</select>"; |
210,7 → 210,7 |
$display .= "<input type='hidden' name='rep' value='$uid'>\n"; |
$display .= "Название репозитория (codename): <input type='text' name='repName' value='".stripslashes($info["repname"])."'><br>\n"; |
$display .= "Описание репозитория:<br> <textarea name='repInfo'>".stripslashes($info["repdescribe"])."</textarea><br>\n"; |
$display .= "Тип репозитория: ".$tlist."<br>"; |
$display .= "Схема репозитория: ".$tlist."<br>"; |
$display .= "Секции: ".$list; |
$display .= "<br><input type='submit' value='Править'></form>\n"; |
break; |