当前位置: 首页>>代码示例>>PHP>>正文


PHP CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding方法代码示例

本文整理汇总了PHP中CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding方法的典型用法代码示例。如果您正苦于以下问题:PHP CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding方法的具体用法?PHP CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding怎么用?PHP CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKFinder_Connector_Utils_FileSystem的用法示例。


在下文中一共展示了CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_CREATE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
     $sNewFolderName = isset($_GET["NewFolderName"]) ? $_GET["NewFolderName"] : "";
     $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($sNewFolderName);
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($sNewFolderName) || $_resourceTypeConfig->checkIsHiddenFolder($sNewFolderName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $sServerDir = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $sNewFolderName);
     if (!is_writeable($this->_currentFolder->getServerPath())) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     $bCreated = false;
     if (file_exists($sServerDir)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     }
     if ($perms = $_config->getChmodFolders()) {
         $oldUmask = umask(0);
         $bCreated = @mkdir($sServerDir, $perms);
         umask($oldUmask);
     } else {
         $bCreated = @mkdir($sServerDir);
     }
     if (!$bCreated) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     } else {
         $oNewFolderNode = new Ckfinder_Connector_Utils_XmlNode("NewFolder");
         $this->_connectorNode->addChild($oNewFolderNode);
         $oNewFolderNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sNewFolderName));
     }
 }
开发者ID:vcgato29,项目名称:poff,代码行数:40,代码来源:CreateFolder.php

