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


PHP CKFinder_Connector_Core_Factory类代码示例

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


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

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

示例2: 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
  */
 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");
     header('Content-Type: text/html; charset=utf-8');
     $errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sFileName);
     if (!$uploaded) {
         $sFileName = "";
     }
     if (!empty($_GET['response_type']) && $_GET['response_type'] == 'txt') {
         echo $sFileName . "|" . $errorMessage;
         exit;
     }
     echo "<script type=\"text/javascript\">";
     if (!empty($_GET['CKFinderFuncNum'])) {
         $errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sFileName);
         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("'", "\\'", $sFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "') ;";
     }
     echo "</script>";
     if ($exit) {
         exit;
     }
 }
开发者ID:mrschleig,项目名称:sensdata,代码行数:41,代码来源:FileUpload.php

示例3: sendResponse

 function sendResponse()
 {
     $oRegistry =& CKFinder_Connector_Core_Factory::getInstance("Core_Registry");
     $file_url = $this->_currentFolder->getUrl();
     $oRegistry->set("FileUpload_url", $file_url);
     return parent::sendResponse();
 }
开发者ID:nathan1217,项目名称:ccad,代码行数:7,代码来源:QuickUpload.php

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

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

示例6: checkConnector

 /**
  * Check whether Connector is enabled
  * @access protected
  *
  */
 protected function checkConnector()
 {
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if (!$_config->getIsEnabled()) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CONNECTOR_DISABLED);
     }
 }
开发者ID:kentonquatman,项目名称:iofa,代码行数:12,代码来源:CommandHandlerBase.php

示例7: 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
  */
 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");
     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'])) {
         $errorMessage = CKFinder_Connector_Utils_Misc::getErrorMessage($number, $sFileName);
         if (!$uploaded) {
             $sFileUrl = "";
             $sFileName = "";
         }
         $funcNum = preg_replace("/[^0-9]/", "", $_GET['CKEditorFuncNum']);
         echo "window.parent.CKEDITOR.tools.callFunction({$funcNum}, '" . str_replace("'", "\\'", $sFileUrl . $sFileName) . "', '" . str_replace("'", "\\'", $errorMessage) . "');";
     } else {
         if (!$uploaded) {
             echo "window.parent.OnUploadCompleted(" . $number . ", '', '', '') ;";
         } else {
             echo "window.parent.OnUploadCompleted(" . $number . ", '" . str_replace("'", "\\'", $sFileUrl . $sFileName) . "', '" . str_replace("'", "\\'", $sFileName) . "', '') ;";
         }
     }
     echo "</script>";
     if ($exit) {
         exit;
     }
 }
开发者ID:knieper,项目名称:crltmich,代码行数:42,代码来源:QuickUpload.php

