home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / skeptic / bibliography / display.cgi < prev    next >
Text File  |  2009-08-26  |  3KB  |  109 lines

  1. #!/usr/bin/perl
  2.  
  3. # $rcs = ' $Id: display.cgi,v 1.4 1998/06/20 07:15:03 fitz Exp $ ' ;
  4.  
  5. # Given an ID, displays a single entry from the bibliography.
  6. # The ID must be part of the URL, for example:
  7. # /cgi-bin/display.cgi/ID
  8.  
  9. unshift(@INC, "lib");
  10.  
  11. require 'config.pl';
  12. require 'db.pl';
  13. require 'web.pl';
  14. require 'cgi-lib.pl';
  15.  
  16. print "Content-type: text/html\n\n";
  17. &ReadParse();
  18.  
  19. if ($in{id})
  20. {
  21.     $id = $in{id};
  22. }
  23. elsif ($in{next_submit} && $in{next})
  24. {
  25.     $id = $in{next};
  26. }
  27. elsif ($in{previous_submit} && $in{previous})
  28. {
  29.     $id = $in{previous};
  30. }
  31. else
  32. {
  33.     ($id = $ENV{PATH_INFO}) =~ s!.*/!!;
  34.     &error("Bibliography ID must be specified as part of the URL.") unless $id;
  35. }
  36.  
  37. (%entry) = &db::read_entry($id);
  38. &error("Error reading bibliography entry for ID '$id': $db::error")
  39.   unless defined %entry;
  40.  
  41. if ($entry{SUBMITNAME})
  42. {
  43.     if ($entry{SUBMITADDR})
  44.     {
  45.         $entry{SUBMITNAME} = sprintf("<A HREF=mailto:%s>%s</A>",
  46.                                      &untaint($entry{SUBMITADDR}),
  47.                                      $entry{SUBMITNAME});
  48.     }
  49.  
  50.     $entry{SUBMITNAME} = "<P>Reviewed by $entry{SUBMITNAME}";
  51. }
  52.  
  53. foreach $keyword (sort {uc($a) cmp uc($b)} split(/\s+/, $entry{KEYWORDS}))
  54. {
  55.     push(@keywords, $keyword);
  56. }
  57. $entry{KEYWORDS} = join(', ', @keywords);
  58.  
  59. ($entry{TITLE2} = $entry{TITLE}) =~ s/\W+/ /g;
  60.  
  61. if ($entry{URL})
  62. {
  63.     $entry{TITLE} = &hotlink($entry{URL}, $entry{TITLE});
  64. }
  65.  
  66. foreach (split(/,/, $in{series}))
  67. {
  68.     if ($need_next)
  69.     {
  70.         $next = "<INPUT TYPE=hidden NAME=next VALUE=$_>\n";
  71.         $next .= "<INPUT TYPE=submit NAME=next_submit VALUE=Next>";
  72.         last;
  73.     }
  74.  
  75.     if ($id eq $_)
  76.     {
  77.         $need_next = 1;
  78.         next;
  79.     }
  80.  
  81.     $previous = "<INPUT TYPE=hidden NAME=previous VALUE=$_>\n";
  82.     $previous .= "<INPUT TYPE=submit NAME=previous_submit VALUE=Previous>";
  83. }
  84.  
  85.  
  86. $entry .= &bib::template("entry3.html",
  87.                          "NEXT", $next,
  88.                          "PREVIOUS", $previous,
  89.                          "SERIES", $in{series},
  90.                          "HEADING", $in{heading},
  91.                          "HEADING_UNTAINT", &untaint($in{heading}),
  92.                          %entry)
  93.   if ($next || $previous);
  94.  
  95. $entry .= "<FONT SIZE=2><CENTER><A HREF=/bib/$id>http://$ENV{SERVER_NAME}/bib/$id</A></CENTER></A><P>";
  96.  
  97. $entry .= &bib::template("entry.html",
  98.                         "ID", $id,
  99.                         %entry);
  100. $entry .= &bib::template("entry2.html",
  101.                          "ID", $id,
  102.                          %entry);
  103.  
  104. print &bib::template("basic.html",
  105.                      "TITLE", $entry{TITLE2},
  106.                      "DATA", $entry);
  107.  
  108. exit 0;
  109.