source: website/page @ 879

Last change on this file since 879 was 879, checked in by Earle Martin, 15 years ago

Add the openguides.org website!

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/usr/bin/perl
2
3use warnings;
4use strict;
5
6use Template;
7
8my $tt = Template->new({
9    EVAL_PERL    => 1,
10                INCLUDE_PATH => 'templates',
11                PRE_PROCESS  => 'config',
12                PRE_CHOMP    => 1,
13                POST_CHOMP   => 1
14        });
15
16my $page   = $ENV{'REQUEST_URI'} || 'home';
17my $script = $ENV{'SCRIPT_NAME'};
18$page =~ s{^$script/}{};
19$page = 'home' if $page =~ m{\*|\?|/}; # elite security
20
21my $vars = { page => $page };
22
23print "Content-Type: text/html\n\n";
24
25$tt->process('wrapper', $vars) || error($tt->error);
26
27sub error {
28        my $error = shift;
29
30        print <<HTML;
31<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
32<html>
33<head>
34        <title>Error</title>
35<style type="text/css">
36body {
37        background: #fff;
38        color: #000;
39        margin: 10px;
40        font: 1em Verdana, Arial, sans-serif
41}
42blockquote {
43        background: #ccc;
44        color: #000;
45        border: 1px dotted #000;
46        padding: 10px
47}
48</style>
49</head>
50<body>
51<h1>Error</h1>
52<p>
53Something has gone wrong. Here's what Template Toolkit had to say:
54</p>
55<blockquote>
56$error
57</blockquote>
58</body>
59</html>
60HTML
61
62}
Note: See TracBrowser for help on using the repository browser.