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

Revision 763, 3.0 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: sample01.cgi
16#       Sample page.
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# When $ENV{'PATH_INFO'} cannot be used by perl.
51# $DefRootPath = "/XXXXX/_samples/perl/sample01.cgi"; Please write in script.
52
53my $DefServerPath = "";
54my $ServerPath;
55
56        $ServerPath = &GetServerPath();
57        print "Content-type: text/html\n\n";
58        print <<"_HTML_TAG_";
59<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
60<html>
61        <head>
62                <title>FCKeditor - Sample</title>
63                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
64                <meta name="robots" content="noindex, nofollow">
65                <link href="../sample.css" rel="stylesheet" type="text/css" />
66        </head>
67        <body>
68                <h1>FCKeditor - Perl - Sample 1</h1>
69                This sample displays a normal HTML form with an FCKeditor with full features
70                enabled.
71                <hr>
72                <form action="sampleposteddata.cgi" method="post" target="_blank">
73_HTML_TAG_
74
75        #// Automatically calculates the editor base path based on the _samples directory.
76        #// This is usefull only for these samples. A real application should use something like this:
77        #// $oFCKeditor->BasePath = '/fckeditor/' ;     // '/fckeditor/' is the default value.
78
79        $sBasePath = $ServerPath;
80        $sBasePath = substr($sBasePath,0,index($sBasePath,"_samples"));
81        &FCKeditor('FCKeditor1');
82        $BasePath       = $sBasePath;
83        $Value          = 'This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.';
84        &Create();
85
86        print <<"_HTML_TAG_";
87                        <br>
88                        <input type="submit" value="Submit">
89                </form>
90        </body>
91</html>
92_HTML_TAG_
93
94################
95#Please use this function, rewriting it depending on a server's environment.
96################
97sub GetServerPath
98{
99my $dir;
100
101        if($DefServerPath) {
102                $dir = $DefServerPath;
103        } else {
104                if($ENV{'PATH_INFO'}) {
105                        $dir  = $ENV{'PATH_INFO'};
106                } elsif($ENV{'FILEPATH_INFO'}) {
107                        $dir  = $ENV{'FILEPATH_INFO'};
108                }
109        }
110        return($dir);
111}
Note: See TracBrowser for help on using the repository browser.