Gantry-Plugins-CookieCheck

 view release on metacpan or  search on metacpan

lib/Gantry/Plugins/CookieCheck.pm  view on Meta::CPAN

        if ( $qstring ) {
            # Change the first & to a ? and add query string to goto.
            $qstring =~ s/^&/?/o;
            $goto .= $qstring;
        }

        # Encrypt goto
        $goto = $gobj->url_encode( $crypt->encrypt( $goto ) );

        # Redirect the user.
        $gobj->relocate( $loc . "/cookiecheck?url=${goto}" );
    }
}

#-----------------------------------------------------------
# do_cookiecheck()
#-----------------------------------------------------------
sub do_cookiecheck {
    my $gobj    =   shift;
    my $params  =   $gobj->params();
    my $secret  =   $gobj->fish_config( 'cc_secret' )
                    || $gobj->gantry_secret();
    my $crypt   =   Gantry::Utils::Crypt->new( { 'secret' => $secret } );

    # Decrypt url parameter.
    $params->{url} = $crypt->decrypt( $params->{url} );

    # If acceptcookies is set then send the user to the original
    # url they requested.
    if( $gobj->get_cookies( 'acceptcookies' ) ) {
        $gobj->relocate( $gobj->location() . $params->{url} );
    }
    else {
        # Cookies aren't enabled. Display an error page.
        my $cc_title        =   $gobj->fish_config( 'cc_title' ) || 'Missing Cookies';
        my $cc_wrapper      =   $gobj->fish_config( 'cc_wrapper' ) ||
                                $gobj->fish_config( 'template_wrapper' ) || 'default.tt';
        my $cc_template     =   $gobj->fish_config( 'cc_template' ) || 'cc.tt';

        $gobj->template_wrapper( $cc_wrapper );
        $gobj->stash->view->title( $cc_title );



( run in 0.930 second using v1.01-cache-2.11-cpan-5511b514fd6 )