fix template configuration

This commit is contained in:
Milan
2018-09-06 23:06:48 +02:00
parent 2481490e7d
commit e043493847
30 changed files with 4482 additions and 4487 deletions

View File

@@ -204,7 +204,7 @@ sub update {
set $set
where $conditions
};
print STDERR Dumper($query) . Dumper($bind_values);
#print STDERR Dumper($query) . Dumper($bind_values);
my $result = db::put( $dbh, $query, $bind_values );
images::setSeriesLabels( $dbh, $image );
@@ -491,10 +491,10 @@ sub setEventLabels {
where image=?
};
my $bind_values = [ $image->{licence}, $image->{filename} ];
print STDERR Dumper($query) . Dumper($bind_values);
#print STDERR Dumper($query) . Dumper($bind_values);
my $results = db::put( $dbh, $query, $bind_values );
print STDERR Dumper($results) . " changes\n";
#print STDERR Dumper($results) . " changes\n";
return $results;
}
@@ -521,10 +521,10 @@ sub setSeriesLabels {
where series_image=?
};
my $bind_values = [ $image->{licence}, $image->{filename} ];
print STDERR Dumper($query) . Dumper($bind_values);
#print STDERR Dumper($query) . Dumper($bind_values);
my $results = db::put( $dbh, $query, $bind_values );
print STDERR Dumper($results) . " changes\n";
#print STDERR Dumper($results) . " changes\n";
return $results;
}

View File

@@ -307,7 +307,7 @@ sub plain_to_xml {
}
sub fix_utf8 {
$_[0] = decode( 'cp1252', $_[0] );
$_[0] = Encode::decode( 'cp1252', $_[0] );
return $_[0];
}

View File

