1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
$GLOBALS['devel_shutdown'] = FALSE;
|
31 |
|
|
|
32 |
|
|
if (!function_exists('ob_list_handlers') || ob_list_handlers()) {
|
33 |
|
|
@ob_end_clean();
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
$ckfinder_user_files_path = '';
|
37 |
|
|
$ckfinder_user_files_absolute_path = '';
|
38 |
|
|
|
39 |
|
|
function CheckAuthentication() {
|
40 |
|
|
static $authenticated;
|
41 |
|
|
|
42 |
|
|
if (!isset($authenticated)) {
|
43 |
|
|
if (!empty($_SERVER['SCRIPT_FILENAME'])) {
|
44 |
|
|
$drupal_path = dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))));
|
45 |
|
|
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
|
46 |
|
|
$drupal_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
|
47 |
|
|
$depth = 2;
|
48 |
|
|
do {
|
49 |
|
|
$drupal_path = dirname($drupal_path);
|
50 |
|
|
$depth++;
|
51 |
|
|
} while (!($bootstrap_file_found = file_exists($drupal_path . '/includes/bootstrap.inc')) && $depth < 10);
|
52 |
|
|
}
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
if (!isset($bootstrap_file_found) || !$bootstrap_file_found) {
|
56 |
|
|
$drupal_path = '../../../../..';
|
57 |
|
|
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
|
58 |
|
|
$drupal_path = '../..';
|
59 |
|
|
do {
|
60 |
|
|
$drupal_path .= '/..';
|
61 |
|
|
$depth = substr_count($drupal_path, '..');
|
62 |
|
|
} while (!($bootstrap_file_found = file_exists($drupal_path . '/includes/bootstrap.inc')) && $depth < 10);
|
63 |
|
|
}
|
64 |
|
|
}
|
65 |
|
|
if (!isset($bootstrap_file_found) || $bootstrap_file_found) {
|
66 |
|
|
$current_cwd = getcwd();
|
67 |
|
|
chdir($drupal_path);
|
68 |
|
|
if (!defined('DRUPAL_ROOT')) {
|
69 |
|
|
define('DRUPAL_ROOT', $drupal_path);
|
70 |
|
|
}
|
71 |
|
|
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
|
72 |
|
|
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
|
73 |
|
|
$authenticated = user_access('allow CKFinder file uploads');
|
74 |
|
|
if (isset($_GET['id'], $_SESSION['ckeditor'][$_GET['id']]['UserFilesPath'], $_SESSION['ckeditor'][$_GET['id']]['UserFilesAbsolutePath'])) {
|
75 |
|
|
$_SESSION['ckeditor']['UserFilesPath'] = $_SESSION['ckeditor'][$_GET['id']]['UserFilesPath'];
|
76 |
|
|
$_SESSION['ckeditor']['UserFilesAbsolutePath'] = $_SESSION['ckeditor'][$_GET['id']]['UserFilesAbsolutePath'];
|
77 |
|
|
}
|
78 |
|
|
chdir($current_cwd);
|
79 |
|
|
}
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
return $authenticated;
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
CheckAuthentication();
|
86 |
|
|
|
87 |
|
|
if (isset($_SESSION['ckeditor']['UserFilesPath'], $_SESSION['ckeditor']['UserFilesAbsolutePath'])) {
|
88 |
|
|
$baseUrl = $_SESSION['ckeditor']['UserFilesPath'];
|
89 |
6fd71452
|
Julien Enselme
|
|
90 |
|
|
|
91 |
|
|
if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) {
|
92 |
|
|
$baseDir = resolveUrl($baseUrl);
|
93 |
|
|
}
|
94 |
|
|
else {
|
95 |
|
|
$baseDir = $_SESSION['ckeditor']['UserFilesAbsolutePath'];
|
96 |
|
|
}
|
97 |
85ad3d82
|
Assos Assos
|
}
|
98 |
|
|
else {
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
$baseUrl = strtr(base_path(), array(
|
102 |
|
|
'/modules/ckeditor/ckfinder/core/connector/php' => '',
|
103 |
|
|
)) . variable_get('file_private_path', conf_path() . '/files') . '/';
|
104 |
|
|
$baseDir = resolveUrl($baseUrl);
|
105 |
|
|
} |