예제 #1
0
}
# Do we want to parse the file?
if ($fetch->parseType) {
    /*****************************************************************
     * Apply the relevant parsing methods to the document
     ******************************************************************/
    # Decode gzip compressed content
    if (isset($fetch->headers['content-encoding']) && $fetch->headers['content-encoding'] == 'gzip') {
        if (function_exists('gzinflate')) {
            unset($fetch->headers['content-encoding']);
            $document = gzinflate(substr($document, 10, -8));
        }
    }
    # Apply preparsing from plugins
    if ($foundPlugin && function_exists('preParse')) {
        $document = preParse($document, $fetch->parseType);
    }
    # Load the main parser
    require GLYPE_ROOT . '/includes/parser.php';
    # Create new instance, passing in the options that affect parsing
    $parser = new parser($options, $jsFlags);
    # Method of parsing depends on $parseType
    switch ($fetch->parseType) {
        # HTML document
        case 'html':
            # Do we want to insert our own code into the document?
            $inject = $footer = $insert = false;
            # Mini-form only if NOT frame or sniffed
            if ($flag != 'frame' && $fetch->sniff == false) {
                # Showing the mini-form?
                if ($options['showForm']) {
예제 #2
0
파일: browse.php 프로젝트: hw-1/webproxy
 // Remove elements
 $parserOptions['toRemove'] = optREMOVE;
 if ($options['stripImages']) {
     $parserOptions['toRemove'] .= (optREMOVE ? '|' : '') . 'img';
 }
 // Define remaining options
 $parserOptions['addForm'] = '';
 $parserOptions['stripJS'] = $options['stripJS'];
 $parserOptions['stripFlash'] = $options['stripFlash'];
 $parserOptions['encodeURL'] = $options['encodeURL'];
 ##########################################
 ## Parse and send output
 ##########################################
 # Do the preparsing
 if (!empty($foundPlugin) && function_exists('preParse')) {
     $fetch->return = preParse($fetch->return, $fetch->docType);
 }
 # Load main parser
 require proxyINC . 'parser.php';
 # Dependent on content
 switch ($fetch->docType) {
     # HTML document
     case 'html':
         // Is this a full document? Yes unless ajax
         $fullDoc = $flag != 'ajax';
         header('Content-Type: text/html; charset=utf-8');
         // Add in the include form
         if ($options['showForm'] && $flag != 'frame' && $flag != 'ajax') {
             // Determine options to display
             $toShow = array();
             foreach ($optionsDetails as $name => $details) {