Apache2-PageKit

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - Fixed default for default_page (Boris Zentner)
        - Append the default_page to the url if url is a directory (Rob Starkey)
        ! New global option logout_kills_session. Defaults to 'yes'.
        	The behavior before this option was no (Rob Falcon)
        - Fixed head requests for gzipped static files (Boris Zentner)
        - Improved security for recent='yes' pages (Boris Zentner)
        - PKIT_COMPONENT macros are also available
        	for XSLT with <xsl:param name="..."> (Ben Ausden)
        ! The return code from pagecode is completely ignored. If you have to set a
		return code use pkit_status_code (Boris Zentner)
	- Fixed form_validation_done in the eg/site's MyModel code. (Michael Cook)
        - Fixed restricted page login if the user was not logged
        	in before (Boris Zentner)
        ! Anonymous sessions are created lazy as in pkit <= 1.05 (Boris Zentner)

1.06
	- empty parameters are stripped from the requested url
		ie: http://www.xyz.de/test?=& (Boris Zentner)
	- Fixed output_convert to handle calls like
		$model->output_convert(anything => $text) (Boris Zentner)
	- Fixed handling of __PACKAGE__ in Common.pm (Boris Zentner)

Makefile.PL  view on Meta::CPAN

use lib qw;t;;
use Apache::Test 1.05;
use Apache::TestMM qw/test clean/;

Apache::TestMM::filter_args();
Apache::TestMM::generate_script('t/TEST');

