6 sub vars
{ return $_[0]->{cgi
}->Vars(); }
7 sub upload_dirs
{ return @
{ $_[0]->{upload_dirs
} }; }
13 foreach my $k (keys(%headers)) {
14 $self->{http_headers
}->{$k} = $headers{$k};
17 return $self->{http_headers
};
24 $self->http_headers( 'Set-Cookie', shift );
27 return $ENV{HTTP_COOKIE
};
30 sub redirect
{ $_[0]->http_headers( 'Location', $_[1] ); }
37 $self->{data
} = $data;
49 my $file = $self->{cgi
}->param($field);
50 my ($basename) = ($file =~ /([^\/\\]+)$/);
52 if (! grep(/^$dir$/, $self->upload_dirs())) {
53 croak
"Unauthorized upload directory $dir";
56 my $filename = $dir . '/' . $basename;
58 open F
, '>' . $filename or croak
"Can't write $filename";
70 my $obj = bless( { @_ }, $class );
72 $obj->{http_headers
} = {
73 'Content-Type' => 'text/html; charset=ISO-8859-1',
74 'X-Powered-By' => 'Gruta',
75 'X-Gateway-Interface' => $ENV{'GATEWAY_INTERFACE'},
76 'X-Server-Name' => $ENV{'SERVER_NAME'}
79 $obj->{upload_dirs
} ||= [];
81 $obj->{cgi
} = CGI
->new();
90 my $data = $self->data();
91 my $vars = $self->vars();
93 $data->template->cgi_vars($vars);
95 if ($ENV{REMOTE_USER
} and my $u = $data->user($ENV{REMOTE_USER
})) {
98 elsif (my $cookie = $self->cookie()) {
99 if (my ($sid) = ($cookie =~ /^sid\s*=\s*(\d+)$/)) {
100 $data->auth_from_sid( $sid );
107 $st = uc($vars->{t
});
110 $st = 'INDEX' unless $st =~ /^[-\w0-9_]+$/;
114 eval { $body = $data->template->process( $st ) };
118 # $self->redirect('?t=INDEX');
119 $body = "<pre>$@</pre>";
122 $body = $data->special_uris($body);
124 my $h = $self->http_headers();
125 foreach my $k (keys(%{ $h })) {
126 print $k, ': ', $h->{$k}, "\n";