示例8: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     // Create the "ConnectorInfo" node.
     $_oConnInfo = new Ckfinder_Connector_Utils_XmlNode("ConnectorInfo");
     $this->_connectorNode->addChild($_oConnInfo);
     $_oConnInfo->addAttribute("enabled", $_config->getIsEnabled() ? "true" : "false");
     if (!$_config->getIsEnabled()) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CONNECTOR_DISABLED);
     }
     $_ln = '';
     $_lc = $_config->getLicenseKey() . '                                  ';
     if (1 == strpos(CKFINDER_CHARS, $_lc[0]) % 5) {
         $_ln = $_config->getLicenseName();
     }
     $_oConnInfo->addAttribute("s", $_ln);
     $_oConnInfo->addAttribute("c", trim($_lc[11] . $_lc[0] . $_lc[8] . $_lc[12]));
     $_thumbnailsConfig = $_config->getThumbnailsConfig();
     $_thumbnailsEnabled = $_thumbnailsConfig->getIsEnabled();
     $_oConnInfo->addAttribute("thumbsEnabled", $_thumbnailsEnabled ? "true" : "false");
     if ($_thumbnailsEnabled) {
         $_oConnInfo->addAttribute("thumbsUrl", $_thumbnailsConfig->getUrl());
         $_oConnInfo->addAttribute("thumbsDirectAccess", $_thumbnailsConfig->getDirectAccess() ? "true" : "false");
     }
     // Create the "ResourceTypes" node.
     $_oResourceTypes = new Ckfinder_Connector_Utils_XmlNode("ResourceTypes");
     $this->_connectorNode->addChild($_oResourceTypes);
     // Load the resource types in an array.
     $_aTypes = $_config->getDefaultResourceTypes();
     if (!sizeof($_aTypes)) {
         $_aTypes = $_config->getResourceTypeNames();
     }
     $_aTypesSize = sizeof($_aTypes);
     if ($_aTypesSize) {
         for ($i = 0; $i < $_aTypesSize; $i++) {
             $_resourceTypeName = $_aTypes[$i];
             $_acl = $_config->getAccessControlConfig();
             $_aclMask = $_acl->getComputedMask($_resourceTypeName, "/");
             if (($_aclMask & CKFINDER_CONNECTOR_ACL_FOLDER_VIEW) != CKFINDER_CONNECTOR_ACL_FOLDER_VIEW) {
                 continue;
             }
             if (!isset($_GET['type']) || $_GET['type'] === $_resourceTypeName) {
                 //print $_resourceTypeName;
                 $_oTypeInfo = $_config->getResourceTypeConfig($_resourceTypeName);
                 //print_r($_oTypeInfo);
                 $_oResourceType[$i] = new Ckfinder_Connector_Utils_XmlNode("ResourceType");
                 $_oResourceTypes->addChild($_oResourceType[$i]);
                 $_oResourceType[$i]->addAttribute("name", $_resourceTypeName);
                 $_oResourceType[$i]->addAttribute("url", $_oTypeInfo->getUrl());
                 $_oResourceType[$i]->addAttribute("allowedExtensions", implode(",", $_oTypeInfo->getAllowedExtensions()));
                 $_oResourceType[$i]->addAttribute("deniedExtensions", implode(",", $_oTypeInfo->getDeniedExtensions()));
                 $_oResourceType[$i]->addAttribute("defaultView", $_oTypeInfo->getDefaultView());
                 $_oResourceType[$i]->addAttribute("hash", substr(md5($_oTypeInfo->getDirectory()), 0, 16));
                 $_oResourceType[$i]->addAttribute("hasChildren", CKFinder_Connector_Utils_FileSystem::hasChildren($_oTypeInfo->getDirectory()) ? "true" : "false");
                 $_oResourceType[$i]->addAttribute("acl", $_aclMask);
             }
         }
     }
 }
开发者ID:rash012,项目名称:cms,代码行数:64,代码来源:Init.php

示例9: throwError

 /**
  * Throw connector 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, $text = false)
 {
     if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
         return false;
     }
     $_xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
     $_xml->raiseError($number, $text);
     exit;
 }
开发者ID:vunguyen105,项目名称:mohinh,代码行数:16,代码来源:Base.php

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

示例11: execute

 protected function execute()
 {
     \CKFinder_Connector_Core_Factory::initFactory();
     $connector =& \CKFinder_Connector_Core_Factory::getInstance("Core_Connector");
     if ($this->request->query->has('command')) {
         $connector->executeCommand($this->request->query->get('command'));
     } else {
         $connector->handleInvalidCommand();
     }
 }
开发者ID:spin7ion,项目名称:JonlilCKFinderBundle,代码行数:10,代码来源:AbstractConnector.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);
     }
     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

示例13: 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();
             $folderPath = $this->_currentFolder->getClientPath() . $file . "/";
             $aclMask = $oAcl->getComputedMask($this->_currentFolder->getResourceTypeName(), $folderPath);
             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($folderPath, $resourceTypeInfo) ? "true" : "false");
             $oFolderNode[$i]->addAttribute("acl", $aclMask);
             $i++;
         }
     }
 }
开发者ID:dinhtich1991,项目名称:staff,代码行数:54,代码来源:GetFolders.php

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

示例15: 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 = substr($this->_currentFolder->getServerPath(), 1);
     //        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();
     global $config;
     $s3 = s3_con();
     $items = $s3->getBucket($config['AmazonS3']['Bucket'], $_sServerDir, null, null, '/', true);
     foreach ($items as $key => $val) {
         if (array_key_exists('prefix', $val)) {
             //TODO: Replace the base directory in this URL
             $files[] = substr(str_replace($_sServerDir, "", $key), 0, -1);
             //$files[] = substr($key, 3, strlen($key) - 4);
         }
     }
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (sizeof($files) > 0) {
         natcasesort($files);
         $i = 0;
         foreach ($files as $file) {
             $oAcl = $_config->getAccessControlConfig();
             $folderPath = $this->_currentFolder->getClientPath() . $file . '/';
             $aclMask = $oAcl->getComputedMask($this->_currentFolder->getResourceTypeName(), $folderPath);
             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($folderPath, $resourceTypeInfo) ? "true" : "false");
             $oFolderNode[$i]->addAttribute("acl", $aclMask);
             $i++;
         }
     }
 }
开发者ID:jul6art,项目名称:vscms,代码行数:54,代码来源:GetFolders.php


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