my $prereq_pm = {
                   'Apache::Test'          => 1.05,
                   'Apache2::URI'           => 0,
#                   'Apache2::Cookie'        => 0,
#                   'Apache2::Request'       => 0,
                   'Apache::SessionX'      => 0,
                   'Apache2::Util'          => 0,
                   'Compress::Zlib'        => 0,
                   'Data::FormValidator'   => 0,
                   'HTML::Clean'           => 0,
                   'HTML::FillInForm'      => 0.12,
                   'HTML::Template'        => 2.2,
                   'HTML::Template::XPath' => 0.10,
                   'Encode'                => 0,

eg/contrib/locale/README  view on Meta::CPAN

#
# Apache2::PageKit
#

msgid "You have successfully logged in."
msgstr "Erfolgreich eingeloggt."

msgid "You have successfully logged out."
msgstr "Erfolgreich ausgeloggt."

msgid "Cookies must be enabled in your browser."
msgstr "Im Browser müssen Cookies eingeschaltet sein."

msgid "This page requires a login."
msgstr "Für diese Seite ist ein Login erforderlich."

msgid "Please try again."
msgstr "Bitte nocheinmal versuchen."

msgid "You did not fill out all the required fields. Please fill the <font
color=\"<PKIT_ERRORSTR>\">red</font> fields."
msgstr "Es wurden nicht alle erforderlichen Felder ausgefüllt. Bitte alle

eg/contrib/locale/templates/empty/empty.po  view on Meta::CPAN

#
# Apache2::PageKit
#

msgid "You have successfully logged in."
msgstr ""

msgid "You have successfully logged out."
msgstr ""

msgid "Cookies must be enabled in your browser."
msgstr ""

msgid "This page requires a login."
msgstr ""

msgid "Please try again."
msgstr ""

msgid "You did not fill out all the required fields. Please fill the <font color=\"<PKIT_ERRORSTR>\">red</font> fields."
msgstr ""

eg/contrib/locale/templates/po/de.po  view on Meta::CPAN

#
# Apache2::PageKit
#

msgid "You have successfully logged in."
msgstr "Erfolgreich eingeloggt."

msgid "You have successfully logged out."
msgstr "Erfolgreich ausgeloggt."

msgid "Cookies must be enabled in your browser."
msgstr "Im Browser müssen Cookies eingeschaltet sein."

msgid "This page requires a login."
msgstr "Für diese Seite ist ein Login erforderlich."

msgid "Please try again."
msgstr "Bitte nocheinmal versuchen."

msgid "You did not fill out all the required fields. Please fill the <font color=\"<PKIT_ERRORSTR>\">red</font> fields."
msgstr "Es wurden nicht alle erforderlichen Felder ausgefüllt. Bitte alle <font color=\"<PKIT_ERRORSTR>\">roten</font> Felder ausfüllen."

eg/contrib/locale/templates/po/fr.po  view on Meta::CPAN

#
# Apache2::PageKit
#

msgid "You have successfully logged in."
msgstr "Vous êtes connecté"

msgid "You have successfully logged out."
msgstr "Vous êtes déconnecté"

msgid "Cookies must be enabled in your browser."
msgstr "Votre browser doit accepter les cookies"

msgid "This page requires a login."
msgstr "Vous devez être connecté pour accèder à cette page"

msgid "Please try again."
msgstr "Essayer encore, s'il vous plait"

msgid "You did not fill out all the required fields. Please fill the <font color=\"<PKIT_ERRORSTR>\">red</font> fields."
msgstr "Vous n'avez pas rempli tous les champs obligatoires. S'il vous plaît veuillez remplir tous les champs en <font color=\"<PKIT_ERRORSTR>\">rouge</font>"

eg/contrib/locale/templates/po/pt.po  view on Meta::CPAN

#
# Apache2::PageKit
#

msgid "You have successfully logged in."
msgstr "Você conectou-se com sucesso"

msgid "You have successfully logged out."
msgstr "Você desconectou-se com sucesso"

msgid "Cookies must be enabled in your browser."
msgstr "Seu browser deve estar com a opção de cookies habilitada."

msgid "This page requires a login."
msgstr "Está página requer que você se conecte com uma senha válida"

msgid "Please try again."
msgstr "Por favor tente novamente"

msgid "You did not fill out all the required fields. Please fill the <font color=\"<PKIT_ERRORSTR>\">red</font> fields."
msgstr "Você não preencheu todos os campos. Favor preencher os campos em <font color =\"<PKIT_ERRORSTR>\">vermelho</font>"

lib/Apache2/PageKit.pm  view on Meta::CPAN

# $Id: PageKit.pm,v 1.236 2004/05/06 09:54:35 borisz Exp $

# require perl 5.8 for numerous utf8 issues ( and Encode )
require 5.008;

use strict;

# CPAN Modules required for pagekit
use mod_perl2 1.9921;
use Apache2::URI ();
use Apache2::Cookie ();
use Apache2::Request ();
use Apache::SessionX ();
use Apache2::Util ();
use Compress::Zlib ();
use File::Find ();
use HTML::FillInForm ();
use HTML::Parser ();
use HTML::Entities ();
use HTML::Template ();
use Encode ();

lib/Apache2/PageKit.pm  view on Meta::CPAN

    if(defined($pkit_check_cookie) && $pkit_check_cookie eq 'on'){
      # cookies should be set but aren't.
      if($config->get_global_attr('cookies_not_set_page')){
	# display "cookies are not set" error page.
	$pk->{page_id} = $config->get_global_attr('cookies_not_set_page');
	$pk->{browser_cache} = 'no';

      } else {
	# display login page with error message
	$pk->{page_id} = $config->get_global_attr('login_page');
	$model->pkit_gettext_message('Cookies must be enabled in your browser.', is_error => 1);
      }
    }

    my $require_login = $config->get_page_attr($pk->{page_id},'require_login');
    if(defined($require_login) && $require_login =~ /^(yes|recent)$/){
      # this page requires that the user has a valid cookie
      $pk->{page_id} = $config->get_global_attr('login_page');
      # do NOT cache this page other wise we end up on the loginpage instead of the page we want
      $pk->{browser_cache} = 'no';
      $output_param_object->param("pkit_done",$uri_with_query) unless $apr->param("pkit_done");

lib/Apache2/PageKit.pm  view on Meta::CPAN


    # save session
    untie %auth_session;
  }

  my $pkit_id = 'pkit_id' . ( $config->get_server_attr('cookie_postfix') || '' );

  my $cookie_domain_str = $config->get_server_attr('cookie_domain');
  my @cookie_domains = defined($cookie_domain_str) ? split(' ',$cookie_domain_str) : (undef);
  for my $cookie_domain (@cookie_domains){
    my $cookie = Apache2::Cookie->new($apr->env,
				   -name => $pkit_id,
				   -value => $ses_key,
				   -path => "/");
    $cookie->domain($cookie_domain) if $cookie_domain;
    if ($remember){
      $cookie->expires("+10y");
    }
    $apr->err_headers_out->add( 'Set-Cookie' => $cookie->as_string );
  }

  # remove appending ? or & and any combination of them
  $done =~ s/[\?&]+$//;

  # this is used to check if cookie is set
  if($done =~ /\?/){
    $done .= "&pkit_check_cookie=on";
  } else {
    $done .= "?pkit_check_cookie=on";

lib/Apache2/PageKit.pm  view on Meta::CPAN


  $apr->headers_out->set(Location => "$done");
  return 1;
}

sub authenticate {
  my ($pk) = @_;
  my $apr = $pk->{apr};

  my $model = $pk->{model};
  my %cookies = Apache2::Cookie->fetch($apr->env);
  my $cookie_pkit_id = 'pkit_id' . ( $pk->{config}->get_server_attr('cookie_postfix') || '' );

  return unless $cookies{$cookie_pkit_id};

  my %ticket = $cookies{$cookie_pkit_id}->value;

  # in case pkit_auth_session_key is not defined, but cookie
  # is somehow already set
  return unless $model->can('pkit_auth_session_key');

lib/Apache2/PageKit.pm  view on Meta::CPAN

#  $pk->{output_param_object}->param(pkit_user => $auth_user);

  return ($auth_user, $auth_session_id);
}

sub logout {
  my ($pk) = @_;
  my $apr = $pk->{apr};

  my $config = $pk->{config};
  my %cookies = Apache2::Cookie->fetch($apr->env);

  my $cookie_postfix = $config->get_server_attr('cookie_postfix') || '';
  my $pkit_id = 'pkit_id' . $cookie_postfix;
  my $pkit_session_id = 'pkit_session_id' . $cookie_postfix;

  my $logout_kills_session = $config->get_global_attr('logout_kills_session') || 'yes';
  my @cookies_to_kill = ( $cookies{$pkit_id} );
  push @cookies_to_kill, $cookies{$pkit_session_id} if $logout_kills_session eq 'yes';

  my $cookie_domain = $config->get_server_attr('cookie_domain');
  my @cookie_domains = defined($cookie_domain) ? split(' ',$cookie_domain) : (undef);

  for my $tcookie (@cookies_to_kill){
    next unless $tcookie;
    for my $cookie_domain (@cookie_domains){
      $tcookie->value("");
      $tcookie->path("/");
      $tcookie->domain($cookie_domain) if $cookie_domain;
      $tcookie->expires('-5y');
      $apr->err_headers_out->add( 'Set-Cookie' => $tcookie->as_string );
    }
  }
}

# get session_id from cookie
sub setup_session {
  my ($pk, $auth_session_id) = @_;

  my $model = $pk->{model};

lib/Apache2/PageKit.pm  view on Meta::CPAN


  unless($ss->{session_store_class} && $ss->{session_lock_class}){
    warn "failed to set up session - session_store_class and session_lock_class must be defined";
    $pk->{session} = {};
    return;
  }

  my $apr = $pk->{apr};
  my $config = $pk->{config};

  my %cookies = Apache2::Cookie->fetch($apr->env);

  my $pkit_session_id = 'pkit_session_id' . ( $config->get_server_attr('cookie_postfix') || '' );

  my $session_id;

  if(defined $cookies{$pkit_session_id}){
    my $scookie = $cookies{$pkit_session_id};
    $session_id = $scookie->value;
  }

lib/Apache2/PageKit.pm  view on Meta::CPAN

    # permanently remove old session from storage
    tied(%session)->delete;
    untie(%session);

    undef(%session);

    # unset cookie for old session
    my $cookie_domain_str = $pk->{config}->get_server_attr('cookie_domain');
    my @cookie_domains = defined($cookie_domain_str) ? split(' ',$cookie_domain_str) : (undef);
    for my $cookie_domain (@cookie_domains){
      my $cookie = Apache2::Cookie->new($apr->env,
					 -name => $pkit_session_id,
					 -value => "",
					 -path => "/");
      $cookie->domain($cookie_domain) if $cookie_domain;
      $cookie->expires('-5y');
      $apr->err_headers_out->add( 'Set-Cookie' => $cookie->as_string );
    }
    $pk->{session} = \%auth_session;
  } else {
    $pk->{session} = \%session;
  }
}

