-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathautohandler.in
201 lines (182 loc) · 5.44 KB
/
autohandler.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<%perl>
my $output;
if(defined($dbh)) {
$output = $m->scomp($m->fetch_next,$m->caller_args(0));
} else {
$output = '
Hey, I really hate to be the one to break it to you, but for some
reason, I can\'t get a connection to the database. Dreadfully sorry.
Please let <a href="mailto:'.
$m->base_comp->attr('admin_email').
'">the admins</a>
know just as soon as you can. Please include a concise description of
what happened leading up to this. Just in case.
';
}
# Some pages get to skip all the shiny menu bits.
if( $m->fetch_next->name =~ m/^xml-export\.html$/ ||
$m->fetch_next->name =~ m/^recent.atom/ ||
$m->fetch_next->name =~ m/^recent.rss/ )
{
$output =~ s/^\s*//s;
print "$output";
} else {
utf8::decode($output);
</%perl>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//<% uc($lang) %>"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%$lang%>" lang="<%$lang%>">
<head>
<style type="text/css">
<!--
BODY { /*background-image:url(/images/gaufarvica.jpg);*/
background-attachment:fixed;
background-repeat:no-repeat;
background-position:bottom right; }
-->
.form-notice { border: .1em solid red; background: #FCC; color: black; padding: .5em; }
a.undefined { color: red }
</style>
<meta name="keywords" content="jbovlaste lojban dictionary" />
<!-- Don't bitch about my XHTML, and I won't gnaw off your head.
Besides, it is all pieced together from a half dozen files.
Each individual bit looks good to me when I work on it. -jfk -->
<title>jbovlaste: <& SELF:title &></title>
</head>
<body bgcolor="white" text="black">
<table width="100%">
<tr>
<td colspan="2">
<table width="100%"><tr>
<td align="left">
<font face="Viner Hand ITC,Times" size="+5">
<strong>jbovlaste</strong>
</font>
</td>
</tr></table>
a lojban dictionary editing system<hr />
</td>
</tr>
<tr>
<& bits/menubar, menu => $menu &>
<td width="80%">
<% $output %>
</td>
</tr>
<tr>
<td width="100%" colspan="2">
<& bits/status &>
</td>
</tr>
</table>
<hr />
<table width="100%">
<tr>
<td align="left" valign="top">
</td>
<td valign="top">
<a href="/recent.html">recent changes</a>
</td>
<td align="right" valign="top">
<a href="/">jbovlaste main</a>
</td>
</tr>
<tr>
<td align="left" valign="top">
<font size="-1">
This is jbovlaste, the lojban dictionary system.<br />
The main code was last changed on <!-- #JVS#DATE# -->.<br />
All content is public domain. By submitting content, you agree to place
it in the public domain to the fullest extent allowed by local law. <br />
jbovlaste is an official project of the logical language group,
and is now headed by <a href="mailto:[email protected]">Robin Lee Powell</a>.<br />
E-mail him if you have any questions.
</font>
</td>
<td />
<td align="right" valign="bottom">
<font size="-1">
% if(!defined($session{'username'})) {
care to <a href="/login.html">log in</a>?
% } else {
you're logged in as <% $session{'username'} %>.<br />
<a href="/logout.html">click here to logout</a>.
% }
</font>
</td>
</tr>
</table>
</body>
</html>
% }
<%once>
use utf8;
use MIME::Base64;
use Data::Dumper;
use DBI;
use utils;
</%once>
<%init>
my $menu =
[ [ "Home", "/" ],
[ "Get A Printable Dictionary", "/export/latex.html" ],
[ "Search Best Words", "/lookup" ],
[ "Recent Changes", "/recent.html" ],
[ "How You Can Help", "/help/howtohelp.html" ],
[ "valsi - All", "/dict/listing.html" ],
[ "valsi - Preferred Only", "/dict/listing.html?bg=1" ],
[ "natlang - All", "/natlang/listing.html" ],
[ "natlang - Preferred Only", "/natlang/listing.html?bg=1" ],
[ "Languages", "/languages.html" ],
[ "XML Export", "/export/xml.html" ],
[ "user Listing", "/personal/listing.html" ],
[ "Report Bugs", "https://github.com/lojban/jbovlaste/issues" ],
[ "Utilities", "/util/index.html" ],
[ "Status", "/status.html" ],
[ "Help", "/help/index.html" ],
[ "Admin Request", "/moderation.html" ]
];
if( $m->fetch_next->attr_if_exists('menu') )
{
push @{$menu}, @{$m->fetch_next->attr('menu')};
};
my $lang = "en";
use FindBin;
use lib "$FindBin::Bin/../lib";
use db;
$dbh->{RaiseError} = 1;
my $cookie = $r->headers_in->{'Cookie'};
my @cookies = split(/\s*;\s*/, $cookie);
my %cookies = map { /(.+)=(.+)/; $1 => $2 } @cookies;
our %session;
if(defined($cookies{'jbovlastesessionid'})) {
$cookies{'jbovlastesessionid'} =~ s/\%(..)/chr hex $1/ge;
my $sessionid = utils::decrypt(decode_base64($cookies{'jbovlastesessionid'}));
if($sessionid =~ /^(\d+):(\d+):([\w-]+):(\d+)$/ &&
($1 == length($2)+length($3)+length($4))) {
my @info = split(/:/,$sessionid);
%session = ( 'userid' => $info[1],
'username' => $info[2],
'logintime' => $info[3] );
} else {
%session = ( );
}
} else {
%session = ( );
}
$r->headers_out->add('Cache-Control' => 'no-cache');
my $self = $m->base_comp;
</%init>
<%cleanup>
$dbh->disconnect();
</%cleanup>
<%attr>
admin_email => "jbovlaste-admin\@lojban.org"
jbovlaste_dir => "/srv/jbovlaste/current"
</%attr>
<%method title>
The Lojban Dictionary Editing System (Something is Screwed Up)
</%method>