<?php
/*><!--*/
  // There are no form fields, but let's call untaint() anyway...
  require_once '../../Systems/lib/php/utils/taint.php';
  untaint();

  require 'dbinfo.phi';
  require '../../2000/09/dbwg/funcs.phi';

  $group = 32061;             // = CSS WG

  $dbh = @mysql_connect($db_mirror, $db_userid, $db_password);
  if ($dbh == 0) {
      echo "error: mysql_connect returned 0";
      exit;
  }
  mysql_select_db("w3c");

  $query = "
    SELECT
      u.family,
      u.given,
      g.name
    FROM
      userDetails AS u,
      groupDetails AS wg,
      hierarchy AS h,
      ids AS i
   LEFT OUTER JOIN idInclusions ON
     idInclusions.id = i.id
     AND idInclusions.groupId in (102, 105)
   LEFT OUTER JOIN hierarchy AS employee ON
     employee.sub = i.id
     AND employee.stops = 0
   LEFT OUTER JOIN hierarchy AS employer ON
     employer.sub = employee.super
     AND employer.super IN (102, 105)
     AND employer.stops = 0
   LEFT OUTER JOIN groupDetails AS g ON
     g.id = employer.sub
    WHERE
      h.type = 'U'
      AND i.id = h.sub
      AND h.super = $group
      AND h.stops = 0
      AND u.id = i.id
      AND wg.id = h.super
      AND (employer.sub IS NOT NULL OR groupId IS NULL)
    GROUP BY
      i.value
    ORDER BY
      u.family,
      u.given";

  $result = mysql_query($query);

  if (!$result)
      print "\n    <tr><td colspan=3>query failed\n";
  else {
      while ($row = mysql_fetch_array($result)) {
        print "\n    <tr class=vcard>\n      <td class=fn><span>";
        print htmlspecialchars(utf8_encode($row["given"]));
        print " ";
        print htmlspecialchars(utf8_encode($row["family"]));
        print "</span>\n      <td class=org>";
        print htmlspecialchars(utf8_encode($row["name"]));
        print "\n";
      }
      mysql_free_result($result);
  }
/*--><?*/
?>
