[ Index ]
 

Code source de FCKeditor 2.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/_samples/perl/ -> sampleposteddata.cgi (source)

   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: sampleposteddata.cgi
  24  #      This page lists the data posted by a form.
  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      if($ENV{'REQUEST_METHOD'} eq "POST") {
  59          read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  60      } else {
  61          $buffer = $ENV{'QUERY_STRING'};
  62      }
  63      @pairs = split(/&/,$buffer);
  64      foreach $pair (@pairs) {
  65          ($name,$value) = split(/=/,$pair);
  66          $value =~ tr/+/ /;
  67          $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  68          $value =~ s/\t//g;
  69          $value =~ s/\r\n/\n/g;
  70          $FORM{$name} .= "\0"            if(defined($FORM{$name}));
  71          $FORM{$name} .= $value;
  72      }
  73  
  74      print "Content-type: text/html\n\n";
  75      print <<"_HTML_TAG_";
  76  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  77  
  78  <html>
  79      <head>
  80          <title>FCKeditor - Samples - Posted Data</title>
  81          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  82          <meta name="robots" content="noindex, nofollow">
  83          <link href="../sample.css" rel="stylesheet" type="text/css" />
  84      </head>
  85      <body>
  86          <h1>FCKeditor - Samples - Posted Data</h1>
  87          This page lists all data posted by the form.
  88          <hr>
  89          <table width="100%" border="1" cellspacing="0" bordercolor="#999999">
  90              <tr style="FONT-WEIGHT: bold; COLOR: #dddddd; BACKGROUND-COLOR: #999999">
  91                  <td nowrap>Field Name&nbsp;&nbsp;</td>
  92                  <td>Value</td>
  93              </tr>
  94  _HTML_TAG_
  95  
  96      foreach $key (keys %FORM) {
  97          $postedValue = &specialchar_cnv($FORM{$key});
  98          print <<"_HTML_TAG_";
  99              <tr>
 100                  <td valign="top" nowrap><b>$key</b></td>
 101                  <td width="100%">$postedValue</td>
 102              </tr>
 103  _HTML_TAG_
 104      }
 105          print <<"_HTML_TAG_";
 106          </table>
 107      </body>
 108  </html>
 109  _HTML_TAG_


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7