Last change
on this file since 481 was 480, checked in by Kris Deugau, 14 years ago |
/branches/htmlform
Forgot to remove some refs to printHeader in CommonWeb.pm in r479 (see #15, #26)
Add the Invitable Forgotten New File (DB error template)
|
File size:
1.4 KB
|
Line | |
---|
1 | # ipdb/cgi-bin/CommonWeb.pm
|
---|
2 | ###
|
---|
3 | # SVN revision info
|
---|
4 | # $Date$
|
---|
5 | # SVN revision $Rev$
|
---|
6 | # Last update by $Author$
|
---|
7 | ###
|
---|
8 |
|
---|
9 | package CommonWeb;
|
---|
10 |
|
---|
11 | use strict;
|
---|
12 | use warnings;
|
---|
13 | use Exporter;
|
---|
14 | use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
---|
15 |
|
---|
16 | $VERSION = 1.00;
|
---|
17 | @ISA = qw(Exporter);
|
---|
18 | @EXPORT_OK = qw( &printError &printAndExit &desanitize &cleanInput &desanitize);
|
---|
19 |
|
---|
20 | @EXPORT = (); #export nothing by default
|
---|
21 | %EXPORT_TAGS = ( ALL => [qw( &printError &printAndExit &desanitize &cleanInput )],
|
---|
22 | lean => [qw( &printError &printAndExit &cleanInput )]
|
---|
23 | );
|
---|
24 |
|
---|
25 |
|
---|
26 | sub printError($)
|
---|
27 | {
|
---|
28 | my $errStr = $_[0];
|
---|
29 | print qq(
|
---|
30 | <center><p class="regular"> $errStr </p>
|
---|
31 | <input type="button" value="Back" onclick="history.go(-1)">
|
---|
32 | </center>
|
---|
33 | );
|
---|
34 | }
|
---|
35 |
|
---|
36 | sub printAndExit($)
|
---|
37 | {
|
---|
38 | my $errStr = $_[0];
|
---|
39 | print qq(
|
---|
40 | <center><p class="regular"> $errStr </p>
|
---|
41 | <input type="button" value="Back" onclick="history.go(-1)">
|
---|
42 | </center>
|
---|
43 | );
|
---|
44 | print "<br>would print footer but already dun gone and shot(self->foot)\n";
|
---|
45 | exit(0);
|
---|
46 | }
|
---|
47 |
|
---|
48 | # needs a reference to the webvar hash.
|
---|
49 | # takes out backticks and single quotes
|
---|
50 | sub cleanInput($)
|
---|
51 | {
|
---|
52 | my $hashRef = $_[0];
|
---|
53 |
|
---|
54 | foreach my $key (keys %$hashRef)
|
---|
55 | {
|
---|
56 | $hashRef->{$key} =~ s/`/\\`/g;
|
---|
57 | $hashRef->{$key} =~ s/'/\'/g;
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | # undoes clean input. takes a string as an arg.
|
---|
62 | sub desanitize($)
|
---|
63 | {
|
---|
64 | my $string = $_[0];
|
---|
65 | $string =~ s/\\`/`/g;
|
---|
66 | $string =~ s/\\'/'/g;
|
---|
67 | return $string;
|
---|
68 | }
|
---|
69 |
|
---|
70 | # indicate that the module loaded okay.
|
---|
71 | 1;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.