@@ -53,7 +53,7 @@ sub get {
my $query = '';
unless ( ( defined $condition->{project_id} ) && ( $condition->{project_id} ne '' ) ) {
my $conditions = '';
$conditions = " where " . join( " and ", @conditions ) if ( @conditions > 0 );
$conditions = " where " . join( " and ", @conditions ) if ( scalar @conditions > 0 );
$query = qq{
select *
from calcms_studios s
@@ -62,11 +62,10 @@ sub get {
};
} else {
push @conditions, 's.id=ps.studio_id';
push @conditions, 'ps.project_id=?';
push @bind_values, $condition->{project_id};
my $conditions = '';
$condition .= " where " . join( " and ", @conditions ) if ( scalar @conditions > 0 );
my $conditions = " where " . join( " and ", @conditions );
$query = qq{
select *
from calcms_studios s, calcms_project_studios ps

View File

@@ -77,7 +77,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params($config, $params),
},
};
@@ -540,6 +540,7 @@ sub getEventDuration {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};

View File

@@ -4,7 +4,7 @@ use warnings "all";
use strict;
use Data::Dumper;
use URI::Escape();
use Encode();
#use Encode();
use utf8();
use params();
use config();
@@ -52,8 +52,6 @@ $params->{project_id} = $user_presets->{project_id}
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
$params->{expires} = $expires;
#print STDERR Dumper($params);
my $scriptName = 'calendar.cgi';
#add "all" studio to select box
@@ -75,7 +73,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params( $params, $config ),
checked => check_params( $config, $params ),
},
};
@@ -83,7 +81,6 @@ $request = uac::prepare_request( $request, $user_presets );
$params = $request->{params}->{checked};
#print STDERR Dumper($request);
if (
(
( defined $params->{action} ) && ( ( $params->{action} eq 'show' )
@@ -1802,8 +1799,8 @@ sub getSeriesEvents {
}
sub check_params {
my $params = shift;
my $config = shift;
my $params = shift;
my $checked = {};
my $template = '';

View File

@@ -32,7 +32,7 @@ my $r = shift;
my $config = config::get('../config/config.cgi');
my $debug = $config->{system}->{debug};
my ( $user, $expires ) = auth::get_user( $cgi, $config );
return if ( !defined $user ) || ( $user eq '' ) ;
return if ( !defined $user ) || ( $user eq '' );
my $user_presets = uac::get_user_presets(
$config,
@@ -52,7 +52,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
@@ -68,7 +68,7 @@ if ( ( params::isJson() ) || ( defined $params->{action} ) ) {
} else {
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
print q{
<script src="js/datetime.js" type="text/javascript"></script>
} unless (params::isJson);
@@ -139,7 +139,7 @@ sub showComments {
$events = comments::get_events( $dbh, $config, $request, $comments );
my $language = $config->{date}->{language} || 'en';
for my $event (@$events) {
$event->{start} = time::date_time_format($config, $event->{start}, $language );
$event->{start} = time::date_time_format( $config, $event->{start}, $language );
$comment_count += $event->{comment_count} if ( defined $event->{comment_count} );
$event->{cache_base_url} = $config->{cache}->{base_url};
}
@@ -160,7 +160,7 @@ sub showComments {
$template_parameters->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'comment' } );
#fill and output template
template::process($config, 'print', $params->{template}, $template_parameters );
template::process( $config, 'print', $params->{template}, $template_parameters );
}
sub modify_comments {
@@ -170,7 +170,7 @@ sub modify_comments {
my $language = $config->{date}->{language} || 'en';
for my $result (@$results) {
$result->{start_date_name} = time::date_format($config, $result->{created_at}, $language );
$result->{start_date_name} = time::date_format( $config, $result->{created_at}, $language );
$result->{start_time_name} = time::time_format( $result->{created_at} );
$result->{ $result->{lock_status} } = 1;
$result->{ $result->{news_status} } = 1;
@@ -238,6 +238,7 @@ sub setRead {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
@@ -253,9 +254,9 @@ sub check_params {
#template
my $template = '';
if ( defined $checked->{action} ) {
$template = template::check($config, $params->{template}, 'edit_comment' ) if $checked->{action} eq 'showComment';
$template = template::check( $config, $params->{template}, 'edit_comment' ) if $checked->{action} eq 'showComment';
} else {
$template = template::check($config, $params->{template}, 'comments' );
$template = template::check( $config, $params->{template}, 'comments' );
}
$checked->{template} = $template;

View File

@@ -48,7 +48,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -58,7 +58,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
print q{
@@ -90,7 +90,7 @@ sub show_events {
uac::permissions_denied('assign_series_events');
return;
}
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
@@ -147,7 +147,7 @@ sub create_events {
}
$params->{created_events} = $events;
$params->{created_total} = scalar(@$events);
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
sub createEvent {
@@ -177,6 +177,7 @@ sub createEvent {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
@@ -210,7 +211,7 @@ sub check_params {
$checked->{studio_id} = -1;
}
$checked->{template} = template::check($config, $params->{template}, 'create_events' );
$checked->{template} = template::check( $config, $params->{template}, 'create_events' );
return $checked;
}

View File

@@ -60,7 +60,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
@@ -75,7 +75,7 @@ $params = $request->{params}->{checked};
unless ( params::isJson() ) {
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
}
return unless defined uac::check( $config, $params, $user_presets );
@@ -311,7 +311,7 @@ sub show_event {
#print STDERR Dumper($params);
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'event' } );
template::process($config, 'print', template::check($config, 'edit_event'), $params );
template::process( $config, 'print', template::check( $config, 'edit_event' ), $params );
}
sub getJson {
@@ -394,7 +394,7 @@ sub getJson {
}
#print to_json($event);
template::process($config, 'print', 'json-p', $event );
template::process( $config, 'print', 'json-p', $event );
}
#show new event from schedule
@@ -455,7 +455,7 @@ sub show_new_event {
}
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'event,comment' } );
template::process( $config, 'print', template::check($config, 'edit_event'), $params );
template::process( $config, 'print', template::check( $config, 'edit_event' ), $params );
#print '<pre>'.Dumper($params).'</pre>';
}
@@ -769,11 +769,12 @@ sub download {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
my $template = '';
$checked->{template} = template::check($config, $params->{template}, 'series' );
$checked->{template} = template::check( $config, $params->{template}, 'series' );
my $debug = $params->{debug} || '';
if ( $debug =~ /([a-z\_\,]+)/ ) {

View File

@@ -4,7 +4,6 @@ use warnings "all";
use strict;
use URI::Escape();
use Encode();
use Data::Dumper;
use MIME::Base64();
use Text::Diff::FormattedHTML();
@@ -43,7 +42,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
@@ -57,7 +56,7 @@ $params = $request->{params}->{checked};
#show header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process( $config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
print q{
@@ -113,7 +112,7 @@ sub show_history {
#print STDERR Dumper($params);
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'event_history' } );
template::process($config, 'print', template::check($config, 'event_history'), $params );
template::process( $config, 'print', template::check( $config, 'event_history' ), $params );
}
#show existing event history
@@ -196,11 +195,12 @@ sub eventToText {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
my $template = '';
$checked->{template} = template::check($config, $params->{template}, 'event_history' );
$checked->{template} = template::check( $config, $params->{template}, 'event_history' );
my $debug = $params->{debug} || '';
if ( $debug =~ /([a-z\_\,]+)/ ) {

View File

@@ -5,7 +5,6 @@ use strict;
use Data::Dumper;
use URI::Escape();
use Encode();
use params();
use config();
@@ -46,7 +45,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -56,7 +55,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
my $toc = $headerParams->{loc}->{toc};
@@ -617,6 +616,7 @@ There are following status fields:
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};

View File

@@ -56,7 +56,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
}
};
$request = uac::prepare_request( $request, $user_presets );
@@ -65,7 +65,7 @@ $params = $request->{params}->{checked};
#show header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'ajax_header.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'ajax_header.html' ), $headerParams );
return unless defined uac::check( $config, $params, $user_presets );
my $local_media_dir = $config->{locations}->{local_media_dir};
@@ -231,7 +231,7 @@ sub show_image {
$template_params->{allow}->{update_image_own} || $template_params->{allow}->{seriesupdate_image_others};
$template_params->{allow}->{delete_image} =
$template_params->{allow}->{delete_image_own} || $template_params->{allow}->{delete_image_others};
template::process($config, 'print', $params->{template}, $template_params );
template::process( $config, 'print', $params->{template}, $template_params );
}
sub print_js_error {
@@ -406,9 +406,10 @@ sub modify_results {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = { template => template::check($config, $params->{template}, 'image.html' ) };
my $checked = { template => template::check( $config, $params->{template}, 'image.html' ) };
#numeric values
$checked->{limit} = 100;

View File

@@ -13,7 +13,7 @@ require 'CGI.pm';
use Date::Calc();
use Time::Local();
use Image::Magick();
use Image::Magick::Square();
use Image::Magick::Square;
use config();
use auth();
@@ -44,25 +44,17 @@ my $error = '';
if ( defined $r ) {
#Apache2::Request
# print "Content-type:text/html; charset=UTF-8; \n\n<br><br><br>Apache2::Request<br>\n";
my $apr = Apache2::Request->new( $r, POST_MAX => $upload_limit, TEMP_DIR => $tmp_dir );
#copy params to hash
my $body = $apr->body();
if ( defined $body ) {
for my $key ( keys %$body ) {
# print "$key=".$apr->param($key)."<br>\n";
$params->{ scalar($key) } = scalar( $apr->param($key) ); # unless ($key eq'image');
$params->{ scalar($key) } = scalar( $apr->param($key) );
}
}
# print Dumper($params);
# print Dumper($apr);
my $status = $apr->parse;
# print "Status:$status<br>";
$status = '' if ( $status =~ /missing input data/i );
if ( $status =~ /limit/i ) {
$error = $status;
@@ -70,18 +62,10 @@ if ( defined $r ) {
$upload = $apr->upload('image') if ( defined $params->{image} );
}
#dont get params parsed
# $CGI::POST_MAX = $upload_limit;
# $CGI::TMPDIRECTORY=$tmp_dir;
$cgi = new CGI();
# my %params=$cgi->Vars();
# $params=\%params;
# $error=$cgi->cgi_error()||$error;
} else {
#CGI fallback
# print "Content-type:text/html; charset=UTF-8; \n\n<br><br><br>CGI<br>\n";
$CGI::POST_MAX = $upload_limit;
$CGI::TMPDIRECTORY = $tmp_dir;
$cgi = new CGI();
@@ -103,15 +87,15 @@ my $user_presets = uac::get_user_presets(
);
$params->{default_studio_id} = $user_presets->{studio_id};
$params->{studio_id} = $params->{default_studio_id}
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
if ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' );
$params->{project_id} = $user_presets->{project_id}
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
if ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' );
my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
@@ -121,7 +105,7 @@ return unless defined uac::check( $config, $params, $user_presets );
my $permissions = $request->{permissions};
$params->{action} = '' unless ( defined $params->{action} );
$params->{action} = '' unless defined $params->{action};
if ( $permissions->{create_image} ne '1' ) {
uac::permissions_denied("create image");
@@ -138,17 +122,20 @@ if ( $error ne '' ) {
} elsif ( $params->{action} eq 'upload' ) {
$file_info = upload_file( $config, $cgi, $upload, $user );
$params->{error} .= $file_info->{error};
$params = update_database( $config, $params, $file_info, $user ) if ( $params->{error} eq '' );
$params = update_database( $config, $params, $file_info, $user ) if $params->{error} eq '';
}
print STDERR $params->{error} . "\n" if defined $params->{error};
print STDERR "upload error: $params->{error}\n" if $params->{error} ne '';
my $out = '';
template::process( $config, 'print', $params->{template}, $params );
print $cgi->cgi_error() if defined $cgi;
print $cgi->cgi_error() if (defined $cgi) && (defined $cgi->cgi_error());
return if $params->{action} eq '';
#return;
return if ( $params->{action} eq '' );
$params->{action_result} ||= '';
$params->{filename} ||= '';
$params->{image_id} ||= '';
$params->{name} ||= '';
if ( $params->{error} eq '' ) {
print qq{
@@ -169,7 +156,6 @@ if ( $params->{error} eq '' ) {
<div id="output">failed</div>
<div id="message">$params->{error}</div>
};
}
sub upload_file {
@@ -185,7 +171,7 @@ sub upload_file {
my $filename = $result->{filename};
$result = check_filename($filename);
print STDERR $result . "\n";
#print STDERR $result . "\n";
return $result if ( $result->{error} ne '' );
my $extension = $result->{extension} || '';
@@ -193,9 +179,8 @@ sub upload_file {
#read file from handle
my $data;
my $content = '';
print STDERR $file . "\n";
#print STDERR $file . "\n";
#unless (-e $file){}
binmode $file;
while ( read $file, $data, 1024 ) {
$content .= $data;
@@ -259,16 +244,14 @@ sub get_filename {
my $cgi = shift;
my $upload = shift;
if ( defined $upload ) {
# try apache2 module
if ( defined $upload ) {
my $filename = $upload->filename();
return {
filename => $filename,
fh => $upload->fh(),
error => ''
};
}
# fallback to CGI module
@@ -362,40 +345,32 @@ sub process_image {
$icon->Resize( width => 25, height => 25 );
$icon->Write( 'jpg:' . $icon_path );
unless ( -e $thumb_path ) {
return { error => 'could not create thumb file!' };
}
unless ( -e $icon_path ) {
return { error => 'could not create icon file!' };
}
unless ( -e $image_path ) {
return { error => 'could not create image file!' };
}
return { error => 'could not create thumb file!' } unless -e $thumb_path;
return { error => 'could not create icon file!' } unless -e $icon_path;
return { error => 'could not create image file!' } unless -e $image_path;
return {
upload_filename => $filename,
filename => $md5_filename . '.jpg',
thumb_path => $thumb_path,
icon_path => $icon_path,
image_path => $image_path,
error => ''
};
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
$checked->{template} = template::check($config, $params->{template}, 'imageUpload' );
$checked->{template} = template::check( $config, $params->{template}, 'imageUpload' );
#numeric values
for my $param ( 'project_id', 'studio_id', 'default_studio_id' ) {
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
$checked->{$param} = $params->{$param};
}
$checked->{$param} = $params->{$param} if ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ );
}
if ( defined $checked->{studio_id} ) {
$checked->{default_studio_id} = $checked->{studio_id};
} else {

View File

@@ -27,7 +27,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
}
};
$params = $request->{params}->{checked};
@@ -42,12 +42,10 @@ for my $line ( split /\n/, $json ) {
}
$json = $header . $json;
# .'var loc_text='.join('+',@json_lines).";\n"
# .'var loc = JQuery.parseJSON(loc_text)';
print $json;
sub check_params {
my $config = shift;
my $params = shift;
my $checked = { usecase => '' };

View File

@@ -3,7 +3,8 @@
use warnings "all";
use strict;
use URI::Escape();
use Encode();
#use Encode();
use Data::Dumper;
use MIME::Lite();
@@ -48,7 +49,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
@@ -63,7 +64,7 @@ $params = $request->{params}->{checked};
unless ( params::isJson() || ( $params->{template} =~ /\.txt/ ) ) {
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process( $config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
}
return unless uac::check( $config, $params, $user_presets ) == 1;
@@ -122,7 +123,7 @@ sub show_events {
}
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'notify_events' } );
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
@@ -237,11 +238,12 @@ sub eventToText {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
my $template = '';
$checked->{template} = template::check($config, $params->{template}, 'notify_events' );
$checked->{template} = template::check( $config, $params->{template}, 'notify_events' );
my $debug = $params->{debug} || '';
if ( $debug =~ /([a-z\_\,]+)/ ) {

View File

@@ -5,7 +5,8 @@ use strict;
use Data::Dumper;
use URI::Escape();
use Encode();
#use Encode();
use localization();
use params();
@@ -59,7 +60,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -115,6 +116,7 @@ sub deleteFromPlayout {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};

View File

@@ -43,7 +43,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -53,7 +53,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
print q{
@@ -262,17 +262,18 @@ sub show_projects {
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'projects' } );
uac::set_template_permissions( $permissions, $params );
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
#template
my $template = '';
$template = template::check($config, $params->{template}, 'projects' );
$template = template::check( $config, $params->{template}, 'projects' );
$checked->{template} = $template;
#actions

View File

@@ -19,7 +19,7 @@ my $r = shift;
my $config = config::get('../config/config.cgi');
my $debug = $config->{system}->{debug};
$params = check_params($params);
$params = check_params( $config, $params );
print "Content-type:text/html\n\n";
print qq{<!DOCTYPE html>
@@ -136,6 +136,7 @@ sub printForm {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};

View File

@@ -53,7 +53,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -62,7 +62,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'roles.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'roles.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
if ( defined $params->{action} ) {
@@ -425,13 +425,14 @@ sub sort_groups {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
#template
my $template = '';
$template = template::check($config, $params->{template}, 'roles.html' );
$template = template::check( $config, $params->{template}, 'roles.html' );
$checked->{template} = $template;
#actions

View File

@@ -42,7 +42,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -117,11 +117,12 @@ sub show_events {
$params->{years} = $years;
#print STDERR Dumper($params);
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
return;
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
@@ -171,7 +172,7 @@ sub check_params {
$checked->{studio_id} = -1;
}
$checked->{template} = template::check($config, $params->{template}, 'selectEvent' );
$checked->{template} = template::check( $config, $params->{template}, 'selectEvent' );
return $checked;
}

View File

@@ -41,7 +41,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params($config, $params),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -109,6 +109,7 @@ sub show_series {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};

View File

@@ -56,7 +56,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -66,7 +66,7 @@ $params = $request->{params}->{checked};
unless ( params::isJson() ) {
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
}
return unless uac::check( $config, $params, $user_presets ) == 1;
@@ -338,7 +338,7 @@ sub save_series {
$entry->{live} = $params->{live} || 0;
$entry->{count_episodes} = $params->{count_episodes} || 0;
#$entry->{html_content} = decode( 'utf-8', $entry->{content} );
#$entry->{html_content} = Encode::decode( 'utf-8', $entry->{content} );
$entry->{html_content} = markup::creole_to_html( $entry->{content} );
$entry->{html_content} =~ s/([^\>])\n+([^\<])/$1<br\/><br\/>$2/g;
@@ -989,7 +989,7 @@ sub list_series {
#print STDERR Dumper $params->{image};
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'all,series' } );
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
sub show_series {
@@ -1207,10 +1207,11 @@ sub show_series {
#print STDERR '<pre>'.Dumper($params).'</pre>';
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'all,series' } );
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
@@ -1252,9 +1253,9 @@ sub check_params {
}
if ( defined $checked->{series_id} ) {
$checked->{template} = template::check($config, $params->{template}, 'edit_series' );
$checked->{template} = template::check( $config, $params->{template}, 'edit_series' );
} else {
$checked->{template} = template::check($config, $params->{template}, 'series' );
$checked->{template} = template::check( $config, $params->{template}, 'series' );
}
if ( ( defined $checked->{action} ) && ( $checked->{action} eq 'save_schedule' ) ) {

View File

@@ -48,7 +48,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -58,7 +58,7 @@ $params = $request->{params}->{checked};
unless ( params::isJson() ) {
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
}
return unless uac::check( $config, $params, $user_presets ) == 1;
@@ -75,7 +75,7 @@ showPlayout( $config, $request );
print STDERR "$0 ERROR: " . $params->{error} . "\n" if $params->{error} ne '';
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'event,comment' } );
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
exit;
@@ -170,11 +170,12 @@ sub formatLoudness {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
$checked->{error} = '';
$checked->{template} = template::check($config, $params->{template}, 'show_playout' );
$checked->{template} = template::check( $config, $params->{template}, 'show_playout' );
#numeric values
for my $param ( 'project_id', 'studio_id', 'default_studio_id', 'series_id', 'event_id', 'id' ) {

View File

@@ -43,7 +43,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -95,6 +95,7 @@ sub showImage {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};

View File

@@ -5,7 +5,8 @@ use strict;
use Data::Dumper;
use URI::Escape();
use Encode();
#use Encode();
use params();
use config();
@@ -49,7 +50,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -64,7 +65,7 @@ if ( $action eq 'show_dates' ) {
#print "Content-type:text/html\n\n";
} else {
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
}
return unless uac::check( $config, $params, $user_presets ) == 1;
@@ -259,7 +260,7 @@ sub showTimeslotSchedule {
}
#print '<pre>'.Dumper($params).'</pre>';
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
sub showDates {
@@ -350,11 +351,12 @@ sub showDates {
$params->{$key} = $result->{$key};
}
my $template = template::check($config, 'studio_timeslot_dates');
template::process($config, 'print', $template, $params );
my $template = template::check( $config, 'studio_timeslot_dates' );
template::process( $config, 'print', $template, $params );
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
@@ -393,7 +395,7 @@ sub check_params {
$checked->{studio_id} = -1;
}
$checked->{template} = template::check($config, $params->{template}, 'studio_timeslots' );
$checked->{template} = template::check( $config, $params->{template}, 'studio_timeslots' );
for my $param ('frequency') {
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /(\d+)/ ) ) {

View File

@@ -43,7 +43,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -52,7 +52,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
print q{
@@ -199,17 +199,18 @@ sub show_studios {
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'studios' } );
uac::set_template_permissions( $permissions, $params );
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
#template
my $template = '';
$template = template::check($config, $params->{template}, 'studios' );
$template = template::check( $config, $params->{template}, 'studios' );
$checked->{template} = $template;
#actions

View File

@@ -41,7 +41,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -51,7 +51,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
our $errors = [];
@@ -113,7 +113,7 @@ sub show_settings {
uac::set_template_permissions( $permissions, $params );
#print Dumper($permissions);
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
#print '<pre>'.Dumper($user_settings);
}
@@ -159,13 +159,14 @@ sub update_settings {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
#template
my $template = '';
$template = template::check($config, $params->{template}, 'user_settings' );
$template = template::check( $config, $params->{template}, 'user_settings' );
$checked->{template} = $template;
#numeric values

View File

@@ -43,7 +43,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -52,7 +52,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
our $errors = [];
@@ -76,17 +76,18 @@ sub show_stats {
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'user_stats' } );
uac::set_template_permissions( $permissions, $params );
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
#template
my $template = '';
$template = template::check($config, $params->{template}, 'user_stats' );
$template = template::check( $config, $params->{template}, 'user_stats' );
$checked->{template} = $template;
#numeric values

View File

@@ -39,7 +39,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params($config, $params),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -399,6 +399,7 @@ sub update_user_roles {
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};

View File

@@ -5,7 +5,8 @@ use strict;
use Data::Dumper;
use URI::Escape();
use Encode();
#use Encode();
use params();
use config();
@@ -50,7 +51,7 @@ my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -59,7 +60,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
if ( defined $params->{action} ) {
@@ -261,10 +262,11 @@ sub show_work_schedule {
#print STDERR '<pre>'.Dumper($params).'</pre>';
$params->{loc} = localization::get( $config, { user => $params->{presets}->{user}, file => 'work_time' } );
template::process($config, 'print', $params->{template}, $params );
template::process( $config, 'print', $params->{template}, $params );
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
@@ -300,7 +302,7 @@ sub check_params {
$checked->{studio_id} = -1;
}
$checked->{template} = template::check($config, $params->{template}, 'edit_work_time' );
$checked->{template} = template::check( $config, $params->{template}, 'edit_work_time' );
if ( ( defined $checked->{action} ) && ( $checked->{action} eq 'save_schedule' ) ) {

View File

@@ -18,7 +18,7 @@ my $r = shift;
my $config = config::get('config/config.cgi');
$params = check_params($params);
$params = check_params( $config, $params );
list_series( $config, $params );
@@ -32,7 +32,7 @@ sub list_series {
my $studio_id = $params->{studio_id};
my $location = $params->{location};
if (defined $location){
if ( defined $location ) {
my $studios = studios::get(
$config,
{
@@ -48,30 +48,31 @@ sub list_series {
$conditions->{project_id} = $project_id if defined $project_id;
$conditions->{studio_id} = $studio_id if defined $studio_id;
if (scalar (keys %$conditions) == 0){
if ( scalar( keys %$conditions ) == 0 ) {
$params->{info} .= "missing parameters";
return;
}
$params->{info}.= Dumper($conditions);
$params->{info} .= Dumper($conditions);
my $series = series::get_event_age( $config, $conditions );
my $series2 = [];
for my $serie ( sort { lc $a->{series_name} cmp lc $b->{series_name} } (@$series) ) {
next if $serie->{days_over} > 80 ;
next if $serie->{days_over} == 0 ;
next if $serie->{days_over} > 80;
next if $serie->{days_over} == 0;
next unless defined $serie->{series_name};
next if $serie->{series_name} eq '_single_';
push @$series2, $serie;
}
$params->{series} = $series2;
$params->{info}.="no results found" if scalar(@$series)==0;
$params->{info}='';
$params->{info} .= "no results found" if scalar(@$series) == 0;
$params->{info} = '';
template::process($config, 'print', 'templates/series.html', $params );
template::process( $config, 'print', 'templates/series.html', $params );
}
sub check_params {
my $config = shift;
my $params = shift;
my $checked = {};
@@ -82,13 +83,13 @@ sub check_params {
}
$checked->{debug} = $debug;
for my $param ('project_id', 'studio_id') {
for my $param ( 'project_id', 'studio_id' ) {
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
$checked->{$param} = $params->{$param};
}
}
for my $param ( 'location') {
for my $param ('location') {
if ( defined $params->{$param} ) {
$checked->{$param} = $params->{$param};
$checked->{$param} =~ s/^\s+//g;