PHP 8.1.33
Preview: CommandHandlerBase.php Size: 4.01 KB
/home/jambtst2015/public_html/ckfinder/core/connector/php/php4/CommandHandler/CommandHandlerBase.php

<?php

/*

 * CKFinder

 * ========

 * http://ckfinder.com

 * Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.

 *

 * 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.

 */

if (!defined('IN_CKFINDER')) exit;



/**

 * @package CKFinder

 * @subpackage CommandHandlers

 * @copyright CKSource - Frederico Knabben

 */



/**

 * Base commands handler

 *

 * @package CKFinder

 * @subpackage CommandHandlers

 * @copyright CKSource - Frederico Knabben

 * @abstract

 *

 */

class CKFinder_Connector_CommandHandler_CommandHandlerBase

{

    /**

     * CKFinder_Connector_Core_Connector object

     *

     * @access protected

     * @var CKFinder_Connector_Core_Connector

     */

    var $_connector;

    /**

     * CKFinder_Connector_Core_FolderHandler object

     *

     * @access protected

     * @var CKFinder_Connector_Core_FolderHandler

     */

    var $_currentFolder;

    /**

     * Error handler object

     *

     * @access protected

     * @var CKFinder_Connector_ErrorHandler_Base|CKFinder_Connector_ErrorHandler_FileUpload|CKFinder_Connector_ErrorHandler_Http

     */

    var $_errorHandler;



    function CKFinder_Connector_CommandHandler_CommandHandlerBase()

    {

        $this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");

        $this->_connector =& CKFinder_Connector_Core_Factory::getInstance("Core_Connector");

        $this->_errorHandler =& $this->_connector->getErrorHandler();

    }



    /**

     * Get Folder Handler

     *

     * @return CKFinder_Connector_Core_FolderHandler

     * @access public

     */

    function getFolderHandler()

    {

        if (is_null($this->_currentFolder)) {

            $this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler");

        }



        return $this->_currentFolder;

    }



    /**

     * Check whether Connector is enabled

     * @access protected

     *

     */

    function checkConnector()

    {

        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");

        if (!$_config->getIsEnabled()) {

            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CONNECTOR_DISABLED);

        }

    }



    /**

     * Check request

     * @access 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);

            }

        }

    }

}

Directory Contents

Dirs: 0 × Files: 16

Name Size Perms Modified Actions
4.01 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
11.12 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
3.55 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
3.28 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
2.38 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
3.15 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
8.56 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
4.85 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
3.69 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
5.74 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
11.93 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
1.36 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
5.00 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
4.48 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
12.38 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download
3.40 KB lrw-r--r-- 2024-11-22 17:53:11
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).