home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
skeptic
/
bibliography
/
home.cgi
< prev
next >
Wrap
Text File
|
2009-08-26
|
2KB
|
79 lines
#!/usr/bin/perl
# $rcs = ' $Id: home.cgi,v 1.4 1998/06/20 07:15:03 fitz Exp $ ' ;
# Default title - will be overwritten by category name
$title = "Home Page";
unshift(@INC, "lib");
require 'config.pl';
require 'bib.pl';
require 'web.pl';
print "Content-type: text/html\n\n";
&bib::load("CATEGORY", "KEYWORDS", "TITLE", "AUTHOR", "META");
# Get the categories
@categories = &bib::get_categories();
&error($bib::error) unless defined @categories;
# Get the keywords
@keywords = &bib::get_keywords(1);
&error($bib::error) unless defined @keywords;
# Get the keyword modifiers
@modifiers = &bib::get_modifiers();
&error($bib::error) unless defined @modifiers;
# Construct a list of all titles
foreach $category (@categories)
{
$CATEGORY = uc($category);
$cats .= ", " if $cats;
$cats .= sprintf("<A HREF=%s>%s</A>", "$bib::cgi/home.cgi/$category", $CATEGORY);
}
# Get the category from the URL name
($category = $ENV{PATH_INFO}) =~ s!.*home.cgi/?!!;
if ($category)
{
$CATEGORY = uc($category);
$title = "$CATEGORY";
$heading = "Category: <A HREF=$bib::cgi/home.cgi/$category>$CATEGORY</A>";
$all .= sprintf("<H2>%s</H2>\n", $CATEGORY);
$all .= "<UL>\n";
foreach $id (sort bib::id_by_title &bib::get_ids_in_category($category))
{
$series .= "$id,";
next if $bib::db{$id}->{META} =~ /submit|delete/;
$all .= "<LI> " . &bib::link_to_id($id);
}
$all .= "</UL>\n";
}
# Convert the categories, keywords, and modifiers to HTML option list
grep(s/.*/<OPTION>$&\n/, @categories);
grep(s/.*/<OPTION>$&\n/, @keywords);
grep(s/.*/<OPTION>$&\n/, @modifiers);
# Create the HTML page
$data= &bib::template("home.html",
"CATEGORIES", "@categories",
"KEYWORDS", "@keywords",
"MODIFIERS", "@modifiers",
"CATS", $cats,
"TITLE", $title,
"HEADING", &untaint($heading),
"ALL", $all,
"SERIES", $series,);
print &bib::template("basic.html",
"TITLE", $title,
"DATA", $data,);
exit 0;