1 | #!/usr/bin/env perl
|
---|
2 |
|
---|
3 | #####
|
---|
4 | # FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
---|
5 | # Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
---|
6 | #
|
---|
7 | # == BEGIN LICENSE ==
|
---|
8 | #
|
---|
9 | # Licensed under the terms of any of the following licenses at your
|
---|
10 | # choice:
|
---|
11 | #
|
---|
12 | # - GNU General Public License Version 2 or later (the "GPL")
|
---|
13 | # http://www.gnu.org/licenses/gpl.html
|
---|
14 | #
|
---|
15 | # - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
---|
16 | # http://www.gnu.org/licenses/lgpl.html
|
---|
17 | #
|
---|
18 | # - Mozilla Public License Version 1.1 or later (the "MPL")
|
---|
19 | # http://www.mozilla.org/MPL/MPL-1.1.html
|
---|
20 | #
|
---|
21 | # == END LICENSE ==
|
---|
22 | #
|
---|
23 | # This page lists the data posted by a form.
|
---|
24 | #####
|
---|
25 |
|
---|
26 | ## START: Hack for Windows (Not important to understand the editor code... Perl specific).
|
---|
27 | if(Windows_check()) {
|
---|
28 | chdir(GetScriptPath($0));
|
---|
29 | }
|
---|
30 |
|
---|
31 | sub Windows_check
|
---|
32 | {
|
---|
33 | # IIS,PWS(NT/95)
|
---|
34 | $www_server_os = $^O;
|
---|
35 | # Win98 & NT(SP4)
|
---|
36 | if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; }
|
---|
37 | # AnHTTPd/Omni/IIS
|
---|
38 | if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; }
|
---|
39 | # Win Apache
|
---|
40 | if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; }
|
---|
41 | if($www_server_os=~ /win/i) { return(1); }
|
---|
42 | return(0);
|
---|
43 | }
|
---|
44 |
|
---|
45 | sub GetScriptPath {
|
---|
46 | local($path) = @_;
|
---|
47 | if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; }
|
---|
48 | $path;
|
---|
49 | }
|
---|
50 | ## END: Hack for IIS
|
---|
51 |
|
---|
52 | require '../../fckeditor.pl';
|
---|
53 |
|
---|
54 | if($ENV{'REQUEST_METHOD'} eq "POST") {
|
---|
55 | read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
|
---|
56 | } else {
|
---|
57 | $buffer = $ENV{'QUERY_STRING'};
|
---|
58 | }
|
---|
59 | @pairs = split(/&/,$buffer);
|
---|
60 | foreach $pair (@pairs) {
|
---|
61 | ($name,$value) = split(/=/,$pair);
|
---|
62 | $value =~ tr/+/ /;
|
---|
63 | $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
|
---|
64 | $value =~ s/\t//g;
|
---|
65 | $value =~ s/\r\n/\n/g;
|
---|
66 | $FORM{$name} .= "\0" if(defined($FORM{$name}));
|
---|
67 | $FORM{$name} .= $value;
|
---|
68 | }
|
---|
69 |
|
---|
70 | print "Content-type: text/html\n\n";
|
---|
71 | print <<"_HTML_TAG_";
|
---|
72 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
73 | <html>
|
---|
74 | <head>
|
---|
75 | <title>FCKeditor - Samples - Posted Data</title>
|
---|
76 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
---|
77 | <meta name="robots" content="noindex, nofollow">
|
---|
78 | <link href="../sample.css" rel="stylesheet" type="text/css" >
|
---|
79 | </head>
|
---|
80 | <body>
|
---|
81 | <h1>FCKeditor - Samples - Posted Data</h1>
|
---|
82 | This page lists all data posted by the form.
|
---|
83 | <hr>
|
---|
84 | <table border="1" cellspacing="0" id="outputSample">
|
---|
85 | <colgroup><col width="80"><col></colgroup>
|
---|
86 | <thead>
|
---|
87 | <tr>
|
---|
88 | <th>Field Name</th>
|
---|
89 | <th>Value</th>
|
---|
90 | </tr>
|
---|
91 | </thead>
|
---|
92 | _HTML_TAG_
|
---|
93 |
|
---|
94 | foreach $key (keys %FORM) {
|
---|
95 | $postedValue = &specialchar_cnv($FORM{$key});
|
---|
96 | $key = &specialchar_cnv($key);
|
---|
97 | print <<"_HTML_TAG_";
|
---|
98 | <tr>
|
---|
99 | <th>$key</th>
|
---|
100 | <td><pre>$postedValue</pre></td>
|
---|
101 | </tr>
|
---|
102 | _HTML_TAG_
|
---|
103 | }
|
---|
104 | print <<"_HTML_TAG_";
|
---|
105 | </table>
|
---|
106 | </body>
|
---|
107 | </html>
|
---|
108 | _HTML_TAG_
|
---|