Commit 819948a2 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Not used

parent aecafd64
#!wml -oindex.html
#use wml::openldap::openldap area=find subarea=main page=main
<page_title name="Find"
keywords="find, search, site map, site map"
description="Search OpenLDAP site by keyword or phrase"
>
<page_id>
$OpenLDAP$
</page_id>
Search the OpenLDAP site by keyword or phrase.
<p>
The operators AND, OR, and NOT are supported. If you enter
multiple words <i>without</i> an operator, the AND operator
is implied. The search is not case sensitive.
<p>
<form method=GET action="results.epl">
<table>
<tr>
<td align=right><face>Search String:</face></td>
<td rowspan=3><space width=5 heigth=1></td>
<td><input type=txt name=query size=32 maxlength=80></td>
</tr><tr>
<td align=right><face>Limit Results:</face></td>
<td><input type=txt name=results value=20 size=2 maxlength=2></td>
</tr><tr>
<td></td>
<td><input type=submit><space width=10 height=1><input type=reset></td>
</tr>
</table>
</form>
#!wml -oresults.epl
#use wml::openldap::openldap area=find subarea=search page=results header=off
<page_title name="Search Results"
keywords="search results, results"
description="Search Results"
>
<page_id>
$OpenLDAP$
</page_id>
<?
# ePerl!
#
#- Configurable Variables ---------------------------------------------------#
#Our host
$host = "www.openldap.org";
#Path to SWISH-E executable
$swish = "/usr/local/bin/swish-e";
#Path to this CGI script
$swishcgi = "/find/";
#Path to the SWISH-E index
$index = "/data/www/sites/$host/find/swish-e.idx";
#Path to the SWISH-E configuration file
$config = "/usr/local/etc/apache/swish-e/${host}.cf";
#- Main Program -------------------------------------------------------------#
#Parse the form data
&parse_form_data (*FORM);
#Construct a simple query
$query = $FORM{'query'};
$results = $FORM{'results'};
$results = "10" unless ($results);
if ($query) {
&search_parse;
}else{
&search_error("You must enter a keyword or phrase in one or more of the text boxes");
}
#- Subroutines ---------------------------------------------------------------#
#Subroutine for checking and parsing the incoming form data.
sub parse_form_data {
local (*FORM_DATA) = @_;
local ($request_method, $query_string, @key_value_pairs, $key_value, $key, $value);
$request_method = $ENV{'REQUEST_METHOD'};
if ($request_method eq "GET") {
$query_string = $ENV{'QUERY_STRING'};
} elsif ($request_method eq "POST") {
read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
} else {
&search_error ("Forms must use either GET or POST.");
return;
}
@key_value_pairs = split (/&/, $query_string);
foreach $key_value (@key_value_pairs) {
($key, $value) = split (/=/, $key_value);
$value =~ tr/+/ /;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
if (defined ($FORM_DATA{$key})) {
$FORM_DATA{$key} = join ("\0", $FORM_DATA{$key}, $value);
} else {
$FORM_DATA{$key} = $value;
}
}
}
#Subroutine for constructing the Swish-E search request and formating the results.
sub search_parse {
#Create your SWISH-E query command
$count=0;
$cmd ="$swish -w '$query' -m '$results' -f '$index' |";
open(SWISH, $cmd) or
return &search_error("open failed: $cmd");
while (<SWISH>) {
chop;
# Check for errors
if ($_ eq "err: no results") {
&search_error("There were no items that matched your search request");
return;
}
if ($_ eq "err: could not open index file") {
&search_error("Could not open SWISH Index File $index");
return;
}
if ($_ eq "err: no search words specified") {
&search_error("Please Enter at least one Search Word");
return;
}
if ($_ eq "err: a word is too common") {
&search_error(
"One of your search terms is too common, please try again");
return;
}
next if /^\D/;
$count++;
push(@results, $_);
}
#Print the results page
&html_header("Search Results");
print <<Search_Results;
<p>
Your search for <strong>$query</strong> returned
<tt>$count</tt> items of <tt>$results</tt> requested.
In order of computed relevance, they are:<br>
</p>
<ul>
Search_Results
foreach (@results) {
select(STDOUT);
($stringone, $title, $filesize) = split(/\"/, $_);
($rank, $url) = split(/ /, $stringone);
print "<li><a href=\"$url\">$title</a>\n";
}
print "</ul>\n";
&html_trailer;
}
#Subroutine for printing a generic HTML header.
sub html_header {
my $h = $_[0];
print <<HTML_Header;
<h1>$h</h1>
HTML_Header
}
#Subroutine for printing a generic HTML trailer.
sub html_trailer {
}
#Subroutine for printing error messages.
sub search_error {
&html_header("Search Error");
$error_message = $_[0];
print "<P>\n$error_message</P>\n";
}
!>
#!wml -ositemap.html
#use wml::openldap::openldap area=find subarea=sitemap
<page_title name="Site Map"
keywords="find, site map, pages, index, toc, table of contents, index"
description="A map of the <openldap> site"
>
<page_id>
$OpenLDAP$
</page_id>
<a href="../">Main Page</a>
<ul>
<li><a href="../project/">Project</a>
<li><a href="../foundation/">Foundation</a>
<li><a href="../software/">Software</a>
<li><a href="../devel/">Development</a>
<li>
#
# SWISH-E Configuration file for:
# www.OpenLDAP.org Master index
#
IndexDir /data/www/sites/pages
IndexFile /data/www/sites/www.openldap.org/find/swish-e.idx
MetaNames swish-keywords swish-description
IndexName "www.OpenLDAP.org"
IndexDescription "Index of OpenLDAP"
IndexPointer "http://www.OpenLDAP.org/"
IndexAdmin "OpenLDAP Webmaster <webmaster@OpenLDAP.org>"
IndexOnly .html .txt .phtml
IndexReport 2
FollowSymLinks no
NoContents .gif .xbm .au .mov .mpg .pdf .ps
ReplaceRules replace "/data/www/sites/www.openldap.org/" "/"
ReplaceRules replace "/data/www/sites/pages/" "/"
ReplaceRules replace "/data/www/share/icons" "/icons"
ReplaceRules replace "/data/www/share/cgi-bin" "/cgi-bin"
ReplaceRules replace "/index.html" "/"
ReplaceRules replace "/index.htm" "/"
ReplaceRules replace "/index.shtml" "/"
ReplaceRules replace "/index.phtml" "/"
ReplaceRules replace "/index.cgi" "/"
FileRules pathname contains restricted CVS
FileRules filename is robots.txt
FileRules filename is results.phtml
FileRules filename contains % ~ .bak .orig .old old. ORIG. .wmlrc .wml .idx #
FileRules title contains DRAFT
IgnoreLimit 80 50
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