added support to generate the members list in JSON format

this will be used by the w.g.o website so it can get the list of members
trough HTTP
This commit is contained in:
Vinicius Depizzol 2012-01-28 11:46:53 -02:00
parent f67737017a
commit b28307e163

View file

@ -1,22 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>GNOME Foundation Membership List</title>
<meta name="cvsdate" content="$Date$" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>GNOME Foundation Membership List</h1>
<p>
Send comments, questions, and updates to <a
href="mailto:membership-committee&#64;gnome&#46;org">membership-committee&#64;gnome&#46;org</a>.
</p>
<?php <?php
$error = null; $error = null;
function get_members_from_sql () { function get_members_from_sql () {
@ -71,6 +54,45 @@ function get_members_from_sql () {
$members = get_members_from_sql (); $members = get_members_from_sql ();
if (isset ($_GET['format'])) {
$format = $_GET['format'];
} else {
$format = 'html';
}
if ($format == 'json') {
if ($members === FALSE) {
echo json_encode (array ('error' => $error));
} else {
echo json_encode ($members);
exit;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>GNOME Foundation Membership List</title>
<meta name="cvsdate" content="$Date$" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>GNOME Foundation Membership List</h1>
<p>
Send comments, questions, and updates to <a
href="mailto:membership-committee&#64;gnome&#46;org">membership-committee&#64;gnome&#46;org</a>.
</p>
<?php
if ($members === FALSE) { if ($members === FALSE) {
echo "<p>Error: ".$error.".</p>\n"; echo "<p>Error: ".$error.".</p>\n";
} else { } else {