sub set_session_cookie {
  my ($pk) = @_;

lib/Apache2/PageKit.pm  view on Meta::CPAN

  my $session = $pk->{session};
  my $apr = $pk->{apr};

  if(my $session_id = tied(%$session)->getid){
    # something was stored in session
    my $pkit_session_id = 'pkit_session_id' . ( $pk->{config}->get_server_attr('cookie_postfix') || '' );
    my $expires = $pk->{config}->get_global_attr('session_expires');
    my $cookie_domain_str = $pk->{config}->get_server_attr('cookie_domain');
    my @cookie_domains = defined($cookie_domain_str) ? split(' ',$cookie_domain_str) : (undef);
    for my $cookie_domain (@cookie_domains){
      my $cookie = Apache2::Cookie->new($apr->env,
				       -name => $pkit_session_id,
				       -value => $session_id,
				       -path => "/");
      $cookie->domain($cookie_domain) if $cookie_domain;
      $cookie->expires($expires) if $expires;
      $apr->err_headers_out->add('Set-Cookie' => $cookie->as_string );
    }
    # save for logging purposes (warning, undocumented and might go away)
    $apr->notes->set(pkit_session_id => $session_id);
  }
}

# check to see if page has either template or perl code associated with it
sub page_exists{
  my ($pk, $page_id) = @_;

lib/Apache2/PageKit.pm  view on Meta::CPAN

  Anton Permyakov
  Glenn Morgan
  Gabriel Burca
  John Robinson
  Paul G. Weiss
  Russell D. Weiss
  Paul Flinders
  Bill Karwin
  Daniel Gardner
  Andy Massey
  Michael Cook
  Michael Pheasant
  John Moose
  Sheldon Hearn
  Vladimir Sekissov
  Tomasz Konefal
  Michael Wojcikiewicz
  Vladimir Bogdanov
  Eugene Rachinsky
  Erik Günther
  Bruno Czekay

t/04_anon_cookies.t  view on Meta::CPAN

use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw/GET/;
# skip tests if we use a old version of LWP.
plan tests => 5, sub {  have_lwp() && $LWP::VERSION >= 5.76 };
require HTTP::Cookies;

sub HTTP_OK () { 200 }

# simple load test
ok 1;

# check if we can request a page
my $url = '/customize?link_color=%23ff9933&text_color=%23ffffff&bgcolor=%23000000&mod_color=%23444444';

# customize colors, to get a session ( and a cookie )
my $r = GET $url;
ok $r->code == HTTP_OK();
my $cookie_jar = HTTP::Cookies->new;
$cookie_jar->extract_cookies($r);

my $cookie_cnt = 0;
$cookie_jar->scan(
  sub {
    $cookie_cnt++;
    next unless ( $_[1] eq 'pkit_session_id' );
    ok length( $_[2] ) == 32;

    # ~ 1 year +- 1 month.

t/05_account.t  view on Meta::CPAN

use strict;

#use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw'GET POST';

# skip tests if we use a old version of LWP.
plan tests => 6, sub { have_lwp() && $LWP::VERSION >= 5.76 };
require HTTP::Cookies;
require HTML::Form;
my $cookie_jar = HTTP::Cookies->new;
Apache::TestRequest::user_agent(
                                 reset                 => 1,
                                 cookie_jar            => $cookie_jar,
                                 requests_redirectable => [qw/GET HEAD POST/]
);

# check if we can request a page
my $r = GET '/newacct1';
ok t_cmp( $r->code, 200, '$r->code == HTTP_OK?' );
ok t_cmp( $r->content,

t/06_login.t  view on Meta::CPAN

use strict;
use warnings;
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw'GET POST';

# skip tests if we use a old version of LWP.
plan tests => 9, sub {  have_lwp() && $LWP::VERSION >= 5.76 };

require HTTP::Cookies;

my $cookie_jar = HTTP::Cookies->new;

Apache::TestRequest::user_agent(
                                 reset                 => 1,
                                 cookie_jar            => $cookie_jar,
                                 requests_redirectable => [qw/GET HEAD POST/]
);

 my  $r = POST '/login2',
    [
      login     => '_illegal_login_',

t/08_fresh_cookie_redirect.t  view on Meta::CPAN

use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw/GET/;

# skip tests if we use a old version of LWP.
plan tests => 4, sub {  have_lwp() && $LWP::VERSION >= 5.76 };

require HTTP::Cookies;

sub HTTP_OK () { 200 }

# simple load test
ok 1;

my $cookie_jar = HTTP::Cookies->new;
Apache::TestRequest::user_agent( cookie_jar => $cookie_jar );
my $url = '/create_and_redirect';
my $r = GET $url;
ok $r->code == HTTP_OK();
my $cookie_cnt = 0;
$cookie_jar->scan(
  sub {
    $cookie_cnt++;
    next unless ( $_[1] eq 'pkit_session_id' );
    ok length( $_[2] ) == 32;

t/conf/extra.last.conf.in  view on Meta::CPAN

# PerlInitHandler Apache::Reload
# PerlSetVar ReloadAll On

<Perl>
 use mod_perl2;

# It is not necasary to preload this modules, but it helps
# to find errors in your instalation.

use Apache2::URI ();
use Apache2::Cookie ();
use Apache2::Request ();
use Apache::SessionX ();
use Apache2::Util ();
use Compress::Zlib ();
use File::Find ();
use HTML::FillInForm ();
use HTML::Parser ();
use HTML::Template ();
use XML::LibXML ();



( run in 0.516 second using v1.01-cache-2.11-cpan-e9199f4ba4c )