summaryrefslogtreecommitdiffstats
path: root/maintdb.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-12-26 13:28:58 +0000
committerRomain d'Alverny <rda@mageia.org>2011-12-26 13:28:58 +0000
commit2a3860778f587c7eaa0ebeb1baa45931e78ab115 (patch)
tree3bf0ae6fee03b263dc8be1f2ca1111e9273b0671 /maintdb.php
parent51b6839613ca6449c9bd78db28f71b88322f11c6 (diff)
downloadpkgsubmit-2a3860778f587c7eaa0ebeb1baa45931e78ab115.tar
pkgsubmit-2a3860778f587c7eaa0ebeb1baa45931e78ab115.tar.gz
pkgsubmit-2a3860778f587c7eaa0ebeb1baa45931e78ab115.tar.bz2
pkgsubmit-2a3860778f587c7eaa0ebeb1baa45931e78ab115.tar.xz
pkgsubmit-2a3860778f587c7eaa0ebeb1baa45931e78ab115.zip
fix iurt return case, doc
Diffstat (limited to 'maintdb.php')
-rw-r--r--maintdb.php35
1 files changed, 8 insertions, 27 deletions
diff --git a/maintdb.php b/maintdb.php
index 843759f..26ee1e5 100644
--- a/maintdb.php
+++ b/maintdb.php
@@ -8,6 +8,8 @@
*
* @param string $uid (GET param) user id
* @param string $pkg (GET param) package name
+ *
+ *
* @param mixed $txt (GET param) whether to return result in text or JSON (default)
* @param string $iurt (GET param) return a iurt-specific response format: only the username
*
@@ -15,13 +17,11 @@
*
* Returned format is JSON format as a default:
* <code>
- * {"user_name": {"packages" => ["package_name1", "package_name2"]}}
+ * {"maintainers": {"username": => {"packages" => ["package_name1", "package_name2"]}}}
* </code>
- *
- * either text format (use ?txt in query string)
+ * or
* <code>
- * package_name user_name
- * package_name2 user_name2
+ * {"packages": {"package_name": {"maintainers" => ["user1", "user2"]}}}
* </code>
*
* either specific, iurt format (use ?pkg=...&iurt in query string)
@@ -52,9 +52,6 @@ $uid = isset($_GET['uid']) ? trim(htmlentities(strip_tags($_GET['uid']))) : null
/** Package name */
$pkg = isset($_GET['pkg']) ? trim(htmlentities(strip_tags($_GET['pkg']))) : null;
-/** Return format */
-$txt = isset($_GET['txt']) ? true : false;
-
$iurt = isset($_GET['iurt']) ? true : false;
/** Returned data */
@@ -88,26 +85,10 @@ if (null !== $uid) {
if ($iurt && $pkg) {
header('Content-Type: text/plain; charset: utf-8');
- if (isset($return[$pkg]))
- echo $return[$pkg]['uid'], "\n";
+ if (isset($return['packages']))
+ echo $return['packages'][$pkg]['maintainers'][0], "\n";
else
- echo '';
-}
-elseif ($txt) {
- header('Content-Type: text/plain; charset: utf-8');
- if (is_array($return)) {
- if (null !== $uid) {
- foreach ($return as $u => $data) {
- foreach ($data['packages'] as $p) {
- echo sprintf("%s %s\n", $p, $u);
- }
- }
- } else {
- echo sprintf('%s %s', $pkg, $return[$pkg]['uid']);
- }
- } else {
- echo $return;
- }
+ echo "\n";
}
else {
header('Content-Type: application/json; charset=utf-8');