Вход Регистрация
Файл: fckeditor/ckfinder/core/connector/php/php5/CommandHandler/DeleteFolder.php
Строк: 83
<?php
/*
 * CKFinder
 * ========
 * http://www.ckfinder.com
 * Copyright (C) 2007-2008 Frederico Caldeira Knabben (FredCK.com)
 *
 * The software, this file and its contents are subject to the CKFinder
 * License. Please read the license.txt file before using, installing, copying,
 * modifying or distribute this file or part of its contents. The contents of
 * this file is part of the Source Code of CKFinder.
 */

/**
 * @package CKFinder
 * @subpackage CommandHandlers
 * @copyright Frederico Caldeira Knabben
 */

/**
 * Include base XML command handler
 */
require_once CKFINDER_CONNECTOR_LIB_DIR "/CommandHandler/XmlCommandHandlerBase.php";

/**
 * Handle DeleteFolder command
 * 
 * @package CKFinder
 * @subpackage CommandHandlers
 * @copyright Frederico Caldeira Knabben
 */
class CKFinder_Connector_CommandHandler_DeleteFolder extends CKFinder_Connector_CommandHandler_XmlCommandHandlerBase
{
    
/**
     * Command name
     *
     * @access private
     * @var string
     */
    
private $command "DeleteFolder";


    
/**
     * 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());
    }
}
?>
Онлайн: 1
Реклама