framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php
public static function sendWithXSendfile ( $filePath ){
      if ( stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== FALSE ){
        $fallback = true;
        $config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        $XSendfileNginx = $config->getXSendfileNginx();
        foreach ( $XSendfileNginx as $location => $root){
          if ( false !== stripos($filePath , $root) ){
            $fallback = false;
            $filePath = str_ireplace($root,$location,$filePath);
            header("X-Accel-Redirect: ".$filePath); // Nginx
            break;
          }
        }
        // fallback to standar method
        if ( $fallback ){
          CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
        }
      } elseif ( stripos($_SERVER['SERVER_SOFTWARE'], 'lighttpd/1.4') !== FALSE ){
        header("X-LIGHTTPD-send-file: ".$filePath); // Lighttpd v1.4
      } else {
        header("X-Sendfile: ".$filePath); // Apache, Lighttpd v1.5, Cherokee
      }
    }
public static function sendWithXSendfile ( $filePath ){
      if ( stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== FALSE ){
        $fallback = true;
        $config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        $XSendfileNginx = $config->getXSendfileNginx();
        foreach ( $XSendfileNginx as $location => $root){
          if ( false !== stripos($filePath , $root) ){
            $fallback = false;
            $filePath = str_ireplace($root,$location,$filePath);
            header("X-Accel-Redirect: ".$filePath); // Nginx
            break;
          }
        }
        // fallback to standar method
        if ( $fallback ){
          CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
        }
      } elseif ( stripos($_SERVER['SERVER_SOFTWARE'], 'lighttpd/1.4') !== FALSE ){
        header("X-LIGHTTPD-send-file: ".$filePath); // Lighttpd v1.4
      } else {
        header("X-Sendfile: ".$filePath); // Apache, Lighttpd v1.5, Cherokee
      }
    }
public static function sendWithXSendfile ( $ filePath ) { if ( stripos ( $ _SERVER [ 'SERVER_SOFTWARE' ] , 'nginx' ) !== FALSE ) { $ fallback = true ; $ config = & CKFinder_Connector_Core_Factory :: getInstance ( "Core_Config" ) ; $ XSendfileNginx = $ config -> getXSendfileNginx ( ) ; foreach ( $ XSendfileNginx as $ location => $ root ) { if ( false !== stripos ( $ filePath , $ root ) ) { $ fallback = false ; $ filePath = str_ireplace ( $ root , $ location , $ filePath ) ; header ( "X-Accel-Redirect: " . $ filePath ) ; // Nginx break ; } } // fallback to standar method if ( $ fallback ) { CKFinder_Connector_Utils_FileSystem :: readfileChunked ( $ filePath ) ; } } elseif ( stripos ( $ _SERVER [ 'SERVER_SOFTWARE' ] , 'lighttpd/1.4' ) !== FALSE ) { header ( "X-LIGHTTPD-send-file: " . $ filePath ) ; // Lighttpd v1.4 } else { header ( "X-Sendfile: " . $ filePath ) ; // Apache, Lighttpd v1.5, Cherokee } }
Send files using X-Sendfile server module

@param string $filePath
Send files using X - Sendfile server module