filemanager.config.php in CKEditor - WYSIWYG HTML editor 7
File
includes/filemanager.config.php
View source
<?php
$GLOBALS['devel_shutdown'] = FALSE;
if (!function_exists('ob_list_handlers') || ob_list_handlers()) {
@ob_end_clean();
}
$ckfinder_user_files_path = '';
$ckfinder_user_files_absolute_path = '';
function CheckAuthentication() {
static $authenticated;
if (!isset($authenticated)) {
if (!empty($_SERVER['SCRIPT_FILENAME'])) {
$drupal_path = dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))));
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
$drupal_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
$depth = 2;
do {
$drupal_path = dirname($drupal_path);
$depth++;
} while (!($bootstrap_file_found = file_exists($drupal_path . '/includes/bootstrap.inc')) && $depth < 10);
}
}
if (!isset($bootstrap_file_found) || !$bootstrap_file_found) {
$drupal_path = '../../../../..';
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
$drupal_path = '../..';
do {
$drupal_path .= '/..';
$depth = substr_count($drupal_path, '..');
} while (!($bootstrap_file_found = file_exists($drupal_path . '/includes/bootstrap.inc')) && $depth < 10);
}
}
if (!isset($bootstrap_file_found) || $bootstrap_file_found) {
$current_cwd = getcwd();
chdir($drupal_path);
if (!defined('DRUPAL_ROOT')) {
define('DRUPAL_ROOT', $drupal_path);
}
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$authenticated = user_access('allow CKFinder file uploads');
if (isset($_GET['id'], $_SESSION['ckeditor'][$_GET['id']]['UserFilesPath'], $_SESSION['ckeditor'][$_GET['id']]['UserFilesAbsolutePath'])) {
$_SESSION['ckeditor']['UserFilesPath'] = $_SESSION['ckeditor'][$_GET['id']]['UserFilesPath'];
$_SESSION['ckeditor']['UserFilesAbsolutePath'] = $_SESSION['ckeditor'][$_GET['id']]['UserFilesAbsolutePath'];
}
chdir($current_cwd);
}
}
return $authenticated;
}
CheckAuthentication();
if (isset($_SESSION['ckeditor']['UserFilesPath'], $_SESSION['ckeditor']['UserFilesAbsolutePath'])) {
$baseUrl = $_SESSION['ckeditor']['UserFilesPath'];
if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) {
$baseDir = resolveUrl($baseUrl);
}
else {
$baseDir = $_SESSION['ckeditor']['UserFilesAbsolutePath'];
}
}
else {
$baseUrl = strtr(base_path(), array(
drupal_get_path('module', 'ckeditor') . '/ckfinder/core/connector/php' => '',
)) . variable_get('file_private_path', conf_path() . '/files') . '/';
$baseDir = resolveUrl($baseUrl);
}