Apache-PageKit
view release on metacpan or search on metacpan
- Removed support for $model->content_param, since content
is now compiled into template and it is not possible
to get or set the tags run time.
- Automically converts UTF-8 Encoding to latin1 encodeing,
if Unicode::String is loaded (Yann Kerhervé)
- fixed bug with pre-parsing content from sub-directories
- input_param now works with parameters containing multiple values
- Add $model->pkit_set_errorfont($field), used mark <PKIT_ERRORFONT>
tags for errors.
- Added pkit_root method, gets PageKit root directory
- no longer escape pkit_done
- works with mod_proxy_add_uri.c apache module, using X-Original-URI
header
- Removed PKIT_LOGINOUT_LINK, this tag was
not necessary and cluttered the API,
see migration/README for details
- removed search_engine_headers config option
- server_id is now passed to startup, solves
problem with server options not being
loaded properly at startup.
- Added pkit_get_session_id
Makefile.PL view on Meta::CPAN
$model->output( read_only => 1 ) if ( ! -w $file );
- open FILE, "$file" or die $!;
- binmode FILE;
- local $/ = undef;
+ my $default_input_charset = $model->{pkit_pk}->{view}->{default_input_charset};
+ open my $fh, $file or die $!;
+ binmode $fh, ":encoding($default_input_charset)";
+ local $/;
# we need to escape HTML tags to avoid </textarea>
# my $content = Apache::Util::escape_html(<PAGE> || "");
- my $content = <FILE>;
- close FILE;
+ my $content = <$fh>;
+ close $fh;
# we need to escape all & chars so that for example is
# and not ' '
@@ -76,10 +77,11 @@
my $pkit_done = $model->input('pkit_done');
my $content = $model->input('content');
- open FILE, ">$file" or die $!;
- binmode FILE;
- print FILE $content;
- close FILE;
+ my $default_input_charset = $model->{pkit_pk}->{view}->{default_input_charset};
docsrc/reference.xml view on Meta::CPAN
<refsynopsisdiv>
<synopsis>
<MODEL_VAR NAME="foo">
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
This tag is very simple. It is replaced by the corresponding value set
in the Model by the output method. You may also use ESCAPE="HTML" and ESCAPE="URL"
to escape HTML, and URLs respectively.
</para>
</refsect1>
</refentry>
<refentry id="model.loop">
<refnamediv>
<refname>MODEL_LOOP</refname>
<refpurpose>Filled in with array reference of hash references set from Model's output method.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
lib/Apache/PageKit.pm view on Meta::CPAN
for (qw(login logout view check_cookie messages error_messages lang)){
delete $args{"pkit_$_"};
}
$args = \%args;
$apr->pnotes(r_args => $args);
}
if($exclude_param && @$exclude_param){
my %exclude_param_hash = map {$_ => 1} @$exclude_param;
return join ('&', map { Apache::Util::escape_uri("$_") ."=" . Apache::Util::escape_uri(defined($args->{$_}) ? $args->{$_} : "")}
grep {!exists $exclude_param_hash{$_}} keys %$args);
} else {
return join ('&', map { Apache::Util::escape_uri("$_") ."=" . Apache::Util::escape_uri(defined($args->{$_}) ? $args->{$_} : "")} keys %$args);
}
}
sub update_session {
my ($pk, $auth_session_id) = @_;
# keep recent sessions recent, if user is logged in
# that is sessions time out if user hasn't viewed in a page
# in recent_login_timeout seconds
my $session = $pk->{session};
return unless defined($session);
lib/Apache/PageKit.pm view on Meta::CPAN
if($query_string){
$uri_with_query .= "?" . $query_string;
# $pkit_selfurl = $uri_with_query . '&';
# } else {
# $pkit_selfurl = $uri_with_query . '?';
}
# $view->param(pkit_selfurl => $pkit_selfurl);
$output_param_object->param(pkit_hostname => $host);
# my $pkit_done = Apache::Util::escape_uri($apr->param('pkit_done') || $uri_with_query);
my $pkit_done = $apr->param('pkit_done') || $uri_with_query;
# $pkit_done =~ s/"/\%22/g;
# $pkit_done =~ s/&/\%26/g;
# $pkit_done =~ s/\?/\%3F/g;
$output_param_object->param("pkit_done",$pkit_done);
# $fillinform_object->param("pkit_done",$pkit_done);
$pk->{page_id} = $uri;
lib/Apache/PageKit.pm view on Meta::CPAN
if($done =~ /\?/){
$done .= "&pkit_check_cookie=on";
} else {
$done .= "?pkit_check_cookie=on";
}
$done =~ s/ /+/g;
if(my @pkit_messages = $apr->param('pkit_messages')){
for my $message (@pkit_messages){
$done .= "&pkit_messages=" . Apache::Util::escape_uri($message);
}
}
if(my @pkit_error_messages = $apr->param('pkit_error_messages')){
for my $message (@pkit_error_messages){
$done .= "&pkit_error_messages=" . Apache::Util::escape_uri($message);
}
}
$apr->headers_out->set(Location => "$done");
return 1;
}
sub authenticate {
my ($pk) = @_;
my $apr = $pk->{apr};
lib/Apache/PageKit/Edit.pm view on Meta::CPAN
$model->output(file => $file);
$file = _build_path( $model->pkit_root, $file ) || die "Illegal input chars ($file)" ;
$model->output( read_only => 1 ) if ( ! -w $file );
open FILE, "$file" or die $!;
binmode FILE;
local $/ = undef;
# we need to escape HTML tags to avoid </textarea>
# my $content = Apache::Util::escape_html(<PAGE> || "");
my $content = <FILE>;
close FILE;
# we need to escape all & chars so that for example is
# and not ' '
#<textarea> holds #PCDATA
HTML::Entities::encode_entities( $content, '<>&"' );
$model->output(content => $content);
}
sub commit_file {
my $model = shift;
lib/Apache/PageKit/Edit.pm view on Meta::CPAN
}
sub add_edit_links {
my ($view, $record, $output_ref) = @_;
my $pkit_root = $view->{root_dir};
my $output_param_object = $view->{output_param_object};
if($output_param_object->param('pkit_admin')){
my $pkit_done = Apache::Util::escape_uri($output_param_object->param('pkit_done'));
my $include_mtimes = $record->{include_mtimes};
my $abs_uri_prefix = $view->{uri_prefix} ? '/' . $view->{uri_prefix} : '';
# add edit link for main template file
my $filename = $record->{filename};
die "Filename ($filename) points outside PKIT_ROOT ($pkit_root)" if ( $filename and $filename !~ s!^$pkit_root/!! );
lib/Apache/PageKit/Model.pm view on Meta::CPAN
sub pkit_redirect {
my ($model, $url) = @_;
my $pk = $model->{pkit_pk};
my $apr = $pk->{apr};
# we may have created a new session. Add a cookie header if needed
$pk->set_session_cookie;
if(my $pkit_messages = $model->output('pkit_messages')){
my $add_url = join("", map { "&pkit_" . ($_->{pkit_is_error} ? "error_" : "") . "messages=" . Apache::Util::escape_uri($_->{pkit_message}) } @$pkit_messages);
$add_url =~ s!^&!?! unless $url =~ m/\?/;
$url .= $add_url;
}
$apr->headers_out->set(Location => $url);
$pk->{status_code} = REDIRECT;
}
sub pkit_merge_sessions {
my ($model, $old_session, $new_session) = @_;
while(my ($k, $v) = each %$old_session){
( run in 0.484 second using v1.01-cache-2.11-cpan-c21f80fb71c )