function putIcon($fileName, $contentType)
 {
     error_reporting(E_ERROR);
     $dirName = $this->mEnvironment->getDirName();
     $origDirName = $this->mEnvironment->getOrigDirName();
     if (file_exists($fileName)) {
         header('Content-Type: ' . $contentType);
         NBFrame::using('HTTPOutput');
         NBFrameHTTPOutput::staticContentHeader(filemtime($fileName), $fileName . $dirName);
         if ($contentType == 'image/png' && function_exists('imagecreatefrompng') && function_exists('imagecolorallocate') && function_exists('imagestring') && function_exists('imagepng')) {
             $im = imagecreatefrompng($fileName);
             $this->overlayText($im, $dirName, $origDirName);
             imagepng($im);
             imagedestroy($im);
         } else {
             if ($contentType == 'image/gif' && function_exists('imagecreatefromgif') && function_exists('imagecolorallocate') && function_exists('imagestring') && function_exists('imagegif')) {
                 $im = imagecreatefromgif($fileName);
                 $this->overlayText($im, $dirName, $origDirName);
                 imagegif($im);
                 imagedestroy($im);
             } else {
                 $handle = fopen($fileName, 'rb');
                 $content = '';
                 while (!feof($handle)) {
                     $content .= fread($handle, 16384);
                 }
                 header('Content-Length: ' . strlen($content));
                 echo $content;
             }
         }
         exit;
     }
 }
 function putFile($fileName, $contentType, $static = true, $expires = -1, $do_exit = true, $unit = 0)
 {
     error_reporting(E_ERROR);
     if (file_exists($fileName)) {
         $fileSize = filesize($fileName);
         header('Content-Type: ' . $contentType);
         header('Accept-Ranges: bytes');
         if (isset($_SERVER['HTTP_RANGE'])) {
             list($dummy, $start, $end) = preg_split("/[=\\-]/", $_SERVER["HTTP_RANGE"]);
             $start = intval($start);
             if (trim($end) == '') {
                 $end = $fileSize - 1;
             } else {
                 $end = intval($end);
             }
         } else {
             $start = 0;
             $end = $fileSize - 1;
         }
         if (!empty($unit)) {
             if ($start + $unit - 1 < $end) {
                 $end = $start + $unit - 1;
             }
         }
         $partial = 0;
         if ($start != 0 || $end != $fileSize - 1) {
             header('HTTP/1.1 206 Partial Content');
             header('Status: 206 Partial Content');
             header('Content-Range: bytes ' . $start . "-" . $end . '/' . $fileSize);
             $partial = 1;
         }
         if ($partial == 1) {
             $size = $end - $start + 1;
         } else {
             $size = $fileSize;
         }
         header('Content-Length: ' . $size);
         if ($static) {
             header('Content-Disposition: inline; filename="' . basename($fileName) . '"');
             NBFrameHTTPOutput::staticContentHeader(filemtime($fileName), $fileName, $expires);
         } else {
             header('Pragma: no-cache');
             header('Cache-Control: no-store, no-cache, must-revalidate,post-check=0, pre-check=0');
             header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 60) . ' GMT');
             header('Content-Disposition: inline; filename="' . basename($fileName) . '"');
         }
         while (ob_get_level()) {
             ob_end_clean();
         }
         ob_implicit_flush(true);
         $handle = fopen($fileName, 'rb');
         fseek($handle, $start);
         $pos = 0;
         $block = 16384;
         while ($pos < $size) {
             if ($pos + $block > $size) {
                 $block = $size - $pos;
             }
             $pos += $block;
             echo fread($handle, $block);
             flush();
         }
         fclose($handle);
         unset($handle);
         if ($do_exit) {
             exit;
         }
     }
 }