Редакция 667 | Редакция 669 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 667 | Редакция 668 | ||
---|---|---|---|
Строка 597... | Строка 597... | ||
597 | *
|
597 | *
|
598 | * @param array $data
|
598 | * @param array $data
|
599 | * @return string
|
599 | * @return string
|
600 | */
|
600 | */
|
601 | public function showSourcesList($data) { |
601 | public function showSourcesList($data) { |
602 | //TODO Написать генератор sources.list
|
- | |
603 | // Извлекаем информацию о дистрибутиве и его версии
|
602 | // Извлекаем информацию о дистрибутиве и его версии
|
604 | $query = "SELECT * FROM ".$this->prefix."distribution d "; |
603 | $query = "SELECT * FROM ".$this->prefix."distribution d "; |
605 | $query .= "JOIN ".$this->prefix."version v ON v.dist_id=d.dist_id "; |
604 | $query .= "JOIN ".$this->prefix."version v ON v.dist_id=d.dist_id "; |
606 | $query .= "JOIN ".$this->prefix."dtype t ON d.disttype=t.type_id "; |
605 | $query .= "JOIN ".$this->prefix."dtype t ON d.disttype=t.type_id "; |
607 | $query .= "WHERE d.dist_id='".$data["dist_id"]."' AND v.version_id='".$data["version_id"]."'"; |
606 | $query .= "WHERE d.dist_id='".$data["dist_id"]."' AND v.version_id='".$data["version_id"]."'"; |
Строка 676... | Строка 675... | ||
676 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
675 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
677 | $rq =& $this->db->query($query); |
676 | $rq =& $this->db->query($query); |
678 | while ($rq->fetchInto($sections)) { |
677 | while ($rq->fetchInto($sections)) { |
679 | $show .= $sections["secname"]." "; |
678 | $show .= $sections["secname"]." "; |
680 | }
|
679 | }
|
681 | $show .= "\n"; |
680 | $show .= "\n\n"; |
682 | }
|
681 | }
|
683 | $show .= "\n"; |
682 | $show .= "\n"; |
- | 683 | } else { |
|
- | 684 | // Базовый репозиторий
|
|
- | 685 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
|
- | 686 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
|
- | 687 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
|
- | 688 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
|
- | 689 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
|
- | 690 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
|
- | 691 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
|
- | 692 | $query .= "WHERE v.version_id='".$data["version_id"]."' AND r.rtype_id='1'"; |
|
- | 693 | $rq =& $this->db->query($query); |
|
- | 694 | $rq->fetchInto($base); |
|
- | 695 | // Формируем type proto://host/folder
|
|
- | 696 | $show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n"; |
|
- | 697 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
|
- | 698 | if ($base["sign_id"]!=0) { |
|
- | 699 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
|
- | 700 | $rq =& $this->db->query($query); |
|
- | 701 | $rq->fetchInto($sign); |
|
- | 702 | $show .= "[".$this->secure->checkStr($sign["sign"],1)."] "; |
|
- | 703 | }
|
|
- | 704 | $show .= $this->secure->checkStr($base["proto"],1).$this->secure->checkStr($base["rhost"],1).$this->secure->checkStr($base["rfolder"],1)." "; |
|
- | 705 | $show .= $this->secure->checkStr($base["scheme"],1); |
|
684 | 706 | ||
- | 707 | // Формируем sections
|
|
- | 708 | $query = "SELECT * FROM ".$this->prefix."section s "; |
|
- | 709 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
|
- | 710 | $query .= "WHERE r.rep_id='".$base["rep_id"]."' AND ("; |
|
- | 711 | for($i=0;$i<count($data["section"]);$i++) { |
|
- | 712 | $query .= "s.sect_id='".$data["section"][$i]."' "; |
|
- | 713 | if ($i<count($data["section"])-1) { |
|
- | 714 | $query .= " OR "; |
|
- | 715 | }
|
|
685 | }
|
716 | }
|
- | 717 | $query .= ")"; |
|
- | 718 | $rq =& $this->db->query($query); |
|
- | 719 | while ($rq->fetchInto($sections)) { |
|
- | 720 | $show .= $sections["secname"]." "; |
|
- | 721 | }
|
|
- | 722 | $show .= "\n\n"; |
|
- | 723 | ||
- | 724 | // Репозитории обновлений и третьих лиц
|
|
- | 725 | $query = "SELECT * FROM ".$this->prefix."repository r "; |
|
- | 726 | $query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id "; |
|
- | 727 | $query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id "; |
|
- | 728 | $query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id "; |
|
- | 729 | $query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id "; |
|
- | 730 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
|
- | 731 | $query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id "; |
|
- | 732 | $query .= "WHERE r.rtype_id>'1' AND ("; |
|
- | 733 | for($i=0;$i<count($data["repository"]);$i++) { |
|
- | 734 | $query .= "r.rep_id='".$data["repository"][$i]."' "; |
|
- | 735 | if ($i<count($data["repository"])-1) { |
|
- | 736 | $query .= " OR "; |
|
- | 737 | }
|
|
- | 738 | }
|
|
- | 739 | $query .= ") ORDER BY r.rtype_id ASC"; |
|
- | 740 | $req =& $this->db->query($query); |
|
- | 741 | while ($req->fetchInto($updates)) { |
|
- | 742 | // Формируем type proto://host/folder
|
|
- | 743 | $show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n"; |
|
- | 744 | $show .= $this->secure->checkStr($dist["type"],1)." "; |
|
- | 745 | if ($updates["sign_id"]!=0) { |
|
- | 746 | $query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'"; |
|
- | 747 | $rqs =& $this->db->query($query); |
|
- | 748 | $rqs->fetchInto($sign); |
|
- | 749 | $show .= "[".$this->secure->checkStr($sign["sign"],1)."] "; |
|
- | 750 | }
|
|
- | 751 | $show .= $this->secure->checkStr($updates["proto"],1).$this->secure->checkStr($updates["rhost"],1).$this->secure->checkStr($updates["rfolder"],1)." "; |
|
- | 752 | $show .= $this->secure->checkStr($updates["scheme"],1); |
|
- | 753 | // Формируем sections
|
|
- | 754 | $query = "SELECT * FROM ".$this->prefix."section s "; |
|
- | 755 | $query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id "; |
|
- | 756 | $query .= "WHERE r.rep_id='".$updates["rep_id"]."'"; |
|
- | 757 | $rq =& $this->db->query($query); |
|
- | 758 | while ($rq->fetchInto($sections)) { |
|
- | 759 | $show .= $sections["secname"]." "; |
|
- | 760 | }
|
|
- | 761 | $show .= "\n\n"; |
|
- | 762 | }
|
|
- | 763 | $show .= "\n"; |
|
- | 764 | }
|
|
- | 765 | ||
- | 766 | $HTTPHeader1 = "Content-length: ".strlen($show); |
|
- | 767 | $HTTPHeader2 = "Content-disposition: attachment; filename=sources.list\n\n"; |
|
686 | 768 | ||
- | 769 | header($HTTPHeader1); |
|
- | 770 | header($HTTPHeader2); |
|
687 | return $show; |
771 | return $show; |
688 | }
|
772 | }
|
689 | 773 | ||
690 | /**
|
774 | /**
|
691 | * Показывает список секций
|
775 | * Показывает список секций
|