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 executeDefaultOp() { error_reporting(0); $fileName = basename($_GET['file']); $fileName = XOOPS_TRUST_PATH . '/data/kml/' . $fileName; if (!empty($fileName) && file_exists($fileName)) { NBFrame::using('HTTPOutput'); NBFrameHTTPOutput::putFile($fileName, 'application/vnd.google-earth.kml+xml;charset="UTF-8"', false); } }
function executePluginOp() { $fileName = basename($_GET['file']); $place = basename($_GET['place']); switch ($place) { case 'module': $fileName = XOOPS_ROOT_PATH . '/modules/' . $this->mEnvironment->getDirName() . '/plugins/' . $fileName; break; case 'trust': $fileName = XOOPS_TRUST_PATH . '/modules/mygmap/plugins/' . $fileName; break; default: $fileName = ''; } if (!empty($fileName)) { NBFrame::using('HTTPOutput'); NBFrameHTTPOutput::putFile($fileName, 'application/x-javascript;charset="EUC-JP"'); } }
function executeDefaultOp() { error_reporting(E_ERROR); $fileBaseName = basename($_GET['file']); $fileName = $this->mEnvironment->findFile($fileBaseName, '/images', false, '='); if (!empty($fileName) && preg_match('/\\.(jpeg|jpg|gif|png)$/', strtolower($fileBaseName), $match)) { $fileExt = $match[1]; if ($fileExt == 'jpeg' || $fileExt == 'jpg') { $mimeType = 'image/jpeg'; } else { if ($fileExt == 'gif') { $mimeType = 'image/gif'; } else { if ($fileExt == 'png') { $mimeType = 'image/png'; } } } NBFrame::using('HTTPOutput'); NBFrameHTTPOutput::putFile($fileName, $mimeType); } }
function executeDefaultOp() { error_reporting(E_ERROR); if (isset($_GET['NBImgFile'])) { $fileBaseName = basename($_GET['NBImgFile']); } else { if (isset($_GET['file'])) { $fileBaseName = basename($_GET['file']); } else { return; } } $fileName = $this->mEnvironment->findFile($fileBaseName, '/images', false, '='); if (!empty($fileName) && preg_match('/\\.(jpeg|jpg|gif|png|swf)$/', strtolower($fileBaseName), $match)) { $fileExt = $match[1]; if ($fileExt == 'jpeg' || $fileExt == 'jpg') { $mimeType = 'image/jpeg'; } else { if ($fileExt == 'gif') { $mimeType = 'image/gif'; } else { if ($fileExt == 'png') { $mimeType = 'image/png'; } else { if ($fileExt == 'swf') { $mimeType = 'application/x-shockwave-flash'; } } } } NBFrame::using('HTTPOutput'); NBFrameHTTPOutput::putFile($fileName, $mimeType); } else { NBFrame::display404Page(); } }
function staticContentHeader($mod_timestamp, $etag_base = '', $expires = -1) { if (!empty($mod_timestamp)) { $etag = md5($_SERVER["REQUEST_URI"] . $mod_timestamp . $etag_base); header('Pragma:'); header('Etag: "' . $etag . '"'); header('Cache-Control:'); if ($expires == -1) { header('Expires:'); } else { header('Expires: ' . gmdate('D, d M Y H:i:s', time() + intval($expires)) . ' GMT'); } header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $mod_timestamp) . ' GMT'); if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $mod_timestamp == NBFrameHTTPOutput::_str2Time($_SERVER['HTTP_IF_MODIFIED_SINCE']) || !empty($_SERVER['HTTP_IF_NONE_MATCH']) && $etag == $_SERVER['HTTP_IF_NONE_MATCH']) { header('HTTP/1.1 304 Not Modified'); exit; } } }