Changeset 9304

Show
Ignore:
Timestamp:
10/23/08 21:10:50 (3 months ago)
Author:
ryan
Message:

Snoopy 1.2.4

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.6/wp-includes/class-snoopy.php

    r8082 r9304  
    11<?php 
    2 /** 
    3  * Snoopy - the PHP net client 
    4  * @author Monte Ohrt <monte@ispi.net> 
    5  * @copyright 1999-2000 ispi, all rights reserved 
    6  * @version 1.01 
    7  * @license GNU Lesser GPL 
    8  * @link http://snoopy.sourceforge.net/ 
    9  * @package Snoopy 
    10  */ 
    11  
    12 if ( !in_array('Snoopy', get_declared_classes() ) ) : 
    13 /** 
    14  * Snoopy - the PHP net client 
    15  * 
    16  * @author Monte Ohrt <monte@ispi.net> 
    17  * @copyright (c): 1999-2000 ispi, all rights reserved 
    18  * @version 1.01 
    19  * 
     2 
     3/************************************************* 
     4 
     5Snoopy - the PHP net client 
     6Author: Monte Ohrt <monte@ispi.net> 
     7Copyright (c): 1999-2008 New Digital Group, all rights reserved 
     8Version: 1.2.4 
     9 
    2010 * This library is free software; you can redistribute it and/or 
    2111 * modify it under the terms of the GNU Lesser General Public 
     
    3121 * License along with this library; if not, write to the Free Software 
    3222 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    33  * 
    34  * You may contact the author of Snoopy by e-mail at: 
    35  * monte@ispi.net 
    36  * 
    37  * Or, write to: 
    38  * Monte Ohrt 
    39  * CTO, ispi 
    40  * 237 S. 70th suite 220 
    41  * Lincoln, NE 68510 
    42  * 
    43  * @link http://snoopy.sourceforge.net/ The latest version of Snoopy can be 
    44  *      obtained 
    45  */ 
     23 
     24You may contact the author of Snoopy by e-mail at: 
     25monte@ohrt.com 
     26 
     27The latest version of Snoopy can be obtained from: 
     28http://snoopy.sourceforge.net/ 
     29 
     30*************************************************/ 
     31 
    4632class Snoopy 
    4733{ 
    4834    /**** Public variables ****/ 
    49  
     35     
    5036    /* user definable vars */ 
    5137 
     
    5642    var $proxy_user     =   "";                 // proxy user to use 
    5743    var $proxy_pass     =   "";                 // proxy password to use 
    58  
    59     var $agent          =   "Snoopy v1.2.3";  // agent we masquerade as 
     44     
     45    var $agent          =   "Snoopy v1.2.4";  // agent we masquerade as 
    6046    var $referer        =   "";                 // referer info to pass 
    6147    var $cookies        =   array();            // array of cookies to pass 
     
    7460                                                // NOTE: this currently does not respect 
    7561                                                // dates, domains or paths. 
    76  
     62     
    7763    var $user           =   "";                 // user for http authentication 
    7864    var $pass           =   "";                 // password for http authentication 
    79  
     65     
    8066    // http accept types 
    8167    var $accept         =   "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; 
    82  
     68     
    8369    var $results        =   "";                 // where the content is put 
    84  
     70         
    8571    var $error          =   "";                 // error messages sent here 
    8672    var $response_code  =   "";                 // response code returned from server 
    8773    var $headers        =   array();            // headers returned from server sent here 
    88     var $maxlength      =   8192;             // max return data length (body) 
     74    var $maxlength      =   500000;               // max return data length (body) 
    8975    var $read_timeout   =   0;                  // timeout on read operations, in seconds 
    9076                                                // supported only since PHP 4 Beta 4 
     
    10894                                                // as these functions are not stable 
    10995                                                // as of this Snoopy release. 
    110  
    111     /**** Private variables ****/ 
    112  
     96     
     97    /**** Private variables ****/   
     98     
    11399    var $_maxlinelen    =   4096;               // max line length (headers) 
    114  
     100     
    115101    var $_httpmethod    =   "GET";              // default http request method 
    116102    var $_httpversion   =   "HTTP/1.0";         // default http request version 
     
    122108    var $_frameurls     =   array();            // frame src urls 
    123109    var $_framedepth    =   0;                  // increments on frame depth 
    124  
     110     
    125111    var $_isproxy       =   false;              // set if using a proxy server 
    126112    var $_fp_timeout    =   30;                 // timeout for socket connection 
     
    137123    function fetch($URI) 
    138124    { 
    139  
     125     
    140126        //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS); 
    141127        $URI_PARTS = parse_url($URI); 
     
    148134        if (empty($URI_PARTS["path"])) 
    149135            $URI_PARTS["path"] = ''; 
    150  
     136                 
    151137        switch(strtolower($URI_PARTS["scheme"])) 
    152138        { 
     
    168154                        $this->_httprequest($path, $fp, $URI, $this->_httpmethod); 
    169155                    } 
    170  
     156                     
    171157                    $this->_disconnect($fp); 
    172158 
     
    191177                        $frameurls = $this->_frameurls; 
    192178                        $this->_frameurls = array(); 
    193  
     179                         
    194180                        while(list(,$frameurl) = each($frameurls)) 
    195181                        { 
     
    202188                                break; 
    203189                        } 
    204                     } 
     190                    }                   
    205191                } 
    206192                else 
     
    208194                    return false; 
    209195                } 
    210                 return true; 
     196                return true;                    
    211197                break; 
    212198            case "https": 
     
    262248                            break; 
    263249                    } 
    264                 } 
    265                 return true; 
     250                }                   
     251                return true;                    
    266252                break; 
    267253            default: 
     
    270256                return false; 
    271257                break; 
    272         } 
     258        }       
    273259        return true; 
    274260    } 
     
    288274    { 
    289275        unset($postdata); 
    290  
     276         
    291277        $postdata = $this->_prepare_post_body($formvars, $formfiles); 
    292  
     278             
    293279        $URI_PARTS = parse_url($URI); 
    294280        if (!empty($URI_PARTS["user"])) 
     
    320306                        $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); 
    321307                    } 
    322  
     308                     
    323309                    $this->_disconnect($fp); 
    324310 
     
    327313                        /* url was redirected, check if we've hit the max depth */ 
    328314                        if($this->maxredirs > $this->_redirectdepth) 
    329                         { 
     315                        {                       
    330316                            if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) 
    331                                 $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); 
    332  
     317                                $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);                         
     318                             
    333319                            // only follow redirect if it's on this site, or offsiteok is true 
    334320                            if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) 
     
    349335                        $frameurls = $this->_frameurls; 
    350336                        $this->_frameurls = array(); 
    351  
     337                         
    352338                        while(list(,$frameurl) = each($frameurls)) 
    353                         { 
     339                        {                                                       
    354340                            if($this->_framedepth < $this->maxframes) 
    355341                            { 
     
    360346                                break; 
    361347                        } 
    362                     } 
    363  
     348                    }                   
     349                     
    364350                } 
    365351                else 
     
    367353                    return false; 
    368354                } 
    369                 return true; 
     355                return true;                    
    370356                break; 
    371357            case "https": 
     
    394380                    /* url was redirected, check if we've hit the max depth */ 
    395381                    if($this->maxredirs > $this->_redirectdepth) 
    396                     { 
     382                    {                       
    397383                        if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) 
    398                             $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); 
     384                            $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);                         
    399385 
    400386                        // only follow redirect if it's on this site, or offsiteok is true 
     
    418404 
    419405                    while(list(,$frameurl) = each($frameurls)) 
    420                     { 
     406                    {                                                       
    421407                        if($this->_framedepth < $this->maxframes) 
    422408                        { 
     
    427413                            break; 
    428414                    } 
    429                 } 
    430                 return true; 
     415                }                   
     416                return true;                    
    431417                break; 
    432  
     418                 
    433419            default: 
    434420                // not a valid protocol 
     
    436422                return false; 
    437423                break; 
    438         } 
     424        }       
    439425        return true; 
    440426    } 
     
    450436    { 
    451437        if ($this->fetch($URI)) 
    452         { 
     438        {           
    453439            if($this->lastredirectaddr) 
    454440                $URI = $this->lastredirectaddr; 
     
    478464    function fetchform($URI) 
    479465    { 
    480  
     466         
    481467        if ($this->fetch($URI)) 
    482         { 
     468        {           
    483469 
    484470            if(is_array($this->results)) 
     
    489475            else 
    490476                $this->results = $this->_stripform($this->results); 
    491  
     477             
    492478            return true; 
    493479        } 
     
    495481            return false; 
    496482    } 
    497  
    498  
     483     
     484     
    499485/*======================================================================*\ 
    500486    Function:   fetchtext 
     
    507493    { 
    508494        if($this->fetch($URI)) 
    509         { 
     495        {           
    510496            if(is_array($this->results)) 
    511497            { 
     
    531517    { 
    532518        if($this->submit($URI,$formvars, $formfiles)) 
    533         { 
     519        {           
    534520            if($this->lastredirectaddr) 
    535521                $URI = $this->lastredirectaddr; 
     
    565551    { 
    566552        if($this->submit($URI,$formvars, $formfiles)) 
    567         { 
     553        {           
    568554            if($this->lastredirectaddr) 
    569555                $URI = $this->lastredirectaddr; 
     
    589575    } 
    590576 
    591  
     577     
    592578 
    593579/*======================================================================*\ 
     
    601587    } 
    602588 
    603  
     589     
    604590/*======================================================================*\ 
    605591    Function:   set_submit_normal 
     
    612598    } 
    613599 
    614  
    615  
     600     
     601     
    616602 
    617603/*======================================================================*\ 
    618604    Private functions 
    619605\*======================================================================*/ 
    620  
    621  
     606     
     607     
    622608/*======================================================================*\ 
    623609    Function:   _striplinks 
     
    628614 
    629615    function _striplinks($document) 
    630     { 
     616    {   
    631617        preg_match_all("'<\s*a\s.*?href\s*=\s*          # find <a href= 
    632618                        ([\"\'])?                   # find single or double quote 
     
    634620                                                    # quote, otherwise match up to next space 
    635621                        'isx",$document,$links); 
    636  
     622                         
    637623 
    638624        // catenate the non-empty matches from the conditional subpattern 
     
    642628            if(!empty($val)) 
    643629                $match[] = $val; 
    644         } 
    645  
     630        }               
     631         
    646632        while(list($key,$val) = each($links[3])) 
    647633        { 
    648634            if(!empty($val)) 
    649635                $match[] = $val; 
    650         } 
    651  
     636        }       
     637         
    652638        // return the links 
    653639        return $match; 
     
    662648 
    663649    function _stripform($document) 
    664     { 
     650    {   
    665651        preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements); 
    666  
     652         
    667653        // catenate the matches 
    668654        $match = implode("\r\n",$elements[0]); 
    669  
     655                 
    670656        // return the links 
    671657        return $match; 
    672658    } 
    673659 
    674  
    675  
     660     
     661     
    676662/*======================================================================*\ 
    677663    Function:   _striptext 
     
    683669    function _striptext($document) 
    684670    { 
    685  
     671         
    686672        // I didn't use preg eval (//e) since that is only available in PHP 4.0. 
    687673        // so, list your entities one by one here. I included some of the 
    688674        // more common ones. 
    689  
     675                                 
    690676        $search = array("'<script[^>]*?>.*?</script>'si",   // strip out javascript 
    691677                        "'<[\/\!]*?[^<>]*?>'si",            // strip out html tags 
     
    728714                            chr(39), 
    729715                            chr(128), 
    730                             "ä", 
    731                             "ö", 
    732                             "ü", 
    733                             "Ä", 
    734                             "Ö", 
    735                             "Ü", 
    736                             "ß", 
     716                            "� 
     717                            "�                          "�                  "�, 
     718                            "�, 
     719                            "�, 
     720                            "�, 
    737721                        ); 
    738  
     722                     
    739723        $text = preg_replace($search,$replace,$document); 
    740  
     724                                 
    741725        return $text; 
    742726    } 
     
    752736    function _expandlinks($links,$URI) 
    753737    { 
    754  
     738         
    755739        preg_match("/^[^\?]+/",$URI,$match); 
    756740 
     
    760744        $match_root = 
    761745        $match_part["scheme"]."://".$match_part["host"]; 
    762  
     746                 
    763747        $search = array(    "|^http://".preg_quote($this->host)."|i", 
    764748                            "|^(\/)|i", 
     
    767751                            "|/[^\/]+/\.\./|" 
    768752                        ); 
    769  
     753                         
    770754        $replace = array(   "", 
    771755                            $match_root."/", 
     
    773757                            "/", 
    774758                            "/" 
    775                         ); 
    776  
     759                        );          
     760                 
    777761        $expandedLinks = preg_replace($search,$replace,$links); 
    778762 
     
    787771                $URI        the full URI 
    788772                $body       body contents to send if any (POST) 
    789     Output: 
    790 \*======================================================================*/ 
    791  
     773    Output:         
     774\*======================================================================*/ 
     775     
    792776    function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") 
    793777    { 
     
    795779        if($this->passcookies && $this->_redirectaddr) 
    796780            $this->setcookies(); 
    797  
     781             
    798782        $URI_PARTS = parse_url($URI); 
    799783        if(empty($url)) 
    800784            $url = "/"; 
    801         $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; 
     785        $headers = $http_method." ".$url." ".$this->_httpversion."\r\n";        
    802786        if(!empty($this->agent)) 
    803787            $headers .= "User-Agent: ".$this->agent."\r\n"; 
    804788        if(!empty($this->host) && !isset($this->rawheaders['Host'])) { 
    805789            $headers .= "Host: ".$this->host; 
    806             if(!empty($this->port) && $this->port != 80
     790            if(!empty($this->port)
    807791                $headers .= ":".$this->port; 
    808792            $headers .= "\r\n"; 
     
    813797            $headers .= "Referer: ".$this->referer."\r\n"; 
    814798        if(!empty($this->cookies)) 
    815         { 
     799        {           
    816800            if(!is_array($this->cookies)) 
    817801                $this->cookies = (array)$this->cookies; 
    818  
     802     
    819803            reset($this->cookies); 
    820804            if ( count($this->cookies) > 0 ) { 
     
    824808                } 
    825809                $headers .= substr($cookie_headers,0,-2) . "\r\n"; 
    826             } 
     810            }  
    827811        } 
    828812        if(!empty($this->rawheaders)) 
     
    839823            $headers .= "\r\n"; 
    840824        } 
    841         if(!empty($body)) 
     825        if(!empty($body))   
    842826            $headers .= "Content-length: ".strlen($body)."\r\n"; 
    843         if(!empty($this->user) || !empty($this->pass)) 
     827        if(!empty($this->user) || !empty($this->pass))  
    844828            $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; 
    845  
     829         
    846830        //add proxy auth headers 
    847         if(!empty($this->proxy_user)) 
     831        if(!empty($this->proxy_user))   
    848832            $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; 
    849833 
    850834 
    851835        $headers .= "\r\n"; 
    852  
     836         
    853837        // set the read timeout if needed 
    854838        if ($this->read_timeout > 0) 
    855839            socket_set_timeout($fp, $this->read_timeout); 
    856840        $this->timed_out = false; 
    857  
     841         
    858842        fwrite($fp,$headers.$body,strlen($headers.$body)); 
    859  
     843         
    860844        $this->_redirectaddr = false; 
    861845        unset($this->headers); 
    862  
     846                         
    863847        while($currentHeader = fgets($fp,$this->_maxlinelen)) 
    864848        { 
     
    868852                return false; 
    869853            } 
    870  
     854                 
    871855            if($currentHeader == "\r\n") 
    872856                break; 
    873  
     857                         
    874858            // if a header begins with Location: or URI:, set the redirect 
    875859            if(preg_match("/^(Location:|URI:)/i",$currentHeader)) 
     
    891875                    $this->_redirectaddr = $matches[2]; 
    892876            } 
    893  
     877         
    894878            if(preg_match("|^HTTP/|",$currentHeader)) 
    895879            { 
     
    897881                { 
    898882                    $this->status= $status[1]; 
    899                 } 
     883                }               
    900884                $this->response_code = $currentHeader; 
    901885            } 
    902  
     886                 
    903887            $this->headers[] = $currentHeader; 
    904888        } 
     
    918902            return false; 
    919903        } 
    920  
     904         
    921905        // check if there is a a redirect meta tag 
    922  
     906         
    923907        if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) 
    924908 
    925909        { 
    926             $this->_redirectaddr = $this->_expandlinks($match[1],$URI); 
     910            $this->_redirectaddr = $this->_expandlinks($match[1],$URI);     
    927911        } 
    928912 
     
    940924        else 
    941925            $this->results = $results; 
    942  
     926         
    943927        return true; 
    944928    } 
     
    950934                $URI        the full URI 
    951935                $body       body contents to send if any (POST) 
    952     Output: 
    953 \*======================================================================*/ 
    954  
     936    Output:         
     937\*======================================================================*/ 
     938     
    955939    function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") 
    956     { 
     940    {   
    957941        if($this->passcookies && $this->_redirectaddr) 
    958942            $this->setcookies(); 
    959943 
    960         $headers = array(); 
    961  
     944        $headers = array();         
     945                     
    962946        $URI_PARTS = parse_url($URI); 
    963947        if(empty($url)) 
    964948            $url = "/"; 
    965949        // GET ... header not needed for curl 
    966         //$headers[] = $http_method." ".$url." ".$this->_httpversion; 
     950        //$headers[] = $http_method." ".$url." ".$this->_httpversion;       
    967951        if(!empty($this->agent)) 
    968952            $headers[] = "User-Agent: ".$this->agent; 
     
    977961            $headers[] = "Referer: ".$this->referer; 
    978962        if(!empty($this->cookies)) 
    979         { 
     963        {           
    980964            if(!is_array($this->cookies)) 
    981965                $this->cookies = (array)$this->cookies; 
    982  
     966     
    983967            reset($this->cookies); 
    984968            if ( count($this->cookies) > 0 ) { 
     
    1003987                $headers[] = "Content-type: $content_type"; 
    1004988        } 
    1005         if(!empty($body)) 
     989        if(!empty($body))   
    1006990            $headers[] = "Content-length: ".strlen($body); 
    1007         if(!empty($this->user) || !empty($this->pass)) 
     991        if(!empty($this->user) || !empty($this->pass))  
    1008992            $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); 
    1009  
     993             
    1010994        for($curr_header = 0; $curr_header < count($headers); $curr_header++) { 
    1011995            $safer_header = strtr( $headers[$curr_header], "\"", " " ); 
    1012996            $cmdline_params .= " -H \"".$safer_header."\""; 
    1013997        } 
    1014  
     998         
    1015999        if(!empty($body)) 
    10161000            $cmdline_params .= " -d \"$body\""; 
    1017  
     1001         
    10181002        if($this->read_timeout > 0) 
    10191003            $cmdline_params .= " -m ".$this->read_timeout; 
    1020  
     1004         
    10211005        $headerfile = tempnam($temp_dir, "sno"); 
    10221006 
    1023         $safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access 
    1024         exec(escapeshellcmd($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\""),$results,$return); 
    1025  
     1007        exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($URI)."\"",$results,$return); 
     1008         
    10261009        if($return) 
    10271010        { 
     
    10291012            return false; 
    10301013        } 
    1031  
    1032  
     1014             
     1015             
    10331016        $results = implode("\r\n",$results); 
    1034  
     1017         
    10351018        $result_headers = file("$headerfile"); 
    1036  
     1019                         
    10371020        $this->_redirectaddr = false; 
    10381021        unset($this->headers); 
    1039  
     1022                         
    10401023        for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) 
    10411024        { 
    1042  
     1025             
    10431026            // if a header begins with Location: or URI:, set the redirect 
    10441027            if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) 
     
    10601043                    $this->_redirectaddr = $matches[2]; 
    10611044            } 
    1062  
     1045         
    10631046            if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) 
    10641047                $this->response_code = $result_headers[$currentHeader]; 
     
    10681051 
    10691052        // check if there is a a redirect meta tag 
    1070  
     1053         
    10711054        if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) 
    10721055        { 
    1073             $this->_redirectaddr = $this->_expandlinks($match[1],$URI); 
     1056            $this->_redirectaddr = $this->_expandlinks($match[1],$URI);     
    10741057        } 
    10751058 
     
    10891072 
    10901073        unlink("$headerfile"); 
    1091  
     1074         
    10921075        return true; 
    10931076    } 
     
    10971080    Purpose:    set cookies for a redirection 
    10981081\*======================================================================*/ 
    1099  
     1082     
    11001083    function setcookies() 
    11011084    { 
     
    11071090    } 
    11081091 
    1109  
     1092     
    11101093/*======================================================================*\ 
    11111094    Function:   _check_timeout 
     
    11311114    Input:      $fp file pointer 
    11321115\*======================================================================*/ 
    1133  
     1116     
    11341117    function _connect(&$fp) 
    11351118    { 
     
    11371120            { 
    11381121                $this->_isproxy = true; 
    1139  
     1122                 
    11401123                $host = $this->proxy_host; 
    11411124                $port = $this->proxy_port; 
     
    11461129            $port = $this->port; 
    11471130        } 
    1148  
     1131     
    11491132        $this->status = 0; 
    1150  
     1133         
    11511134        if($fp = fsockopen( 
    11521135                    $host, 
     
    11841167    Input:      $fp file pointer 
    11851168\*======================================================================*/ 
    1186  
     1169     
    11871170    function _disconnect($fp) 
    11881171    { 
     
    11901173    } 
    11911174 
    1192  
     1175     
    11931176/*======================================================================*\ 
    11941177    Function:   _prepare_post_body 
     
    11981181    Output:     post body 
    11991182\*======================================================================*/ 
    1200  
     1183     
    12011184    function _prepare_post_body($formvars, $formfiles) 
    12021185    { 
     
    12071190        if (count($formvars) == 0 && count($formfiles) == 0) 
    12081191            return; 
    1209  
     1192         
    12101193        switch ($this->_submit_type) { 
    12111194            case "application/x-www-form-urlencoded": 
     
    12231206            case "multipart/form-data": 
    12241207                $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); 
    1225  
     1208                 
    12261209                reset($formvars); 
    12271210                while(list($key,$val) = each($formvars)) { 
     
    12381221                    } 
    12391222                } 
    1240  
     1223                 
    12411224                reset($formfiles); 
    12421225                while (list($field_name, $file_names) = each($formfiles)) { 
     
    12461229 
    12471230                        $fp = fopen($file_name, "r"); 
    1248                         while (!feof($fp)) { 
    1249                             $file_content .= fread($fp, filesize($file_name)); 
    1250                         } 
     1231                        $file_content = fread($fp, filesize($file_name)); 
    12511232                        fclose($fp); 
    12521233                        $base_name = basename($file_name); 
     
    12641245    } 
    12651246} 
    1266 endif; 
    12671247 
    12681248?>