]> mj.ucw.cz Git - pciids.git/commitdiff
Remove something needed by old login version
authorMichal Vaner <vorner@ucw.cz>
Mon, 1 Sep 2008 10:19:35 +0000 (12:19 +0200)
committerMichal Vaner <vorner@ucw.cz>
Mon, 1 Sep 2008 10:19:35 +0000 (12:19 +0200)
The original version was a bit simpler and it is not needed.

PciIds/Html/Handler.pm

index 0d82e3f4031d5ef2a7763eb7cb1cfbc7830c83b2..879086a26c4632175eb5127fc8eab119edbff926 100644 (file)
@@ -12,9 +12,6 @@ use PciIds::Html::Admin;
 use PciIds::Html::Notifications;
 use PciIds::Html::Help;
 use Apache2::Const qw(:common :http);
-use base 'Exporter';
-
-our @EXPORT = qw(&callHandler);
 
 $ENV{'PATH'} = '';
 my $dbh = connectDb();
@@ -59,27 +56,22 @@ my %handlers = (
        }
 );
 
-sub callHandler( $$$$$$ ) {
-       my( $req, $args, $tables, $auth, $hasSSL, $meth ) = @_;
+sub handler( $$ ) {
+       my( $req, $hasSSL ) = @_;
+       my $args = parseArgs( $req->args() );
+       return HTTPRedirect( $req, $req->uri()."index.html" ) if( $req->uri() eq '/' && ( !defined $args->{'action'} || $args->{'action'} ne 'help' ) );
+       return DECLINED if( $req->uri() =~ /^\/((static)\/|robots.txt|index.html)/ );
        my $action = $args->{'action'};
        $action = '' unless( defined $action );
-       my $method = $handlers{$meth};
+       my $method = $handlers{$req->method()};
        return HTTP_METHOD_NOT_ALLOWED unless( defined $method );#Can't handle this method
        my $sub = $method->{$action};
        return HTTP_BAD_REQUEST unless( defined $sub );#I do not know this action for given method
-       $auth = checkLogin( $req, $tables ) unless defined $auth;#Check if logged in
+       my $auth = checkLogin( $req, $tables );#Check if logged in
        $auth->{'ssl'} = $hasSSL;
-       return &{$sub}( $req, $args, $tables, $auth );#Just do the right thing
-}
-
-sub handler( $$ ) {
-       my( $req, $hasSSL ) = @_;
-       my $args = parseArgs( $req->args() );
-       return HTTPRedirect( $req, $req->uri()."index.html" ) if( $req->uri() eq '/' && ( !defined $args->{'action'} || $args->{'action'} ne 'help' ) );
-       return DECLINED if( $req->uri() =~ /^\/((static)\/|robots.txt|index.html)/ );
-       my $result;
+       my( $result );
        eval {
-               $result = callHandler( $req, $args, $tables, undef, $hasSSL, $req->method() );
+               $result = &{$sub}( $req, $args, $tables, $auth );#Just do the right thing
                $tables->commit();
        };
        if( $@ ) {