示例2: sendResponse

 /**
  * send response (file)
  * @access public
  *
  */
 function sendResponse()
 {
     if (!function_exists('ob_list_handlers') || !ob_list_handlers()) {
         @ob_end_clean();
     }
     header("Content-Encoding: none");
     $this->checkConnector();
     $this->checkRequest();
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
     $_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$_resourceTypeInfo->checkExtension($fileName, false)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if ($_resourceTypeInfo->checkIsHiddenFile($fileName) || !file_exists($filePath) || !is_file($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName);
     header("Cache-Control: cache, must-revalidate");
     header("Pragma: public");
     header("Expires: 0");
     header("Content-type: application/octet-stream; name=\"" . $fileName . "\"");
     header("Content-Disposition: attachment; filename=\"" . str_replace("\"", "\\\"", $fileName) . "\"");
     header("Content-Length: " . filesize($filePath));
     CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
     exit;
 }
开发者ID:BGCX067,项目名称:facebooksurveyom-svn-to-git,代码行数:38,代码来源:DownloadFile.php

示例3: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 function buildXml()
 {
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (!isset($_GET["FileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
     $_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $_resourceTypeInfo->checkIsHiddenFile($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$_resourceTypeInfo->checkExtension($fileName, false)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     $bDeleted = false;
     if (!file_exists($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     if (!@unlink($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     } else {
         $bDeleted = true;
     }
     if ($bDeleted) {
         $thumbPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getThumbsServerPath(), $fileName);
         @unlink($thumbPath);
         $oDeleteFileNode = new Ckfinder_Connector_Utils_XmlNode("DeletedFile");
         $this->_connectorNode->addChild($oDeleteFileNode);
         $oDeleteFileNode->addAttribute("name", $fileName);
     }
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:39,代码来源:DeleteFile.php

示例4: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 function buildXml()
 {
     if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_RENAME)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (!isset($_GET["fileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     if (!isset($_GET["newFileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
     $newFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["newFileName"]);
     $oRenamedFileNode = new Ckfinder_Connector_Utils_XmlNode("RenamedFile");
     $this->_connectorNode->addChild($oRenamedFileNode);
     $oRenamedFileNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName));
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!$resourceTypeInfo->checkExtension($newFileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($newFileName) || $resourceTypeInfo->checkIsHiddenFile($newFileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     if (!$resourceTypeInfo->checkExtension($fileName, false)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if ($_config->forceAscii()) {
         $newFileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($newFileName);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     $newFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $newFileName);
     $bMoved = false;
     if (!file_exists($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     if (!is_writable(dirname($newFilePath))) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     if (!is_writable($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     if (file_exists($newFilePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     }
     $bMoved = @rename($filePath, $newFilePath);
     if (!$bMoved) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNKNOWN, "File " . CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName) . "has not been renamed");
     } else {
         $oRenamedFileNode->addAttribute("newName", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFileName));
         $thumbPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getThumbsServerPath(), $fileName);
         CKFinder_Connector_Utils_FileSystem::unlink($thumbPath);
     }
 }
开发者ID:kevinsmasters,项目名称:purecatskillsmarketplace,代码行数:65,代码来源:RenameFile.php

示例5: buildXml

 function buildXml()
 {
     // A "must have", checking whether the connector is enabled and the basic parameters (like current folder) are safe.
     $this->checkConnector();
     $this->checkRequest();
     // Checking ACL permissions, we're just getting an information about a file, so FILE_VIEW permission seems to be ok.
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     // Make sure we actually received a file name
     if (!isset($_GET["fileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     // Use the resource type configuration object to check whether the extension of a file to check is really allowed.
     if (!$resourceTypeInfo->checkExtension($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
     }
     // Make sure that the file name is really ok and has not been sent by a hacker
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if (!file_exists($filePath) || !is_file($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     //set session values to be check by process.php upon returning from pixlr.com
     $maketoken = md5(session_id());
     ///////////////////
     //HACK KOEZIONCMS//
     $thumbFolder = $this->_currentFolder->getThumbsServerPath();
     $pixlrSession = array('token' => substr($maketoken, 0, 16), 'ImagePath' => $filePath, 'clientImagePath' => $this->_currentFolder->getUrl(), 'fileName' => $fileName, 'return' => $_SERVER['HTTP_REFERER'], 'thumbLocation' => $thumbFolder . $fileName);
     Session::write('Pixlr', $pixlrSession);
     //$_SESSION['pixlr']['token'] = substr($maketoken,0,16);
     //$_SESSION['pixlr']['ImagePath'] = $filePath;
     //$_SESSION['pixlr']['clientImagePath'] = $this->_currentFolder->getUrl(); // ie: /CMSfiles/images/subdirectory/
     //$_SESSION['pixlr']['fileName'] = $fileName;
     //$_SESSION['pixlr']['return'] = $_SERVER['HTTP_REFERER'];
     //$thumbFolder = $this->_currentFolder->getThumbsServerPath();
     //$_SESSION['pixlr']['thumbLocation'] = $thumbFolder . $fileName;
     //get the client-side absolute path to the image being edited
     //$absolute_filePath = "http://".$_SERVER['HTTP_HOST'].$_SESSION['pixlr']['clientImagePath'].$_SESSION['pixlr']['fileName'];
     $absolute_filePath = "http://" . $_SERVER['HTTP_HOST'] . $pixlrSession['clientImagePath'] . $pixlrSession['fileName'];
     //get teh directory this plugin is in so we can return to the process.php script in this folder
     $pluginFolder = dirname(__FILE__);
     //the directory holding this plugin
     //make the directory a client-side absolute URL
     $clientPluginFolder = preg_replace("@" . $_SERVER['DOCUMENT_ROOT'] . "@", "http://" . $_SERVER['HTTP_HOST'], $pluginFolder);
     //parameters to send to pixlr.com
     $pixlr_params = array("referrer" => $_SERVER['HTTP_HOST'], "loc" => "en", "exit" => $_SERVER['HTTP_REFERER'] != "" ? urlencode($_SERVER['HTTP_REFERER']) : "http://www.pixlr.com", "image" => $absolute_filePath, "title" => $fileName, "method" => "GET", "target" => urlencode($clientPluginFolder . "/process.php?token=" . $pixlrSession['token']), "locktarget" => "TRUE", "locktitle" => "TRUE", "locktype" => "TRUE", "lockquality" => "80");
     $pixlr_link = "http://www.pixlr.com/editor?";
     foreach ($pixlr_params as $key => $val) {
         $pixlr_link .= $key . "=" . $val . "&";
     }
     $pixlr_link = rtrim($pixlr_link, "&");
     $oNode = new Ckfinder_Connector_Utils_XmlNode("Pixlr");
     $oNode->addAttribute("pixlr_link", $pixlr_link);
     $this->_connectorNode->addChild($oNode);
 }
开发者ID:strifefrosst,项目名称:koeZionCMS,代码行数:60,代码来源:plugin.php

示例6: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 function buildXml()
 {
     if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_RENAME)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (!isset($_GET["NewFolderName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["NewFolderName"]);
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if ($_config->forceAscii()) {
         $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($newFolderName);
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($newFolderName) || $resourceTypeInfo->checkIsHiddenFolder($newFolderName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     // The root folder cannot be deleted.
     if ($this->_currentFolder->getClientPath() == "/") {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $oldFolderPath = $this->_currentFolder->getServerPath();
     $bMoved = false;
     if (!is_dir($oldFolderPath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     //let's calculate new folder name
     $newFolderPath = dirname($oldFolderPath) . DIRECTORY_SEPARATOR . $newFolderName . DIRECTORY_SEPARATOR;
     if (file_exists(rtrim($newFolderPath, DIRECTORY_SEPARATOR))) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     }
     if (eregi("\\.", basename($newFolderPath))) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     $bMoved = @rename($oldFolderPath, $newFolderPath);
     if (!$bMoved) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     } else {
         $newThumbsServerPath = dirname($this->_currentFolder->getThumbsServerPath()) . '/' . $newFolderName . '/';
         if (!@rename($this->_currentFolder->getThumbsServerPath(), $newThumbsServerPath)) {
             CKFinder_Connector_Utils_FileSystem::unlink($this->_currentFolder->getThumbsServerPath());
         }
     }
     $newFolderPath = preg_replace(",[^/]+/?\$,", $newFolderName, $this->_currentFolder->getClientPath()) . '/';
     $newFolderUrl = $resourceTypeInfo->getUrl() . ltrim($newFolderPath, '/');
     $oRenameNode = new Ckfinder_Connector_Utils_XmlNode("RenamedFolder");
     $this->_connectorNode->addChild($oRenameNode);
     $oRenameNode->addAttribute("newName", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderName));
     $oRenameNode->addAttribute("newPath", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderPath));
     $oRenameNode->addAttribute("newUrl", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderUrl));
 }
开发者ID:xubo245,项目名称:liuyangzhang,代码行数:59,代码来源:RenameFolder.php

示例7: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_CREATE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
     $sNewFolderName = isset($_GET["NewFolderName"]) ? $_GET["NewFolderName"] : "";
     $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($sNewFolderName);
     if ($_config->forceAscii()) {
         $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($sNewFolderName);
     }
     //        if (!CKFinder_Connector_Utils_FileSystem::checkFolderName($sNewFolderName) || $_resourceTypeConfig->checkIsHiddenFolder($sNewFolderName)) {
     //            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     //        }
     $sServerDir = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $sNewFolderName);
     //        if (!is_writeable($this->_currentFolder->getServerPath())) {
     //            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     //        }
     $bCreated = false;
     global $config;
     $s3 = s3_con();
     //Remove preceding slash, and add trailing slash (necessary for S3 to add a "folder")
     $bCreated = $s3->putObject("", $config['AmazonS3']['Bucket'], substr($sServerDir, 1) . "/");
     //TODO: File/folder already exists
     //        if (file_exists($sServerDir)) {
     //            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     //        }
     //        if ($perms = $_config->getChmodFolders()) {
     //            $oldUmask = umask(0);
     //            $bCreated = @mkdir($sServerDir, $perms);
     //            umask($oldUmask);
     //        }
     //        else {
     //            $bCreated = @mkdir($sServerDir);
     //        }
     if (!$bCreated) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     } else {
         $oNewFolderNode = new Ckfinder_Connector_Utils_XmlNode("NewFolder");
         $this->_connectorNode->addChild($oNewFolderNode);
         $oNewFolderNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sNewFolderName));
     }
 }
开发者ID:jul6art,项目名称:vscms,代码行数:52,代码来源:CreateFolder.php

示例8: buildXml

 /**
  * handle request and build XML
  * @access protected
  */
 function buildXml()
 {
     if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $this->checkConnector();
     $this->checkRequest();
     // Saving empty file is equal to deleting a file, that's why FILE_DELETE permissions are required
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (!isset($_POST["fileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     if (!isset($_POST["content"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["fileName"]);
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!$resourceTypeInfo->checkExtension($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if (!file_exists($filePath) || !is_file($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     if (!is_writable(dirname($filePath))) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     $fp = @fopen($filePath, 'wb');
     if ($fp === false || !flock($fp, LOCK_EX)) {
         $result = false;
     } else {
         $result = fwrite($fp, $_POST["content"]);
         flock($fp, LOCK_UN);
         fclose($fp);
     }
     if ($result === false) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
 }
开发者ID:canhphong,项目名称:WebBanSachNgocQuy,代码行数:48,代码来源:plugin.php

示例9: sendResponse

 /**
  * send response (file)
  * @access public
  *
  */
 public function sendResponse()
 {
     if (!function_exists('ob_list_handlers') || ob_list_handlers()) {
         @ob_end_clean();
     }
     header("Content-Encoding: none");
     $this->checkConnector();
     $this->checkRequest();
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
     $_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$_resourceTypeInfo->checkExtension($fileName, false)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if ($_resourceTypeInfo->checkIsHiddenFile($fileName) || !file_exists($filePath) || !is_file($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName);
     header("Cache-Control: cache, must-revalidate");
     header("Pragma: public");
     header("Expires: 0");
     if (!empty($_GET['format']) && $_GET['format'] == 'text') {
         header("Content-Type: text/plain; charset=utf-8");
     } else {
         $user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
         $encodedName = str_replace("\"", "\\\"", $fileName);
         if (strpos($user_agent, "MSIE") !== false) {
             $encodedName = str_replace(array("+", "%2E"), array(" ", "."), urlencode($encodedName));
         }
         header("Content-type: application/octet-stream; name=\"" . $fileName . "\"");
         header("Content-Disposition: attachment; filename=\"" . $encodedName . "\"");
     }
     header("Content-Length: " . filesize($filePath));
     CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
     exit;
 }
开发者ID:knieper,项目名称:crltmich,代码行数:47,代码来源:DownloadFile.php

示例10: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_RENAME)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (!isset($_GET["NewFolderName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["NewFolderName"]);
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($newFolderName) || $resourceTypeInfo->checkIsHiddenFolder($newFolderName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $oldFolderPath = $this->_currentFolder->getServerPath();
     $bMoved = false;
     if (!is_dir($oldFolderPath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     //let's calculate new folder name
     $newFolderPath = dirname($oldFolderPath) . DIRECTORY_SEPARATOR . $newFolderName . DIRECTORY_SEPARATOR;
     if (file_exists($newFolderPath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     }
     $bMoved = @rename($oldFolderPath, $newFolderPath);
     if (!$bMoved) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     } else {
         CKFinder_Connector_Utils_FileSystem::unlink($this->_currentFolder->getThumbsServerPath());
     }
     $newFolderPath = preg_replace(",[^/]+/?\$,", $newFolderName, $this->_currentFolder->getClientPath()) . '/';
     $newFolderUrl = $resourceTypeInfo->getUrl() . ltrim($newFolderPath, '/');
     $oRenameNode = new Ckfinder_Connector_Utils_XmlNode("RenamedFolder");
     $this->_connectorNode->addChild($oRenameNode);
     $oRenameNode->addAttribute("newName", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderName));
     $oRenameNode->addAttribute("newPath", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderPath));
     $oRenameNode->addAttribute("newUrl", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderUrl));
 }
开发者ID:kingwang317,项目名称:it4fun-guam,代码行数:42,代码来源:RenameFolder.php

示例11: buildXml

 function buildXml()
 {
     // A "must have", checking whether the connector is enabled and the basic parameters (like current folder) are safe.
     $this->checkConnector();
     $this->checkRequest();
     // Checking ACL permissions, we're just getting an information about a file, so FILE_VIEW permission seems to be ok.
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     // Make sure we actually received a file name
     if (!isset($_GET["fileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     // Use the resource type configuration object to check whether the extension of a file to check is really allowed.
     if (!$resourceTypeInfo->checkExtension($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
     }
     // Make sure that the file name is really ok and has not been sent by a hacker
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if (!file_exists($filePath) || !is_file($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     $size = filesize($filePath);
     // *** The main part of this plugin ****
     // Adding a <FileSize> element to the XML response.
     //$oNode = new Ckfinder_Connector_Utils_XmlNode("FileSize");
     //$oNode->addAttribute("size", $size);
     //$this->_connectorNode->addChild($oNode);
     $myNode = new Ckfinder_Connector_Utils_XmlNode("MyMessage");
     $myNode->addAttribute("message", "Hello world!");
     $this->_connectorNode->addChild($myNode);
 }
开发者ID:syj610226,项目名称:CKFinderJcrop,代码行数:37,代码来源:plugin.php

示例12: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $oErrorsNode = new CKFinder_Connector_Utils_XmlNode("Errors");
     $errorCode = CKFINDER_CONNECTOR_ERROR_NONE;
     $deleted = 0;
     $oDeleteFilesNode = new Ckfinder_Connector_Utils_XmlNode("DeleteFiles");
     $currentResourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     $_aclConfig = $_config->getAccessControlConfig();
     $aclMasks = array();
     $_resourceTypeConfig = array();
     $checkedPaths = array();
     if (!empty($_POST['files']) && is_array($_POST['files'])) {
         foreach ($_POST['files'] as $arr) {
             if (empty($arr['name'])) {
                 continue;
             }
             if (!isset($arr['type'], $arr['folder'])) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             // file name
             $name = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($arr['name']);
             // resource type
             $type = $arr['type'];
             // client path
             $path = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($arr['folder']);
             if (!isset($_resourceTypeConfig[$type])) {
                 $_resourceTypeConfig[$type] = $_config->getResourceTypeConfig($type);
             }
             if (is_null($_resourceTypeConfig[$type]) || !CKFinder_Connector_Utils_FileSystem::checkFileName($name) || preg_match(CKFINDER_REGEX_INVALID_PATH, $path)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             if (!$_resourceTypeConfig[$type]->checkExtension($name, false)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             if (empty($checkedPaths[$path])) {
                 $checkedPaths[$path] = true;
                 if ($_resourceTypeConfig[$type]->checkIsHiddenPath($path)) {
                     $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
                 }
             }
             if ($currentResourceTypeConfig->checkIsHiddenFile($name)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             if (!isset($aclMasks[$type . "@" . $path])) {
                 $aclMasks[$type . "@" . $path] = $_aclConfig->getComputedMask($type, $path);
             }
             $isAuthorized = ($aclMasks[$type . "@" . $path] & CKFINDER_CONNECTOR_ACL_FILE_DELETE) == CKFINDER_CONNECTOR_ACL_FILE_DELETE;
             if (!$isAuthorized) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
             }
             $filePath = $_resourceTypeConfig[$type]->getDirectory() . $path . $name;
             if (!file_exists($filePath) || !is_file($filePath)) {
                 $errorCode = CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND;
                 $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                 continue;
             }
             if (!CKFinder_Connector_Utils_FileSystem::unlink($filePath)) {
                 $errorCode = CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
                 $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                 continue;
             } else {
                 $deleted++;
                 $thumbPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getThumbsServerPath(), $name);
                 @unlink($thumbPath);
             }
         }
     }
     $this->_connectorNode->addChild($oDeleteFilesNode);
     if ($errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
         $this->_connectorNode->addChild($oErrorsNode);
     }
     $oDeleteFilesNode->addAttribute("deleted", $deleted);
     if ($errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_DELETE_FAILED);
     }
 }
开发者ID:robocon,项目名称:iopr,代码行数:88,代码来源:DeleteFiles.php

示例13: CKFinder_Connector_Core_FolderHandler

 function CKFinder_Connector_Core_FolderHandler()
 {
     if (isset($_GET["type"])) {
         $this->_resourceTypeName = (string) $_GET["type"];
     }
     if (isset($_GET["currentFolder"])) {
         $this->_clientPath = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding((string) $_GET["currentFolder"]);
     }
     if (!strlen($this->_clientPath)) {
         $this->_clientPath = "/";
     } else {
         if (substr($this->_clientPath, -1, 1) != "/") {
             $this->_clientPath .= "/";
         }
         if (substr($this->_clientPath, 0, 1) != "/") {
             $this->_clientPath = "/" . $this->_clientPath;
         }
     }
     $this->_aclMask = -1;
 }
开发者ID:akula22,项目名称:fifa,代码行数:20,代码来源:FolderHandler.php

示例14: sendResponse

 * Handle FileUpload command

 *

 * @package CKFinder

 * @subpackage CommandHandlers

 * @copyright CKSource - Frederico Knabben

 */
class CKFinder_Connector_CommandHandler_FileUpload extends CKFinder_Connector_CommandHandler_CommandHandlerBase
{
    /**

     * Command name

     *

     * @access protected

     * @var string

     */
    protected $command = "FileUpload";
    /**

     * send response (save uploaded file, resize if required)

     * @access public

     *

     */
    public function sendResponse()
    {
        $iErrorNumber = CKFINDER_CONNECTOR_ERROR_NONE;
        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        $oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
        $oRegistry->set("FileUpload_fileName", "unknown file");
        $uploadedFile = array_shift($_FILES);
        if (!isset($uploadedFile['name'])) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID);
        }
        $sUnsafeFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding(CKFinder_Connector_Utils_Misc::mbBasename($uploadedFile['name']));
        $sFileName = CKFinder_Connector_Utils_FileSystem::secureFileName($sUnsafeFileName);
        if ($sFileName != $sUnsafeFileName) {
            $iErrorNumber = CKFINDER_CONNECTOR_ERROR_UPLOADED_INVALID_NAME_RENAMED;
        }
        $oRegistry->set("FileUpload_fileName", $sFileName);
        $this->checkConnector();
        $this->checkRequest();
        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_UPLOAD)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
        }
        $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
        if (!CKFinder_Connector_Utils_FileSystem::checkFileName($sFileName) || $_resourceTypeConfig->checkIsHiddenFile($sFileName)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
        }
        $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
        if (!$resourceTypeInfo->checkExtension($sFileName)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
        }
        $oRegistry->set("FileUpload_fileName", $sFileName);
        $oRegistry->set("FileUpload_url", $this->_currentFolder->getUrl());
        $maxSize = $resourceTypeInfo->getMaxSize();
        if (!$_config->checkSizeAfterScaling() && $maxSize && $uploadedFile['size'] > $maxSize) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
        }
        $htmlExtensions = $_config->getHtmlExtensions();
        $sExtension = CKFinder_Connector_Utils_FileSystem::getExtension($sFileName);
        if ($htmlExtensions && !CKFinder_Connector_Utils_Misc::inArrayCaseInsensitive($sExtension, $htmlExtensions) && ($detectHtml = CKFinder_Connector_Utils_FileSystem::detectHtml($uploadedFile['tmp_name'])) === true) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_WRONG_HTML_FILE);
        }
        $secureImageUploads = $_config->getSecureImageUploads();
        if ($secureImageUploads && ($isImageValid = CKFinder_Connector_Utils_FileSystem::isImageValid($uploadedFile['tmp_name'], $sExtension)) === false) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
        }
        switch ($uploadedFile['error']) {
            case UPLOAD_ERR_OK:
                break;
            case UPLOAD_ERR_INI_SIZE:
            case UPLOAD_ERR_FORM_SIZE:
                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG);
                break;
            case UPLOAD_ERR_PARTIAL:
            case UPLOAD_ERR_NO_FILE:
                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_CORRUPT);
                break;
            case UPLOAD_ERR_NO_TMP_DIR:
                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UPLOADED_NO_TMP_DIR);
                break;
            case UPLOAD_ERR_CANT_WRITE:
                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
                break;
            case UPLOAD_ERR_EXTENSION:
                $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
                break;
        }
        $sServerDir = $this->_currentFolder->getServerPath();
//.........这里部分代码省略.........
开发者ID:neelmanis,项目名称:Jobready_New,代码行数:101,代码来源:FileUpload.php

示例15: sendResponse

 /**
  * handle request and send response
  * @access public
  *
  */
 public function sendResponse()
 {
     // Get rid of BOM markers
     if (ob_get_level()) {
         while (@ob_end_clean() && ob_get_level()) {
         }
     }
     header("Content-Encoding: none");
     $this->checkConnector();
     $this->checkRequest();
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     $_thumbnails = $_config->getThumbnailsConfig();
     if (!$_thumbnails->getIsEnabled()) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_THUMBNAILS_DISABLED);
     }
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (!isset($_GET["FileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
     $_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $sourceFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if ($_resourceTypeInfo->checkIsHiddenFile($fileName) || !file_exists($sourceFilePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     $thumbFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getThumbsServerPath(), $fileName);
     // If the thumbnail file doesn't exists, create it now.
     if (!file_exists($thumbFilePath)) {
         if (!$this->createThumb($sourceFilePath, $thumbFilePath, $_thumbnails->getMaxWidth(), $_thumbnails->getMaxHeight(), $_thumbnails->getQuality(), true, $_thumbnails->getBmpSupported())) {
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
         }
     }
     $size = filesize($thumbFilePath);
     $sourceImageAttr = getimagesize($thumbFilePath);
     $mime = $sourceImageAttr["mime"];
     $rtime = isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) ? @strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]) : 0;
     $mtime = filemtime($thumbFilePath);
     $etag = dechex($mtime) . "-" . dechex($size);
     $is304 = false;
     if (isset($_SERVER["HTTP_IF_NONE_MATCH"]) && $_SERVER["HTTP_IF_NONE_MATCH"] === $etag) {
         $is304 = true;
     } else {
         if ($rtime == $mtime) {
             $is304 = true;
         }
     }
     if ($is304) {
         header("HTTP/1.0 304 Not Modified");
         exit;
     }
     //header("Cache-Control: cache, must-revalidate");
     //header("Pragma: public");
     //header("Expires: 0");
     header('Cache-control: public');
     header('Etag: ' . $etag);
     header("Content-type: " . $mime . "; name=\"" . CKFinder_Connector_Utils_Misc::mbBasename($thumbFilePath) . "\"");
     header("Last-Modified: " . gmdate('D, d M Y H:i:s', $mtime) . " GMT");
     //header("Content-type: application/octet-stream; name=\"{$file}\"");
     //header("Content-Disposition: attachment; filename=\"{$file}\"");
     header("Content-Length: " . $size);
     readfile($thumbFilePath);
     exit;
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:73,代码来源:Thumbnail.php


注:本文中的CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。