PluginProbe
Wp-Insert / 1.2
Wp-Insert v1.2
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
wp-insert / fckeditor / _samples / perl / sample01.cgi

sample01.cgi in Wp-Insert 1.2, at fckeditor/_samples/perl/sample01.cgi

235 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 #!/usr/bin/env perl
2
3
4
5 #####
6
7 # FCKeditor - The text editor for Internet - http://www.fckeditor.net
8
9 # Copyright (C) 2003-2009 Frederico Caldeira Knabben
10
11 #
12
13 # == BEGIN LICENSE ==
14
15 #
16
17 # Licensed under the terms of any of the following licenses at your
18
19 # choice:
20
21 #
22
23 # - GNU General Public License Version 2 or later (the "GPL")
24
25 # http://www.gnu.org/licenses/gpl.html
26
27 #
28
29 # - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
30
31 # http://www.gnu.org/licenses/lgpl.html
32
33 #
34
35 # - Mozilla Public License Version 1.1 or later (the "MPL")
36
37 # http://www.mozilla.org/MPL/MPL-1.1.html
38
39 #
40
41 # == END LICENSE ==
42
43 #
44
45 # Sample page.
46
47 #####
48
49
50
51 ## START: Hack for Windows (Not important to understand the editor code... Perl specific).
52
53 if(Windows_check()) {
54
55 chdir(GetScriptPath($0));
56
57 }
58
59
60
61 sub Windows_check
62
63 {
64
65 # IIS,PWS(NT/95)
66
67 $www_server_os = $^O;
68
69 # Win98 & NT(SP4)
70
71 if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; }
72
73 # AnHTTPd/Omni/IIS
74
75 if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; }
76
77 # Win Apache
78
79 if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; }
80
81 if($www_server_os=~ /win/i) { return(1); }
82
83 return(0);
84
85 }
86
87
88
89 sub GetScriptPath {
90
91 local($path) = @_;
92
93 if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; }
94
95 $path;
96
97 }
98
99 ## END: Hack for IIS
100
101
102
103 require '../../fckeditor.pl';
104
105
106
107 # When $ENV{'PATH_INFO'} cannot be used by perl.
108
109 # $DefRootPath = "/XXXXX/_samples/perl/sample01.cgi"; Please write in script.
110
111
112
113 my $DefServerPath = "";
114
115 my $ServerPath;
116
117
118
119 $ServerPath = &GetServerPath();
120
121 print "Content-type: text/html\n\n";
122
123 print <<"_HTML_TAG_";
124
125 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
126
127 <html>
128
129 <head>
130
131 <title>FCKeditor - Sample</title>
132
133 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
134
135 <meta name="robots" content="noindex, nofollow">
136
137 <link href="../sample.css" rel="stylesheet" type="text/css" />
138
139 </head>
140
141 <body>
142
143 <h1>FCKeditor - Perl - Sample 1</h1>
144
145 This sample displays a normal HTML form with an FCKeditor with full features
146
147 enabled.
148
149 <hr>
150
151 <form action="sampleposteddata.cgi" method="post" target="_blank">
152
153 _HTML_TAG_
154
155
156
157 #// Automatically calculates the editor base path based on the _samples directory.
158
159 #// This is usefull only for these samples. A real application should use something like this:
160
161 #// $oFCKeditor->BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
162
163
164
165 $sBasePath = $ServerPath;
166
167 $sBasePath = substr($sBasePath,0,index($sBasePath,"_samples"));
168
169 &FCKeditor('FCKeditor1');
170
171 $BasePath = $sBasePath;
172
173 $Value = '<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>';
174
175 &Create();
176
177
178
179 print <<"_HTML_TAG_";
180
181 <br>
182
183 <input type="submit" value="Submit">
184
185 </form>
186
187 </body>
188
189 </html>
190
191 _HTML_TAG_
192
193
194
195 ################
196
197 #Please use this function, rewriting it depending on a server's environment.
198
199 ################
200
201 sub GetServerPath
202
203 {
204
205 my $dir;
206
207
208
209 if($DefServerPath) {
210
211 $dir = $DefServerPath;
212
213 } else {
214
215 if($ENV{'PATH_INFO'}) {
216
217 $dir = $ENV{'PATH_INFO'};
218
219 } elsif($ENV{'FILEPATH_INFO'}) {
220
221 $dir = $ENV{'FILEPATH_INFO'};
222
223 } elsif($ENV{'REQUEST_URI'}) {
224
225 $dir = $ENV{'REQUEST_URI'};
226
227 }
228
229 }
230
231 return($dir);
232
233 }
234
235