From b4fcb4c27b058dd417ef1a225915ef305493bf7f Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 8 Feb 2019 11:20:36 +0100 Subject: feeds/feed.php: WIP --- feeds/feed.php | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 1 deletion(-) (limited to 'feeds') diff --git a/feeds/feed.php b/feeds/feed.php index 040c36d..177071b 100644 --- a/feeds/feed.php +++ b/feeds/feed.php @@ -1,3 +1,126 @@ '', 'added' => 'added', 'removed' => 'removed'); + $actions = array('' => ''); + $archs = array('all' => 'all'); + $result = mysql_run_query( + "SELECT DISTINCT `architectures`.`name` FROM `architectures`" . + mysql_join_architectures_repositories() . + " WHERE `repositories`.`is_on_master_mirror`" . + " ORDER BY `name`" + ); + while ($row = $result -> fetch_assoc()) + $archs[$row['name']] = $row['name']; + $repos = array('' => ''); + $result = mysql_run_query( + "SELECT DISTINCT `repositories`.`name` FROM `repositories` WHERE `repositories`.`is_on_master_mirror` ORDER BY `name`" + ); + while ($row = $result -> fetch_assoc()) + $repos[$row['name']] = $row['name']; + + if (count($uri_parts) > 0 && array_key_exists($uri_parts[0], $actions)) { + $action = $uri_parts[0]; + array_splice( + $uri_parts, + 0, 1 + ); + } + else + $action = ''; + + if (count($uri_parts) > 0) { + if (!array_key_exists($uri_parts[0], $archs)) + throw_http_error(501, "Not Implemented", implode('/',$uri_parts)); + $arch = $uri_parts[0]; + array_splice( + $uri_parts, + 0, 1 + ); + } + else + $arch = ''; + + if (count($uri_parts) > 0) { + if (!array_key_exists($uri_parts[0], $repos)) + throw_http_error(501, "Not Implemented", implode('/',$uri_parts)); + $repo = $uri_parts[0]; + array_splice( + $uri_parts, + 0, 1 + ); + } + else + $repo = ''; + + if (count($uri_parts) != 0) + throw_http_error(501, "Not Implemented", implode('/',$uri_parts)); + +# $result = mysql_run_query( +# TODO +# ); + + print ""; + print ""; + print ""; + print "Arch Linux 32: "; + switch ($action) { + case '': + print "Recent package updates"; + break; + case 'added': + print "Recent added packages"; + break; + case 'removes': + print "Recent removed packages"; + break; + } + if ($arch != '') + print " (" . $arch; + if ($repo != '') + print " [" . $repo . "]"; + if ($arch != '') + print ")"; + print ""; + print ""; + print "https://archlinux32.org" . $_SERVER['REQUEST_URI']; + print ""; + print ""; + print ""; +# TODO + print ""; + + die(); + +} + +throw_http_error(501, "Not Implemented"); -- cgit v1.2.3-70-g09d2