-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap_context.php
166 lines (151 loc) · 6.53 KB
/
bootstrap_context.php
1
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
/*
* Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io>
* This file is part of Pydio.
*
* Pydio is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pydio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
*
* The latest code can be found at <https://pydio.com>.
*
* This is the main configuration file for configuring the core of the application.
* In a standard usage, you should not have to change any variables.
*/
@date_default_timezone_set(@date_default_timezone_get());
if (function_exists("xdebug_disable")) {
xdebug_disable();
}
@error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
//Windows users may have to uncomment this
//setlocale(LC_ALL, '');
@libxml_disable_entity_loader(false);
@include_once("VERSION.php");
if(!defined("AJXP_VERSION")){
list($vNmber,$vDate,$vRevision,$vDbVersion) = explode("__",file_get_contents(AJXP_CONF_PATH."/VERSION"));
define("AJXP_VERSION", $vNmber);
define("AJXP_VERSION_DATE", $vDate);
if(!empty($vRevision)) define("AJXP_VERSION_REV", $vRevision);
if(!empty($vDbVersion)) define("AJXP_VERSION_DB", intval($vDbVersion));
}
define("AJXP_EXEC", true);
//get subdomain
$subdomain = explode('.', $_SERVER['SERVER_NAME'], 2)[0];
// APPLICATION PATHES CONFIGURATION
//define("AJXP_DATA_PATH", "/var/lib/pydio/data");
// data path per subdomain
define("AJXP_DATA_PATH", AJXP_INSTALL_PATH."/".$subdomain);
define("AJXP_CACHE_DIR", AJXP_DATA_PATH."/cache");
define("AJXP_SHARED_CACHE_DIR", AJXP_DATA_PATH."/shared-cache");
define("AJXP_PLUGINS_CACHE_FILE", AJXP_CACHE_DIR."/plugins_cache.ser");
define("AJXP_PLUGINS_REQUIRES_FILE", AJXP_CACHE_DIR."/plugins_requires.ser");
define("AJXP_PLUGINS_QUERIES_CACHE", AJXP_CACHE_DIR."/plugins_queries.ser");
define("AJXP_PLUGINS_BOOTSTRAP_CACHE", AJXP_CACHE_DIR."/plugins_bootstrap.php");
define("AJXP_PLUGINS_REPOSITORIES_CACHE", AJXP_CACHE_DIR."/plugins_repositories.php");
define("AJXP_PLUGINS_MESSAGES_FILE", AJXP_CACHE_DIR."/plugins_messages.ser");
define("AJXP_SERVER_ACCESS", "index.php");
define("AJXP_PLUGINS_FOLDER", "plugins");
define("AJXP_BIN_FOLDER_REL", "core/src");
define("AJXP_VENDOR_FOLDER_REL", "core/vendor");
define("AJXP_BIN_FOLDER", AJXP_INSTALL_PATH."/core/src");
define("AJXP_VENDOR_FOLDER", AJXP_INSTALL_PATH."/core/vendor");
define("AJXP_DOCS_FOLDER", "core/doc");
define("AJXP_COREI18N_FOLDER", AJXP_INSTALL_PATH."/plugins/core.ajaxplorer/i18n");
define("TESTS_RESULT_FILE", AJXP_DATA_PATH."/plugins/boot.conf/diag_result.php");
define("TESTS_RESULT_FILE_LEGACY", AJXP_CACHE_DIR."/diag_result.php");
define("AJXP_TESTS_FOLDER", AJXP_BIN_FOLDER."/pydio/Tests");
define("INITIAL_ADMIN_PASSWORD", "admin");
// Startup admin password (used at first creation). Once
// The admin password is created and his password is changed,
// this config has no more impact.
define("ADMIN_PASSWORD", "admin");
// For a specific distribution, you can specify where the
// log files will be stored. This should be detected by log.* plugins
// and used if defined. See bootstrap_plugins.php default configs for
// example in log.serial. Do not forget the trailing slash
define("AJXP_FORCE_LOGPATH", "/var/log/pydio/");
// DEBUG OPTIONS
define("AJXP_CLIENT_DEBUG" , false);
define("AJXP_SERVER_DEBUG" , false);
define("AJXP_SKIP_CACHE" , false);
// PBKDF2 CONSTANTS FOR A SECURE STORAGE OF PASSWORDS
// These constants may be changed without breaking existing hashes.
define("PBKDF2_HASH_ALGORITHM", "sha256");
define("PBKDF2_ITERATIONS", 1000);
define("PBKDF2_SALT_BYTE_SIZE", 24);
define("PBKDF2_HASH_BYTE_SIZE", 24);
define("HASH_SECTIONS", 4);
define("HASH_ALGORITHM_INDEX", 0);
define("HASH_ITERATION_INDEX", 1);
define("HASH_SALT_INDEX", 2);
define("HASH_PBKDF2_INDEX", 3);
// Used to identify the booster admin tasks
define("PYDIO_BOOSTER_TASK_IDENTIFIER", "pydio-booster");
// CAN BE SWITCHED TO TRUE TO MAKE THE SECURE TOKEN MORE SAFE
// MAKE SURE YOU HAVE PHP.5.3, OPENSSL, AND THAT IT DOES NOT DEGRADE PERFORMANCES
define("USE_OPENSSL_RANDOM", false);
require_once (AJXP_VENDOR_FOLDER . "/autoload.php");
$corePlugAutoloads = glob(AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/core.*/vendor/autoload.php", GLOB_NOSORT);
if ($corePlugAutoloads !== false && count($corePlugAutoloads)) {
foreach($corePlugAutoloads as $autoloader){
require_once ($autoloader);
}
}
/**
* Used as autoloader
* @param $className
*/
function pydioAutoloader($className)
{
// Temp : super dummy autoloader, take only class name
$parts = explode("\\", $className);
$className = array_pop($parts);
if($className == "dibi"){
require_once(AJXP_BIN_FOLDER."/lib/dibi/dibi.php");
}
$corePlugClass = glob(AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/core.*/".$className.".php", GLOB_NOSORT);
if ($corePlugClass !== false && count($corePlugClass)) {
require_once($corePlugClass[0]);
return;
}
}
spl_autoload_register('pydioAutoloader');
include_once(AJXP_INSTALL_PATH . "/core/compat.php");
use Pydio\Core\Services\ApplicationState;
ApplicationState::safeIniSet("session.cookie_httponly", 1);
if (is_file(AJXP_CONF_PATH."/bootstrap_conf.php")) {
include(AJXP_CONF_PATH."/bootstrap_conf.php");
if (isSet($AJXP_INISET)) {
foreach($AJXP_INISET as $key => $value) ApplicationState::safeIniSet($key, $value);
}
if (defined('AJXP_LOCALE')) {
setlocale(LC_CTYPE, AJXP_LOCALE);
}else if(file_exists(AJXP_DATA_PATH."/plugins/boot.conf/encoding.php")){
require_once(AJXP_DATA_PATH."/plugins/boot.conf/encoding.php");
if(isSet($ROOT_ENCODING)){
setlocale(LC_CTYPE, $ROOT_ENCODING);
}
}
}
if(!is_file(AJXP_PLUGINS_BOOTSTRAP_CACHE)){
$content = "<?php \n";
$boots = glob(AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/*/bootstrap.php");
if($boots !== false){
foreach($boots as $b){
$content .= 'require_once("'.$b.'");'."\n";
}
}
$resWriteBootstrapCache = @file_put_contents(AJXP_PLUGINS_BOOTSTRAP_CACHE, $content);
}
if(!isSet($resWriteBootstrapCache) || $resWriteBootstrapCache !== false){
require_once(AJXP_PLUGINS_BOOTSTRAP_CACHE);
}