source: companies/celepar/news_admin/templates/celepar/fckeditor/to_delete/_samples/perl/sampleposteddata.cgi @ 763

Revision 763, 2.7 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1#!/usr/bin/env perl
2
3#####
4#  FCKeditor - The text editor for internet
5#  Copyright (C) 2003-2006 Frederico Caldeira Knabben
6
7#  Licensed under the terms of the GNU Lesser General Public License:
8#               http://www.opensource.org/licenses/lgpl-license.php
9
10#  For further information visit:
11#               http://www.fckeditor.net/
12
13#  "Support Open Source software. What about a donation today?"
14
15#  File Name: sampleposteddata.cgi
16#       This page lists the data posted by a form.
17
18#  File Authors:
19#               Takashi Yamaguchi (jack@omakase.net)
20#####
21
22## START: Hack for Windows (Not important to understand the editor code... Perl specific).
23if(Windows_check()) {
24        chdir(GetScriptPath($0));
25}
26
27sub Windows_check
28{
29        # IIS,PWS(NT/95)
30        $www_server_os = $^O;
31        # Win98 & NT(SP4)
32        if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; }
33        # AnHTTPd/Omni/IIS
34        if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; }
35        # Win Apache
36        if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; }
37        if($www_server_os=~ /win/i) { return(1); }
38        return(0);
39}
40
41sub GetScriptPath {
42        local($path) = @_;
43        if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; }
44        $path;
45}
46## END: Hack for IIS
47
48require '../../fckeditor.pl';
49
50        if($ENV{'REQUEST_METHOD'} eq "POST") {
51                read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
52        } else {
53                $buffer = $ENV{'QUERY_STRING'};
54        }
55        @pairs = split(/&/,$buffer);
56        foreach $pair (@pairs) {
57                ($name,$value) = split(/=/,$pair);
58                $value =~ tr/+/ /;
59                $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
60                $value =~ s/\t//g;
61                $value =~ s/\r\n/\n/g;
62                $FORM{$name} .= "\0"                    if(defined($FORM{$name}));
63                $FORM{$name} .= $value;
64        }
65
66        print "Content-type: text/html\n\n";
67        print <<"_HTML_TAG_";
68<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
69
70<html>
71        <head>
72                <title>FCKeditor - Samples - Posted Data</title>
73                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
74                <meta name="robots" content="noindex, nofollow">
75                <link href="../sample.css" rel="stylesheet" type="text/css" />
76        </head>
77        <body>
78                <h1>FCKeditor - Samples - Posted Data</h1>
79                This page lists all data posted by the form.
80                <hr>
81                <table width="100%" border="1" cellspacing="0" bordercolor="#999999">
82                        <tr style="FONT-WEIGHT: bold; COLOR: #dddddd; BACKGROUND-COLOR: #999999">
83                                <td nowrap>Field Name&nbsp;&nbsp;</td>
84                                <td>Value</td>
85                        </tr>
86_HTML_TAG_
87
88        foreach $key (keys %FORM) {
89                $postedValue = &specialchar_cnv($FORM{$key});
90                print <<"_HTML_TAG_";
91                        <tr>
92                                <td valign="top" nowrap><b>$key</b></td>
93                                <td width="100%">$postedValue</td>
94                        </tr>
95_HTML_TAG_
96        }
97                print <<"_HTML_TAG_";
98                </table>
99        </body>
100</html>
101_HTML_TAG_
Note: See TracBrowser for help on using the repository browser.