X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=search.cgi;h=2174d52d5c64571d770a627f8d53d00d9b5a99d5;hb=e8250d78d091445fbd422fed5d3ae9ab2516eada;hp=aa8dce13ecb5641217f81ea0702b2e999471d622;hpb=03b5d4275693c3f5a701b9e22e04af8ef57d0a58;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/search.cgi b/search.cgi index aa8dce1..2174d52 100755 --- a/search.cgi +++ b/search.cgi @@ -1,7 +1,8 @@ #!/usr/bin/perl -# $Id: search.cgi,v 1.2 1999/09/26 01:20:39 tausq Exp $ +# $Id: search.cgi,v 1.13 2006/06/27 04:37:45 rmurray Exp $ # (c) 1999 Randolph Chung. Licensed under the GPL. +# (c) 2004 Martin Schulze. Licensed under the GPL. use lib '.'; use strict vars; @@ -32,7 +33,7 @@ $SIG{__DIE__} = \&DieHandler; if (!$dosearch) { # No action yet, send back the search form... - print "Content-type: text/html\n\n"; + print "Content-type: text/html; charset=utf-8\n\n"; open (F, "<$config{websearchhtml}") || &Util::HTMLError($!); while () { s/~id~/$id/g; @@ -71,8 +72,8 @@ if (!$dosearch) { } } - # Vacation is a special case - $filter .= "(onvacation=*)" if ($query->param('vacation')); + # Vacation is a special case, support it only when user is authenticated + $filter .= "(onvacation=*)" if ($query->param('vacation') && $authtoken && $id); # AND all the search terms together $filter = "(&$filter)"; @@ -116,13 +117,14 @@ if (!$dosearch) { $data = $entries->{$dn}; # These are local variables.. i have enough global vars as it is... - my ($ufdn, $login, $name, $email, $fingerprint, $address, $latlong, $vacation, $created, $modified) = undef; + my ($ufdn, $login, $name, $icquin, $jabberjid, $email, $fingerprint, + $address, $latlong, $vacation, $created, $modified, $lastseen) = undef; $ufdn = $dn; # Net::LDAP does not have a dn2ufn function, but this is close enough :) # Assemble name, attach web page link if present. $name = $data->{cn}->[0]." ".$data->{mn}->[0]." ".$data->{sn}->[0]; - if (my $url = $data->{labeledurl}->[0]) { + if (my $url = $data->{labeleduri}->[0]) { $name = "$name"; } @@ -132,6 +134,11 @@ if (!$dosearch) { $email .= "$_"; } + # ICQ + if ($data->{icquin}->[0]) { + $icquin = sprintf("%s", $data->{icquin}->[0], $data->{icquin}->[0]); + } + # Format PGP/GPG key fingerprints my $fi; foreach (@{$data->{keyfingerprint}}) { @@ -153,12 +160,16 @@ if (!$dosearch) { $modified = &Util::FormatTimestamp($data->{modifytimestamp}->[0]); $created = &Util::FormatTimestamp($data->{createtimestamp}->[0]); + # Last seen information (Echelon) + $lastseen = &Util::FormatLastSeen($data->{"activity-pgp"}->[0], + $data->{"activity-from"}->[0]); + # Link in the debian login id $login = $data->{uid}->[0]."\@debian.org"; $login = "$login"; - # See if the user has a vacation message - $vacation = $data->{onvacation}->[0]; + # See if the user has a vacation message, non-public + $vacation = $data->{onvacation}->[0] if ($authtoken && $id); # OK, now generate output... (i.e. put the output into the buffer ) $outsub{searchresults} .= ''; @@ -171,8 +182,12 @@ if (!$dosearch) { $outsub{searchresults} .= FormatEntry($dataspecref->{uid}, $login); $outsub{searchresults} .= FormatEntry($dataspecref->{ircnick}, $data->{ircnick}->[0]); + $outsub{searchresults} .= FormatEntry($dataspecref->{jabberjid}, $data->{jabberjid}->[0]); $outsub{searchresults} .= FormatEntry($dataspecref->{loginshell}, $data->{loginshell}->[0]); $outsub{searchresults} .= FormatEntry($dataspecref->{fingerprint}, $fingerprint); + if ($icquin) { + $outsub{searchresults} .= FormatEntry($dataspecref->{icquin}, $icquin); + } if ($auth) { # Some data should only be available to authorized users... @@ -183,6 +198,7 @@ if (!$dosearch) { $outsub{searchresults} .= FormatEntry($dataspecref->{latlong}, $latlong); $outsub{searchresults} .= FormatEntry($dataspecref->{phone}, $data->{telephonenumber}->[0] || "- unlisted -"); $outsub{searchresults} .= FormatEntry($dataspecref->{fax}, $data->{fascimiletelephonenumber}->[0] || "- unlisted -"); + $outsub{searchresults} .= FormatEntry($dataspecref->{lastseen}, $lastseen); } $outsub{searchresults} .= FormatEntry($dataspecref->{created}, $created); $outsub{searchresults} .= FormatEntry($dataspecref->{modified}, $modified); @@ -191,7 +207,7 @@ if (!$dosearch) { # If this is ourselves, present a link to do mods if ($auth && ($id eq $data->{uid}->[0])) { #TODO: extract this string into a url for translation... - $outsub{searchresults} .= "Edit my settings\n"; + $outsub{searchresults} .= "Edit my settings\n"; } $outsub{searchresults} .= "


\n"; @@ -254,3 +270,5 @@ sub FormatEntry { return "\n"; } + +exit 0;
$key: $val