Commit 2ab632bd authored by Adriaan de Groot's avatar Adriaan de Groot 💬
Browse files

Revert "Re-apply a382fd44"

This reverts commit ca0ce752.
parent ca0ce752
<?php
return Array(
'url' => 'ldap://localhost:389',
'binddn' => '',
'bindpw' => ''
);
<?php
header("Content-type: text/css");
$ldapConfig = include('ldap_config.php');
$ldapConnection = ldap_connect($ldapConfig['url'])
or die("The LDAP URI was not parsable");
ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3);
$ldapBind = ldap_bind($ldapConnection, $ldapConfig['binddn'], $ldapConfig['bindpw']);
if (!$ldapBind) {
die('Could not bind with the LDAP server');
}
$filter = '(groupMember=ev-active)';
$result = ldap_search($ldapConnection, 'ou=people,dc=kde,dc=org', $filter, ['cn']);
$members = ldap_get_entries($ldapConnection, $result);
unset($members['count']);
usort($members, function ($a, $b) {
$a = $a['cn'][0];
$b = $b['cn'][0];
$replacements = ["å"=>"a", "à"=>"a", "é"=>"e"];
$a = strtr(mb_strtolower($a, 'UTF-8'), $replacements);
$b = strtr(mb_strtolower($b, 'UTF-8'), $replacements);
return strcmp($a, $b);
});
$array = [];
foreach($members as $member) {
$array[] = $member['cn'][0];
}
echo json_encode($array);
......@@ -18,18 +18,13 @@ These are the current active members (alphabetical by first name):
<br style="clear:left;" />
<script>
fetch('https://my.kde.org/ev-members')
fetch('/members-api.php')
.then(function(response) {
return response.json();
})
.then(function(members) {
/* These letters are sufficient for our first-name-sorting */
const uniderp = (s) => s.toLowerCase().replace(/å/g,'a').replace(/à/g,'a').replace(/é/g,'e');
memberNames = members["members"];
memberNames.sort((a, b) => uniderp(a).localeCompare(uniderp(b)));
const memberList = document.getElementById('memberList');
memberNames.forEach(function(member) {
members.forEach(function(member) {
const li = document.createElement('li');
li.appendChild(document.createTextNode(member));
memberList.appendChild(li);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment