KernelLoader::passContainerToModels PHP Method

passContainerToModels() public method

Consider this a temporary solution until we have genuine models available.
    public function passContainerToModels()
    {
        FrontendModel::setContainer($this->getKernel()->getContainer());
        BackendModel::setContainer($this->getKernel()->getContainer());
    }

Usage Example

示例#1
0
 *
 * Other settings may be left with their default values, or used to control
 * advanced features of CKFinder.
 */
/*
 * Create a Kernel and load the DI container to be able to access the Backend Model methods and
 * the configuration. This should be refactored in time.
 */
require_once '../../../../../../../../autoload.php';
require_once '../../../../../../../../app/AppKernel.php';
require_once '../../../../../../../../app/KernelLoader.php';
$env = getenv('FORK_ENV') ?: 'prod';
$debug = getenv('FORK_DEBUG') === '1';
$kernel = new AppKernel($env, $debug);
$loader = new KernelLoader($kernel);
$loader->passContainerToModels();
// after registring autoloaders, let's add use statements for our needed classes
use Backend\Core\Engine\Authentication as BackendAuthentication;
use Backend\Core\Engine\Model as BackendModel;
/**
 * This function must check the user session to be sure that he/she is
 * authorized to upload and access files in the File Browser.
 *
 * @return boolean
 */
function CheckAuthentication()
{
    // WARNING : DO NOT simply return "true". By doing so, you are allowing
    // "anyone" to upload and list the files in your server. You must implement
    // some kind of session validation here. Even something very simple as...
    // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];