use entry::set_numbers and setbools for parameters
This commit is contained in:
@@ -11,19 +11,31 @@ sub from_valid($$) {
|
|||||||
sub set_numbers($$$) {
|
sub set_numbers($$$) {
|
||||||
my ( $entry, $params, $fields ) = @_;
|
my ( $entry, $params, $fields ) = @_;
|
||||||
for my $field (@$fields) {
|
for my $field (@$fields) {
|
||||||
next unless defined $params->{$field};
|
my $value = $params->{$field};
|
||||||
if ( $params->{$field} =~ /([\-\d]+)/ ){
|
next unless defined $value;
|
||||||
|
if ( $value =~ /([\-\d]+)/ ){
|
||||||
$entry->{$field} = $1;
|
$entry->{$field} = $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_bools($$$) {
|
||||||
|
my ( $entry, $params, $fields ) = @_;
|
||||||
|
for my $field (@$fields) {
|
||||||
|
my $value = $params->{$field};
|
||||||
|
next unless defined $value;
|
||||||
|
if ($value=~/([01])/){
|
||||||
|
$entry->{$field} = $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub set_strings($$$) {
|
sub set_strings($$$) {
|
||||||
my ( $entry, $params, $attrs ) = @_;
|
my ( $entry, $params, $attrs ) = @_;
|
||||||
for my $field (@$attrs) {
|
for my $field (@$attrs) {
|
||||||
next unless defined $params->{$field};
|
my $value = $params->{$field};
|
||||||
$entry->{$field} = $params->{$field};
|
next unless defined $value;
|
||||||
|
$entry->{$field} = $value;
|
||||||
$entry->{$field} =~ s/^\s+//g;
|
$entry->{$field} =~ s/^\s+//g;
|
||||||
$entry->{$field} =~ s/\s+$//g;
|
$entry->{$field} =~ s/\s+$//g;
|
||||||
}
|
}
|
||||||
@@ -31,7 +43,8 @@ sub set_strings($$$) {
|
|||||||
|
|
||||||
sub element_of($$) {
|
sub element_of($$) {
|
||||||
my ( $value, $attrs ) = @_;
|
my ( $value, $attrs ) = @_;
|
||||||
return { map { $_ => $_ } @$attrs }->{$value};
|
return unless $value;
|
||||||
|
return { map { $_ => $_ } @$attrs }->{$value} //'';
|
||||||
}
|
}
|
||||||
|
|
||||||
# do not delete last line
|
# do not delete last line
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ my $debug = $config->{system}->{debug};
|
|||||||
my ( $user, $expires ) = auth::get_user( $config, $params, $cgi );
|
my ( $user, $expires ) = auth::get_user( $config, $params, $cgi );
|
||||||
return if ( !defined $user ) || ( $user eq '' );
|
return if ( !defined $user ) || ( $user eq '' );
|
||||||
|
|
||||||
#print STDERR $params->{project_id}."\n";
|
|
||||||
my $user_presets = uac::get_user_presets(
|
my $user_presets = uac::get_user_presets(
|
||||||
$config,
|
$config,
|
||||||
{
|
{
|
||||||
@@ -48,7 +47,6 @@ $params->{default_studio_id} = $user_presets->{studio_id};
|
|||||||
$params = uac::setDefaultStudio( $params, $user_presets );
|
$params = uac::setDefaultStudio( $params, $user_presets );
|
||||||
$params = uac::setDefaultProject( $params, $user_presets );
|
$params = uac::setDefaultProject( $params, $user_presets );
|
||||||
|
|
||||||
#print STDERR $params->{project_id}."\n";
|
|
||||||
my $request = {
|
my $request = {
|
||||||
url => $ENV{QUERY_STRING} || '',
|
url => $ENV{QUERY_STRING} || '',
|
||||||
params => {
|
params => {
|
||||||
@@ -206,12 +204,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#actions and roles
|
#actions and roles
|
||||||
$checked->{action} = '';
|
$checked->{action} = '';
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
@@ -236,11 +228,3 @@ sub check_params {
|
|||||||
|
|
||||||
return $checked;
|
return $checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
__DATA__
|
|
||||||
|
|
||||||
SELECT ps.project_id, ps.studio_id, ps.series_id,p.name,s.name,se.series_name,se.title
|
|
||||||
FROM calcms_project_series ps ,calcms_projects p,calcms_studios s,calcms_series se
|
|
||||||
where ps.project_id=p.project_id and ps.studio_id=s.id and ps.series_id=se.id
|
|
||||||
order by se.series_name,p.name,s.name
|
|
||||||
|
|
||||||
|
|||||||
@@ -352,12 +352,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#actions and roles
|
#actions and roles
|
||||||
$checked->{action} = '';
|
$checked->{action} = '';
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
|
|||||||
@@ -554,19 +554,8 @@ sub check_params {
|
|||||||
$checked->{studio_id} = -1;
|
$checked->{studio_id} = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#word
|
entry::set_strings( $checked, $params, [
|
||||||
for my $param ( 'debug', 'name', 'description' ) {
|
'name', 'description', 'action', 'path' ]);
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\s*(.+?)\s*$/ ) ) {
|
|
||||||
$checked->{$param} = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# words
|
|
||||||
for my $attr ( 'action', 'path' ) {
|
|
||||||
if ( ( defined $params->{$attr} ) && ( $params->{$attr} =~ /(\S+)/ ) ) {
|
|
||||||
$checked->{$attr} = $params->{$attr};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$checked->{upload} = $params->{upload};
|
$checked->{upload} = $params->{upload};
|
||||||
return $checked;
|
return $checked;
|
||||||
|
|||||||
@@ -288,9 +288,6 @@ sub check_params {
|
|||||||
my $event_id = $params->{event_id} || '';
|
my $event_id = $params->{event_id} || '';
|
||||||
if ( $event_id =~ /^(\d+)$/ ) {
|
if ( $event_id =~ /^(\d+)$/ ) {
|
||||||
$comment->{event_id} = $1;
|
$comment->{event_id} = $1;
|
||||||
} else {
|
|
||||||
|
|
||||||
# error('invalid event_id');
|
|
||||||
}
|
}
|
||||||
$comment->{event_id} = '' unless defined $comment->{event_id};
|
$comment->{event_id} = '' unless defined $comment->{event_id};
|
||||||
|
|
||||||
|
|||||||
@@ -202,12 +202,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#actions and roles
|
#actions and roles
|
||||||
$checked->{action} = '';
|
$checked->{action} = '';
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
|
|||||||
@@ -247,12 +247,6 @@ sub check_params {
|
|||||||
my $template = '';
|
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\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#numeric values
|
#numeric values
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'id', 'project_id', 'studio_id', 'default_studio_id', 'user_id', 'series_id', 'event_id', 'v1', 'v2' )
|
'id', 'project_id', 'studio_id', 'default_studio_id', 'user_id', 'series_id', 'event_id', 'v1', 'v2' )
|
||||||
|
|||||||
@@ -802,12 +802,6 @@ sub check_params {
|
|||||||
my $template = '';
|
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\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'id', 'project_id', 'studio_id', 'default_studio_id',
|
'id', 'project_id', 'studio_id', 'default_studio_id',
|
||||||
'user_id', 'series_id', 'event_id', 'source_event_id',
|
'user_id', 'series_id', 'event_id', 'source_event_id',
|
||||||
@@ -825,23 +819,13 @@ sub check_params {
|
|||||||
'studio', 'search', 'from', 'till', 'hide_series'
|
'studio', 'search', 'from', 'till', 'hide_series'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
#numbers
|
entry::set_numbers( $checked, $params, [
|
||||||
for my $param ( 'duration', 'recurrence' ) {
|
'duration', 'recurrence' ]);
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /(\d+)/ ) ) {
|
|
||||||
$checked->{$param} = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#checkboxes
|
entry::set_bools( $checked, $params, [
|
||||||
for my $param (
|
|
||||||
'live', 'published', 'playout', 'archived',
|
'live', 'published', 'playout', 'archived',
|
||||||
'rerun', 'draft', 'disable_event_sync', 'get_rerun'
|
'rerun', 'draft', 'disable_event_sync', 'get_rerun'
|
||||||
)
|
]);
|
||||||
{
|
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /([01])/ ) ) {
|
|
||||||
$checked->{$param} = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
entry::set_strings( $checked, $params, [
|
entry::set_strings( $checked, $params, [
|
||||||
'series_name', 'title', 'excerpt', 'content',
|
'series_name', 'title', 'excerpt', 'content',
|
||||||
|
|||||||
@@ -620,13 +620,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#numeric values
|
|
||||||
$checked->{exclude} = 0;
|
$checked->{exclude} = 0;
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'id', 'project_id', 'studio_id', 'default_studio_id' ]);
|
'id', 'project_id', 'studio_id', 'default_studio_id' ]);
|
||||||
|
|||||||
@@ -381,26 +381,10 @@ sub check_params {
|
|||||||
$checked->{studio_id} = -1;
|
$checked->{studio_id} = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#string
|
entry::set_strings( $checked, $params, [ 'action', 'name', 'description', 'licence' ]);
|
||||||
for my $param ( 'debug', 'name', 'description', 'licence' ) {
|
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\s*(.+?)\s*$/ ) ) {
|
|
||||||
$checked->{$param} = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Words
|
|
||||||
for my $attr ('action') {
|
|
||||||
if ( ( defined $params->{$attr} ) && ( $params->{$attr} =~ /(\S+)/ ) ) {
|
|
||||||
$checked->{$attr} = $params->{$attr};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#checkboxes
|
#checkboxes
|
||||||
for my $param ('public') {
|
entry::set_bools( $checked, $params, [ 'public' ] );
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /([01])/ ) ) {
|
|
||||||
$checked->{$param} = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $checked;
|
return $checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -416,7 +416,6 @@ sub check_params {
|
|||||||
|
|
||||||
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;
|
$checked->{limit} = 100;
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'project_id', 'studio_id', 'series_id', 'event_id', 'pid', 'default_studio_id', 'limit'
|
'project_id', 'studio_id', 'series_id', 'event_id', 'pid', 'default_studio_id', 'limit'
|
||||||
@@ -431,35 +430,15 @@ sub check_params {
|
|||||||
$checked->{limit} = 100 unless defined $checked->{limit};
|
$checked->{limit} = 100 unless defined $checked->{limit};
|
||||||
$checked->{limit} = 100 if ( $checked->{limit} > 100 );
|
$checked->{limit} = 100 if ( $checked->{limit} > 100 );
|
||||||
|
|
||||||
#string
|
|
||||||
$checked->{search} = '';
|
|
||||||
if ( ( defined $params->{search} ) && ( $params->{search} =~ /^\s*(.+?)\s*$/ ) ) {
|
|
||||||
$checked->{search} = $1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $attr ( 'update_name', 'update_description', 'licence' ) {
|
|
||||||
$checked->{$attr} = '';
|
|
||||||
if ( ( defined $params->{$attr} ) && ( $params->{$attr} =~ /^\s*(.+?)\s*$/ ) ) {
|
|
||||||
$checked->{$attr} = $params->{$attr};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Words
|
|
||||||
$checked->{delete_image} = '';
|
$checked->{delete_image} = '';
|
||||||
$checked->{save_image} = '';
|
$checked->{save_image} = '';
|
||||||
for my $attr ( 'save_image', 'delete_image', 'show', 'filename', 'target' ) {
|
entry::set_strings( $checked, $params, [
|
||||||
$checked->{$attr} = '';
|
'search',
|
||||||
if ( ( defined $params->{$attr} ) && ( $params->{$attr} =~ /(\S+)/ ) ) {
|
'update_name', 'update_description', 'licence',
|
||||||
$checked->{$attr} = $params->{$attr};
|
'save_image', 'delete_image', 'show', 'filename', 'target' ]);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#checkboxes
|
#checkboxes
|
||||||
for my $param ('public') {
|
entry::set_bools( $checked, $params, [ 'public ']);
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /([01])/ ) ) {
|
|
||||||
$checked->{$param} = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#map show to filename, but overwrite if filename given
|
#map show to filename, but overwrite if filename given
|
||||||
if ( $checked->{show} ne '' ) {
|
if ( $checked->{show} ne '' ) {
|
||||||
|
|||||||
@@ -252,11 +252,8 @@ sub check_params {
|
|||||||
'event_id', 'project_id', 'studio_id', 'default_studio_id', 'user_id', 'series_id', 'duration'
|
'event_id', 'project_id', 'studio_id', 'default_studio_id', 'user_id', 'series_id', 'duration'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
for my $param ( 'subject', 'to', 'cc', 'content' ) {
|
entry::set_strings( $checked, $params, [
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /\S/ ) ) {
|
'subject', 'to', 'cc', 'content']);
|
||||||
$checked->{$param} = $params->{$param};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( defined $checked->{studio_id} ) {
|
if ( defined $checked->{studio_id} ) {
|
||||||
$checked->{default_studio_id} = $checked->{studio_id};
|
$checked->{default_studio_id} = $checked->{studio_id};
|
||||||
|
|||||||
@@ -115,13 +115,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#actions and roles
|
|
||||||
$checked->{action} = '';
|
$checked->{action} = '';
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
if ( $params->{action} =~ /^(delete)$/ ) {
|
if ( $params->{action} =~ /^(delete)$/ ) {
|
||||||
|
|||||||
@@ -285,11 +285,8 @@ sub check_params {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $param ( 'name', 'title', 'subtitle', 'start_date', 'end_date', 'image', 'email', 'setImage' ) {
|
entry::set_strings( $checked, $params, [
|
||||||
if ( defined $params->{$param} ) {
|
'name', 'title', 'subtitle', 'start_date', 'end_date', 'image', 'email', 'setImage' ]);
|
||||||
$checked->{$param} = $params->{$param};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'project_id', 'studio_id', 'default_studio_id', 'pid', 'sid']);
|
'project_id', 'studio_id', 'default_studio_id', 'pid', 'sid']);
|
||||||
|
|||||||
@@ -142,20 +142,8 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
#my $template = '';
|
entry::set_strings( $checked, $params, [
|
||||||
#$checked->{template} = template::check($config, $params->{template}, 'request-password' );
|
'user', 'token', 'user_password', 'user_password2']);
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
for my $param ( 'user', 'token', 'user_password', 'user_password2' ) {
|
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /\S/ ) ) {
|
|
||||||
$checked->{$param} = $params->{$param};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$checked->{action} = '';
|
$checked->{action} = '';
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
|
|||||||
@@ -125,21 +125,13 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'id', 'project_id', 'studio_id', 'series_id', 'event_id', 'p_id', 's_id'
|
'id', 'project_id', 'studio_id', 'series_id', 'event_id', 'p_id', 's_id'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
for my $param ( 'selectProjectStudio', 'selectSeries', 'selectRange' ) {
|
entry::set_bools( $checked, $params,
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} eq '1' ) ) {
|
[ 'selectProjectStudio', 'selectSeries', 'selectRange' ]
|
||||||
$checked->{$param} = $params->{$param};
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $param ('resultElemId') {
|
for my $param ('resultElemId') {
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^[a-zA-ZöäüÖÄÜß_\d]+$/ ) ) {
|
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^[a-zA-ZöäüÖÄÜß_\d]+$/ ) ) {
|
||||||
|
|||||||
@@ -115,21 +115,12 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'id', 'project_id', 'studio_id', 'series_id', 'p_id', 's_id'
|
'id', 'project_id', 'studio_id', 'series_id', 'p_id', 's_id'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
for my $param ( 'selectProjectStudio', 'selectSeries', 'selectRange' ) {
|
entry::set_bools( $checked, $params, [
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} eq '1' ) ) {
|
'selectProjectStudio', 'selectSeries', 'selectRange' ]);
|
||||||
$checked->{$param} = $params->{$param};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $param ('resultElemId') {
|
for my $param ('resultElemId') {
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^[a-zA-ZöäüÖÄÜß_\d]+$/ ) ) {
|
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^[a-zA-ZöäüÖÄÜß_\d]+$/ ) ) {
|
||||||
|
|||||||
@@ -1411,12 +1411,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#actions
|
#actions
|
||||||
$checked->{action} = '';
|
$checked->{action} = '';
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
|
|||||||
@@ -100,12 +100,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#numeric values
|
#numeric values
|
||||||
for my $param ('filename') {
|
for my $param ('filename') {
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^[A-Za-z\_\-\.\d\/]+$/ ) ) {
|
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^[A-Za-z\_\-\.\d\/]+$/ ) ) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use series;
|
|||||||
use template;
|
use template;
|
||||||
use playout;
|
use playout;
|
||||||
use audio;
|
use audio;
|
||||||
|
use entry;
|
||||||
|
|
||||||
binmode STDOUT, ":utf8";
|
binmode STDOUT, ":utf8";
|
||||||
|
|
||||||
@@ -149,13 +150,6 @@ sub check_params {
|
|||||||
$checked->{studio_id} = -1;
|
$checked->{studio_id} = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#word
|
|
||||||
for my $param ('debug') {
|
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\s*(.+?)\s*$/ ) ) {
|
|
||||||
$checked->{$param} = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $checked;
|
return $checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -358,12 +358,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#actions and roles
|
#actions and roles
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
if ( $params->{action} =~ /^(show|save_schedule|delete_schedule|show_dates)$/ ) {
|
if ( $params->{action} =~ /^(show|save_schedule|delete_schedule|show_dates)$/ ) {
|
||||||
@@ -371,7 +365,6 @@ sub check_params {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#numeric values
|
|
||||||
$checked->{exclude} = 0;
|
$checked->{exclude} = 0;
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'id', 'project_id', 'studio_id', 'default_studio_id', 'schedule_id', 'schedule_studio_id'
|
'id', 'project_id', 'studio_id', 'default_studio_id', 'schedule_id', 'schedule_studio_id'
|
||||||
@@ -392,11 +385,7 @@ sub check_params {
|
|||||||
|
|
||||||
$checked->{template} = template::check( $config, $params->{template}, 'studio-timeslots' );
|
$checked->{template} = template::check( $config, $params->{template}, 'studio-timeslots' );
|
||||||
|
|
||||||
for my $param ('frequency') {
|
entry::set_numbers( $checked, $params, ['frequency'] );
|
||||||
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /(\d+)/ ) ) {
|
|
||||||
$checked->{$param} = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $attr ( 'start', 'end' ) {
|
for my $attr ( 'start', 'end' ) {
|
||||||
if ( ( defined $params->{$attr} ) && ( $params->{$attr} =~ /(\d\d\d\d\-\d\d\-\d\d[ T]\d\d\:\d\d)/ ) ) {
|
if ( ( defined $params->{$attr} ) && ( $params->{$attr} =~ /(\d\d\d\d\-\d\d\-\d\d[ T]\d\d\:\d\d)/ ) ) {
|
||||||
|
|||||||
@@ -229,11 +229,8 @@ sub check_params {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $param ( 'name', 'description', 'location', 'stream', 'google_calendar', 'image', 'setImage' ) {
|
entry::set_strings( $checked, $params, [
|
||||||
if ( defined $params->{$param} ) {
|
'name', 'description', 'location', 'stream', 'google_calendar', 'image', 'setImage' ]);
|
||||||
$checked->{$param} = $params->{$param};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'project_id', 'studio_id', 'default_studio_id', 'id'
|
'project_id', 'studio_id', 'default_studio_id', 'id'
|
||||||
|
|||||||
@@ -394,7 +394,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
#template
|
|
||||||
my $template = '';
|
my $template = '';
|
||||||
$template = template::check( $config, $params->{template}, 'users' );
|
$template = template::check( $config, $params->{template}, 'users' );
|
||||||
$checked->{template} = $template;
|
$checked->{template} = $template;
|
||||||
|
|||||||
@@ -264,12 +264,6 @@ sub check_params {
|
|||||||
|
|
||||||
my $checked = {};
|
my $checked = {};
|
||||||
|
|
||||||
my $debug = $params->{debug} || '';
|
|
||||||
if ( $debug =~ /([a-z\_\,]+)/ ) {
|
|
||||||
$debug = $1;
|
|
||||||
}
|
|
||||||
$checked->{debug} = $debug;
|
|
||||||
|
|
||||||
#actions and roles
|
#actions and roles
|
||||||
$checked->{action} = '';
|
$checked->{action} = '';
|
||||||
if ( defined $params->{action} ) {
|
if ( defined $params->{action} ) {
|
||||||
@@ -278,7 +272,6 @@ sub check_params {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#numeric values
|
|
||||||
$checked->{exclude} = 0;
|
$checked->{exclude} = 0;
|
||||||
entry::set_numbers( $checked, $params, [
|
entry::set_numbers( $checked, $params, [
|
||||||
'project_id', 'studio_id', 'default_studio_id', 'schedule_id',
|
'project_id', 'studio_id', 'default_studio_id', 'schedule_id',
|
||||||
|
|||||||
Reference in New Issue
Block a user