« auto/share/dist/Nes/cgi-bin/plugin/filter_demo.pl
↑ Summary
auto/share/dist/Nes/cgi-bin/plugin/forms_captcha.pl »
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | # ----------------------------------------------------------------------------- | ||
| 4 | # | ||
| 5 | # Nes by Skriptke | ||
| 6 | # Copyright 2009 - 2010 Enrique F. Castañón Barbero | ||
| 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 | # forms.pl | ||
| 21 | # | ||
| 22 | # ----------------------------------------------------------------------------- | ||
| 23 | |||
| 24 | use strict; | ||
| 25 | use Nes; | ||
| 26 | use forms_plugin; | ||
| 27 | |||
| 28 | my $nes = Nes::Singleton->new(); | ||
| 29 | |||
| 30 | my $out = $nes->{'container'}->get_out_content(); | ||
| 31 | my $forms = nes_forms_plugin->new($out); | ||
| 32 | |||
| 33 | $nes->{'container'}->set_out_content( $forms->go() ); | ||
| 34 | |||
| 35 | my $nes_tags = {}; | ||
| 36 | $nes_tags->{'this_plugin'} = 'forms_plugin'; | ||
| 37 | |||
| 38 | foreach my $name ( keys %{$forms->{'form'}} ) { | ||
| 39 | $forms->{'form'}{$name}->is_ok(); | ||
| 40 | my $plugin = nes_plugin->get_obj('forms_plugin'); | ||
| 41 | $plugin->add_env( 'forms_plugin', $name, 'is_ok', $forms->{'form'}{$name}->{'is_ok'} ); | ||
| 42 | if ( $forms->{'form'}{$name}->{'fatal_error'} ) { | ||
| 43 | if ( $forms->{'form'}{$name}->{'location'} ne 'none' ) { | ||
| 44 | if ( $forms->{'form'}{$name}->{'location'} ) { | ||
| 45 | print "Location: $forms->{'form'}{$name}->{'location'}\n\n"; | ||
| 46 | exit; | ||
| 47 | } else { | ||
| 48 | print "Location: http://$ENV{'SERVER_NAME'}$ENV{'PATH_INFO'}?error_forms=$forms->{'form'}{$name}->{'fatal_error'}\n\n"; | ||
| 49 | exit; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | } | ||
| 55 | |||
| 56 | $nes->{'container'}->add_tags(%$nes_tags); | ||
| 57 | |||
| 58 | # don't forget to return a true value from the file | ||
| 59 | 1; | ||
| 60 |