[ Index ] |
|
Code source de FCKeditor 2.4 |
1 #!/usr/bin/env perl 2 3 ##### 4 # FCKeditor - The text editor for Internet - http://www.fckeditor.net 5 # Copyright (C) 2003-2007 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 # File Name: sample01.cgi 24 # Sample page. 25 # 26 # File Authors: 27 # Takashi Yamaguchi (jack@omakase.net) 28 ##### 29 30 ## START: Hack for Windows (Not important to understand the editor code... Perl specific). 31 if(Windows_check()) { 32 chdir(GetScriptPath($0)); 33 } 34 35 sub Windows_check 36 { 37 # IIS,PWS(NT/95) 38 $www_server_os = $^O; 39 # Win98 & NT(SP4) 40 if($www_server_os eq "") { $www_server_os= $ENV{'OS'}; } 41 # AnHTTPd/Omni/IIS 42 if($ENV{'SERVER_SOFTWARE'} =~ /AnWeb|Omni|IIS\//i) { $www_server_os= 'win'; } 43 # Win Apache 44 if($ENV{'WINDIR'} ne "") { $www_server_os= 'win'; } 45 if($www_server_os=~ /win/i) { return(1); } 46 return(0); 47 } 48 49 sub GetScriptPath { 50 local($path) = @_; 51 if($path =~ /[\:\/\\]/) { $path =~ s/(.*?)[\/\\][^\/\\]+$/$1/; } else { $path = '.'; } 52 $path; 53 } 54 ## END: Hack for IIS 55 56 require '../../fckeditor.pl'; 57 58 # When $ENV{'PATH_INFO'} cannot be used by perl. 59 # $DefRootPath = "/XXXXX/_samples/perl/sample01.cgi"; Please write in script. 60 61 my $DefServerPath = ""; 62 my $ServerPath; 63 64 $ServerPath = &GetServerPath(); 65 print "Content-type: text/html\n\n"; 66 print <<"_HTML_TAG_"; 67 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 68 <html> 69 <head> 70 <title>FCKeditor - Sample</title> 71 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 72 <meta name="robots" content="noindex, nofollow"> 73 <link href="../sample.css" rel="stylesheet" type="text/css" /> 74 </head> 75 <body> 76 <h1>FCKeditor - Perl - Sample 1</h1> 77 This sample displays a normal HTML form with an FCKeditor with full features 78 enabled. 79 <hr> 80 <form action="sampleposteddata.cgi" method="post" target="_blank"> 81 _HTML_TAG_ 82 83 #// Automatically calculates the editor base path based on the _samples directory. 84 #// This is usefull only for these samples. A real application should use something like this: 85 #// $oFCKeditor->BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. 86 87 $sBasePath = $ServerPath; 88 $sBasePath = substr($sBasePath,0,index($sBasePath,"_samples")); 89 &FCKeditor('FCKeditor1'); 90 $BasePath = $sBasePath; 91 $Value = 'This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.'; 92 &Create(); 93 94 print <<"_HTML_TAG_"; 95 <br> 96 <input type="submit" value="Submit"> 97 </form> 98 </body> 99 </html> 100 _HTML_TAG_ 101 102 ################ 103 #Please use this function, rewriting it depending on a server's environment. 104 ################ 105 sub GetServerPath 106 { 107 my $dir; 108 109 if($DefServerPath) { 110 $dir = $DefServerPath; 111 } else { 112 if($ENV{'PATH_INFO'}) { 113 $dir = $ENV{'PATH_INFO'}; 114 } elsif($ENV{'FILEPATH_INFO'}) { 115 $dir = $ENV{'FILEPATH_INFO'}; 116 } 117 } 118 return($dir); 119 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |