• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CKFinder_Connector_Utils_FileSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: throwError

 /**
  * Throw file upload error, return true if error has been thrown, false if error has been catched
  *
  * @param int $number
  * @param string $text
  * @access public
  */
 public function throwError($number, $uploaded = false, $exit = true)
 {
     if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
         return false;
     }
     $oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
     $sFileName = $oRegistry->get("FileUpload_fileName");
     $sFileUrl = $oRegistry->get("FileUpload_url");
     $sEncodedFileName = CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sFileName);
     header('Content-Type: text/html; charset=utf-8');
     $errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sEncodedFileName);
     if (!$uploaded) {
         $sFileName = "";
         $sEncodedFileName = "";
     }
     if (!empty($_GET['response_type']) && $_GET['response_type'] == 'txt') {
         echo $sFileName . "|" . $errorMessage;
     } else {
         echo "<script type=\"text/javascript\">";
         if (!empty($_GET['CKFinderFuncNum'])) {
             if (!$uploaded) {
                 $sFileUrl = "";
                 $sFileName = "";
             }
             $funcNum = preg_replace("/[^0-9]/", "", $_GET['CKFinderFuncNum']);
             echo "window.parent.CKFinder.tools.callFunction({$funcNum}, '" . str_replace("'", "\\'", $sFileUrl . $sFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "');";
         } else {
             echo "window.parent.OnUploadCompleted('" . str_replace("'", "\\'", $sEncodedFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "') ;";
         }
         echo "</script>";
     }
     if ($exit) {
         exit;
     }
 }
开发者ID:valodiapilquevitch,项目名称:Relatorio-de-alunos,代码行数:42,代码来源:FileUpload.php


示例2: 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


示例3: sendResponse

 /**
  * send response
  * @access public
  *
  */
 function sendResponse()
 {
     $xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
     $this->_connectorNode =& $xml->getConnectorNode();
     $this->checkConnector();
     if ($this->mustCheckRequest()) {
         $this->checkRequest();
     }
     $resourceTypeName = $this->_currentFolder->getResourceTypeName();
     if (!empty($resourceTypeName)) {
         $this->_connectorNode->addAttribute("resourceType", $this->_currentFolder->getResourceTypeName());
     }
     if ($this->mustAddCurrentFolderNode()) {
         $_currentFolder = new Ckfinder_Connector_Utils_XmlNode("CurrentFolder");
         $this->_connectorNode->addChild($_currentFolder);
         $_currentFolder->addAttribute("path", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($this->_currentFolder->getClientPath()));
         $this->_errorHandler->setCatchAllErros(true);
         $_url = $this->_currentFolder->getUrl();
         $_currentFolder->addAttribute("url", is_null($_url) ? "" : CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($_url));
         $this->_errorHandler->setCatchAllErros(false);
         $_currentFolder->addAttribute("acl", $this->_currentFolder->getAclMask());
     }
     $this->buildXml();
     $_oErrorNode =& $xml->getErrorNode();
     $_oErrorNode->addAttribute("number", "0");
     echo $this->_connectorNode->asXML();
     exit;
 }
开发者ID:aeduc,项目名称:mideteed,代码行数:33,代码来源:XmlCommandHandlerBase.php


示例4: 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


示例5: 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


示例6: 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


示例7: 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_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     // Map the virtual path to the local server path.
     $_sServerDir = $this->_currentFolder->getServerPath();
     // Create the "Files" node.
     $oFilesNode = new Ckfinder_Connector_Utils_XmlNode("Files");
     $this->_connectorNode->addChild($oFilesNode);
     if (!is_dir($_sServerDir)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
     }
     $files = array();
     if ($dh = @opendir($_sServerDir)) {
         while (($file = readdir($dh)) !== false) {
             if ($file != "." && $file != ".." && !is_dir($_sServerDir . $file)) {
                 $files[] = $file;
             }
         }
         closedir($dh);
     } else {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (sizeof($files) > 0) {
         natcasesort($files);
         $i = 0;
         foreach ($files as $file) {
             $filemtime = @filemtime($_sServerDir . $file);
             //otherwise file doesn't exist or we can't get it's filename properly
             if ($filemtime !== false) {
                 $filename = basename($file);
                 if (!$resourceTypeInfo->checkExtension($filename, false)) {
                     continue;
                 }
                 if ($resourceTypeInfo->checkIsHiddenFile($filename)) {
                     continue;
                 }
                 $oFileNode[$i] = new Ckfinder_Connector_Utils_XmlNode("File");
                 $oFilesNode->addChild($oFileNode[$i]);
                 $oFileNode[$i]->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding(basename($file)));
                 $oFileNode[$i]->addAttribute("date", @date("YmdHi", $filemtime));
                 $size = filesize($_sServerDir . $file);
                 if ($size && $size < 1024) {
                     $size = 1;
                 } else {
                     $size = (int) round($size / 1024);
                 }
                 $oFileNode[$i]->addAttribute("size", $size);
                 $i++;
             }
         }
     }
 }
开发者ID:kingwang317,项目名称:it4fun-guam,代码行数:61,代码来源:GetFiles.php


示例8: throwError

 /**
  * Throw file upload error, return true if error has been thrown, false if error has been catched
  *
  * @param int $number
  * @param string $text
  * @access public
  */
 public function throwError($number, $uploaded = false, $exit = true)
 {
     if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
         return false;
     }
     $oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
     $sFileName = $oRegistry->get("FileUpload_fileName");
     $sFileUrl = $oRegistry->get("FileUpload_url");
     $sEncodedFileName = CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sFileName);
     $errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sEncodedFileName);
     if (!empty($_GET['responseType']) && $_GET['responseType'] == 'json') {
         header('Content-Type: application/json; charset=utf-8');
         $data = array('fileName' => $sEncodedFileName, 'uploaded' => (int) $uploaded);
         if ($uploaded) {
             $data['url'] = $sFileUrl . CKFinder_Connector_Utils_Misc::encodeURIComponent($sEncodedFileName);
         }
         if ($number !== CKFINDER_CONNECTOR_ERROR_NONE) {
             $data['error'] = array('number' => $number, 'message' => $errorMessage);
         }
         echo json_encode($data);
     } else {
         header('Content-Type: text/html; charset=utf-8');
         /**
          * echo <script> is not called before CKFinder_Connector_Utils_Misc::getErrorMessage
          * because PHP has problems with including files that contain BOM character.
          * Having BOM character after <script> tag causes a javascript error.
          */
         echo "<script type=\"text/javascript\">";
         if (!empty($_GET['CKEditor'])) {
             if (!$uploaded) {
                 $sFileUrl = "";
                 $sFileName = "";
                 $sEncodedFileName = "";
             }
             $funcNum = preg_replace("/[^0-9]/", "", $_GET['CKEditorFuncNum']);
             echo "window.parent.CKEDITOR.tools.callFunction({$funcNum}, '" . str_replace("'", "\\'", $sFileUrl . CKFinder_Connector_Utils_Misc::encodeURIComponent($sEncodedFileName)) . "', '" . str_replace("'", "\\'", $errorMessage) . "');";
         } else {
             if (!$uploaded) {
                 echo "window.parent.OnUploadCompleted(" . $number . ", '', '', '') ;";
             } else {
                 echo "window.parent.OnUploadCompleted(" . $number . ", '" . str_replace("'", "\\'", $sFileUrl . CKFinder_Connector_Utils_Misc::encodeURIComponent($sEncodedFileName)) . "', '" . str_replace("'", "\\'", $sEncodedFileName) . "', '') ;";
             }
         }
         echo "</script>";
     }
     if ($exit) {
         exit;
     }
 }
开发者ID:dinhtich1991,项目名称:staff,代码行数:56,代码来源:QuickUpload.php


示例9: 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_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     // Map the virtual path to the local server path.
     $_sServerDir = $this->_currentFolder->getServerPath();
     if (!is_dir($_sServerDir)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
     }
     // Create the "Folders" node.
     $oFoldersNode = new Ckfinder_Connector_Utils_XmlNode("Folders");
     $this->_connectorNode->addChild($oFoldersNode);
     $files = array();
     if ($dh = @opendir($_sServerDir)) {
         while (($file = readdir($dh)) !== false) {
             if ($file != "." && $file != ".." && is_dir($_sServerDir . $file)) {
                 $files[] = $file;
             }
         }
         closedir($dh);
     } else {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (sizeof($files) > 0) {
         natcasesort($files);
         $i = 0;
         foreach ($files as $file) {
             $oAcl = $_config->getAccessControlConfig();
             $aclMask = $oAcl->getComputedMask($this->_currentFolder->getResourceTypeName(), $this->_currentFolder->getClientPath() . $file . "/");
             if (($aclMask & CKFINDER_CONNECTOR_ACL_FOLDER_VIEW) != CKFINDER_CONNECTOR_ACL_FOLDER_VIEW) {
                 continue;
             }
             if ($resourceTypeInfo->checkIsHiddenFolder($file)) {
                 continue;
             }
             // Create the "Folder" node.
             $oFolderNode[$i] = new Ckfinder_Connector_Utils_XmlNode("Folder");
             $oFoldersNode->addChild($oFolderNode[$i]);
             $oFolderNode[$i]->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($file));
             $oFolderNode[$i]->addAttribute("hasChildren", CKFinder_Connector_Utils_FileSystem::hasChildren($_sServerDir . $file) ? "true" : "false");
             $oFolderNode[$i]->addAttribute("acl", $aclMask);
             $i++;
         }
     }
 }
开发者ID:BGCX067,项目名称:facebooksurveyom-svn-to-git,代码行数:53,代码来源:GetFolders.php


示例10: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_DELETE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     // The root folder cannot be deleted.
     if ($this->_currentFolder->getClientPath() == "/") {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $folderServerPath = $this->_currentFolder->getServerPath();
     if (!file_exists($folderServerPath) || !is_dir($folderServerPath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
     }
     if (!CKFinder_Connector_Utils_FileSystem::unlink($folderServerPath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     CKFinder_Connector_Utils_FileSystem::unlink($this->_currentFolder->getThumbsServerPath());
 }
开发者ID:abhaygmit,项目名称:testprj,代码行数:23,代码来源:DeleteFolder.php


示例11: buildXml

 /**
  * handle request and build XML
  * @access 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);
     }
     // 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);
     }
     $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:vcgato29,项目名称:poff,代码行数:49,代码来源:RenameFolder.php


示例12: 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


示例13: 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


示例14: 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


示例15: checkRequest

 /**
  * Check request
  * @access protected
  *
  */
 protected function checkRequest()
 {
     if (preg_match(CKFINDER_REGEX_INVALID_PATH, $this->_currentFolder->getClientPath())) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
     if (is_null($_resourceTypeConfig)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_TYPE);
     }
     $_clientPath = $this->_currentFolder->getClientPath();
     $_clientPathParts = explode("/", trim($_clientPath, "/"));
     if ($_clientPathParts) {
         foreach ($_clientPathParts as $_part) {
             if ($_resourceTypeConfig->checkIsHiddenFolder($_part)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
         }
     }
     if (!is_dir($this->_currentFolder->getServerPath())) {
         if ($_clientPath == "/") {
             if (!CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($this->_currentFolder->getServerPath())) {
                 /**
                  * @todo handle error
                  */
             }
         } else {
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
         }
     }
 }
开发者ID:kentonquatman,项目名称:iofa,代码行数:35,代码来源:CommandHandlerBase.php


示例16: 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


示例17: createDirectoryRecursively

 /**
  * Create directory recursively
  *
  * @static
  * @access public
  * @param string $dir
  * @param int $mode
  * @return boolean
  */
 function createDirectoryRecursively($dir)
 {
     if (is_dir($dir)) {
         return true;
     }
     //attempt to create directory
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if ($perms = $_config->getChmodFolders()) {
         $oldUmask = umask(0);
         $bCreated = @mkdir($dir, $perms);
         umask($oldUmask);
     } else {
         $bCreated = @mkdir($dir);
     }
     if ($bCreated) {
         return true;
     }
     //failed to create directory, perhaps we need to create parent directories first
     if (!CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively(dirname($dir))) {
         return false;
     }
     //parent directories created successfully, let's try to create directory once again
     if ($perms) {
         $old_umask = umask(0);
         $result = @mkdir($dir, $perms);
         umask($old_umask);
     } else {
         $result = @mkdir($dir);
     }
     return $result;
 }
开发者ID:BGCX067,项目名称:facebooksurveyom-svn-to-git,代码行数:40,代码来源:FileSystem.php


示例18: buildXml

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CKFinder_Connector_Utils_Misc类代码示例发布时间:2022-05-23
下一篇:
PHP CKFinder_Connector_Core_Hooks类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap