X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=machines.cgi;h=9438b26285fee2e49d856b68c87c877445e1a54c;hb=b774f5ea60c257eac26a01b2c071a4a982542ec4;hp=166c2cae566f51f7061860871e3d419e0c8a7f70;hpb=ad531d4c89d9e99eb51d7bced0c508a47daff198;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/machines.cgi b/machines.cgi index 166c2ca..9438b26 100755 --- a/machines.cgi +++ b/machines.cgi @@ -83,6 +83,28 @@ sub sshfingerprint { return $hrfpr; } +sub wiki_link($) { + my ($in) = @_; + $in =~ s#\[\[(.*?)\|(.*?)\]\]#$2#g; + $in =~ s#\[\[(.*?)\]\]#$1#g; + return $in; +} + +sub item_uplist($) { + my ($items) = @_; + my $out = undef; + + if (scalar @$items >= 1) { + $out = ""; + } + return $out; +} + $SIG{__DIE__} = \&DieHandler; my $query = new CGI; @@ -92,6 +114,7 @@ my $sortorder = lc($query->param('sortorder')) || "asc"; &Util::HTMLSendHeader; $ldap = Net::LDAP->new($config{ldaphost}) || &Util::HTMLError($!); +&Util::UpgradeConnection($ldap) unless $config{usessl} eq 'False'; $mesg; $ldap->bind; @@ -149,9 +172,9 @@ foreach $dn (sort {$entries->{$a}->{host}->[0] cmp $entries->{$b}->{host}->[0]} } } - #Reformat purposes to be pleasing for the human eye: - $output{purpose} = join(",", @{$data->{purpose}}); - + my $purpose = item_uplist($data->{purpose}); + $output{purpose} = $purpose if defined $purpose; + $selected = " selected "; }