auto/share/dist/Nes/cgi-bin/obj/Nes/form/multi_step.pm untested

filter: Statementstmt 0.0% 0 / 68 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 105 CC 4 SCAR 26.4
CC
4
Cov
0%
new
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 14.0
1 #!/bin/perl
2  
3 # -----------------------------------------------------------------------------
4 #
5 # Nes by Skriptke
6 # Copyright 2009 - 2010 Enrique Castañón
7 # Licensed under the GNU GPL.
8 #
9 # CPAN:
10 # http://search.cpan.org/dist/Nes/
11 #
12 # Sample:
13 # http://nes.sourceforge.net/
14 #
15 # Repository:
16 # http://github.com/Skriptke/nes
17 #
18 # Version 1.03
19 #
20 # multi_step.pm
21 #
22 # DOCUMENTATION:
23 # perldoc Nes::Obj::multi_step
24 #
25 # -----------------------------------------------------------------------------
26  
27 use strict;
28 use Nes;
29  
30 package multi_step;
31  
32 {
33
34 sub new {
35 my $class = shift;
36 my $self = bless {}, $class;
37
38 my $nes = Nes::Singleton->new();
39 my $cfg = $nes->{'CFG'};
40 my $data = '('.$nes->{'query'}->{'q'}{'multi_step_param_1'}.')';
41 my %param = eval "$data";
42 my $expire;
43
44 foreach my $step ( @{$param{'steps'}} ) {
45 # seconds per field
46 $expire += @{$step} * 60;
47 }
48  
49 $self->{'script_handler'} = '';
50 $self->{'function_handler'} = '';
51 $self->{'script_NES'} = '';
52
53 $self->{'to_database'} = 'INSERT';
54 $self->{'to_where'} = undef;
55 $self->{'to_limit'} = '0'; # for safety, requires explicit mention
56 $self->{'to_table'} = undef;
57 $self->{'to_fields_assort'} = undef;
58
59 $self->{'msg_error_data'} = '';
60 $self->{'msg_ok_data'} = 'Ok data.';
61 $self->{'referer'} = '';
62 $self->{'private_key'} = '';
63 $self->{'show_captcha'} = 1;
64 $self->{'table_width'} = '95%';
65 $self->{'submit_begin'} = '<center>';
66 $self->{'submit_end'} = '</center>';
67 $self->{'span_error'} = '&nbsp;';
68 $self->{'form_expire'} = $expire.'s';
69 $self->{'form_name'} = 'multi_sf';
70 $self->{'captcha_name'} = 'multi_sc';
71 $self->{'captcha_end'} = '<br><br>';
72 $self->{'captcha_begin'} = '';
73 $self->{'captcha_type'} = 'ascii';
74 $self->{'captcha_digits'} = 5;
75 $self->{'captcha_size'} = 2;
76 $self->{'captcha_noise'} = 3;
77 $self->{'captcha_sig'} = '';
78 $self->{'captcha_spc'} = ' ';
79 $self->{'captcha_expire'} = '40s';
80 $self->{'captcha_atempts'} = '5/10';
81 $self->{'captcha_tag_start'} = $cfg->{$param{'form_name'}.'_multi_step_captcha_tag_start'}
82 || '<pre style="font-size:2px; line-height:1.0;">';
83 $self->{'captcha_tag_start'} = '' if $self->{'captcha_size'} ne 'none';
84 $self->{'captcha_tag_end'} = $cfg->{$param{'form_name'}.'_multi_step_captcha_tag_end'}
85 || '<br></pre>';
86 $self->{'captcha_tag_end'} = '' if $self->{'captcha_size'} ne 'none';
87 $self->{'out_page'} = '' if !exists $self->{'out_page'};
88 $self->{'msg_legend'} = $cfg->{$param{'form_name'}.'_multi_step_msg_legend'}
89 || '';
90 $self->{'msg_submit'} = $cfg->{$param{'form_name'}.'_multi_step_msg_submit'}
91 || 'Enter';
92 $self->{'msg_captcha'} = $cfg->{$param{'form_name'}.'_multi_step_msg_captcha'}
93 || 'Security code';
94 $self->{'txt_captcha'} = $cfg->{$param{'form_name'}.'_multi_step_txt_captcha'}
95 || '<center>Finally, enter the security code below.</center><br>';
96 $self->{'msg_error_captcha'} = $cfg->{$param{'form_name'}.'_multi_step_msg_error_captcha'}
97 || '<img src="'.$cfg->{'img_dir'}.'/error.gif">';
98 $self->{'msg_error_form'} = $cfg->{$param{'form_name'}.'_multi_step_msg_error_form'}
99 || '<center>The following fields are invalid:</center><br>';
100 $self->{'id_form'} = '';
101 $self->{'class_form'} = '';
102 $self->{'action_form'} = '';
103 $self->{'tpl_errors'} = 'multi_step_errors.nhtml';
104 $self->{'tpl_options'} = '';
105 $self->{'msg_error_fields'} = $cfg->{$param{'form_name'}.'_multi_step_msg_error_fields'}
106 || '<img src="'.$cfg->{'img_dir'}.'/error.gif">';
107
108 foreach my $this (keys %param) {
109 $self->{$this} = $param{$this};
110 }
111
112 return $self;
113 }
114  
115 }
116  
117 # don't forget to return a true value from the file
118 1;
119