Skip to content

Commit d3a2963

Browse files
committed
Docker work update
1 parent d7a3ca0 commit d3a2963

File tree

230 files changed

+442
-607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+442
-607
lines changed

core/includes/define.inc.php

+32-27
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,57 @@
11
<?php
2+
23
use Illuminate\Support\Str;
34

4-
if (! defined('HTTPS_PORT')) {
5+
if (!defined('HTTPS_PORT')) {
56
define('HTTPS_PORT', env('HTTPS_PORT', '443')); //$https_port
67
}
78

8-
if (! defined('SESSION_STORAGE')) {
9+
if (!defined('SESSION_STORAGE')) {
910
define('SESSION_STORAGE', env('SESSION_STORAGE', 'default')); // $session_cookie_path
1011
}
1112

12-
if (! defined('REDIS_HOST')) {
13+
if (!defined('REDIS_HOST')) {
1314
define('REDIS_HOST', env('REDIS_HOST', '127.0.0.1')); // $session_cookie_path
1415
}
1516

16-
if (! defined('REDIS_PORT')) {
17+
if (!defined('REDIS_PORT')) {
1718
define('REDIS_PORT', env('REDIS_PORT', '6379')); // $session_cookie_path
1819
}
1920

20-
if (! defined('SESSION_COOKIE_PATH')) {
21+
if (!defined('SESSION_COOKIE_PATH')) {
2122
define('SESSION_COOKIE_PATH', env('SESSION_COOKIE_PATH', '')); // $session_cookie_path
2223
}
2324

24-
if (! defined('SESSION_COOKIE_DOMAIN')) {
25+
if (!defined('SESSION_COOKIE_DOMAIN')) {
2526
define('SESSION_COOKIE_DOMAIN', env('SESSION_COOKIE_DOMAIN', '')); //$session_cookie_domain
2627
}
2728

28-
if (! defined('SESSION_COOKIE_NAME')) {
29+
if (!defined('SESSION_COOKIE_NAME')) {
2930
// For legacy extras not using startCMSSession
3031
define('SESSION_COOKIE_NAME', env('SESSION_COOKIE_NAME', genEvoSessionName())); // $site_sessionname
3132
}
3233

33-
if (! defined('MODX_CLASS')) {
34+
if (!defined('MODX_CLASS')) {
3435
define('MODX_CLASS', env('MODX_CLASS', '\DocumentParser'));
3536
}
3637

37-
if (! defined('MODX_SITE_HOSTNAMES')) {
38+
if (!defined('MODX_SITE_HOSTNAMES')) {
3839
define('MODX_SITE_HOSTNAMES', env('MODX_SITE_HOSTNAMES', ''));
3940
}
4041

41-
if (! defined('MGR_DIR')) {
42+
if (!defined('MGR_DIR')) {
4243
define('MGR_DIR', env('MGR_DIR', 'manager'));
4344
}
4445

45-
if (! defined('EVO_CORE_PATH')) {
46+
if (!defined('EVO_CORE_PATH')) {
4647
define('EVO_CORE_PATH', env('EVO_CORE_PATH', dirname(__DIR__) . '/'));
4748
}
4849

49-
if (! defined('EVO_STORAGE_PATH')) {
50+
if (!defined('EVO_STORAGE_PATH')) {
5051
define('EVO_STORAGE_PATH', env('EVO_STORAGE_PATH', EVO_CORE_PATH . 'storage/'));
5152
}
5253

53-
if (! defined('MODX_BASE_PATH') || ! defined('MODX_BASE_URL')) {
54+
if (!defined('MODX_BASE_PATH') || !defined('MODX_BASE_URL')) {
5455
// automatically assign base_path and base_url
5556
$script_name = str_replace(
5657
'\\',
@@ -87,7 +88,7 @@
8788

8889
$url = implode($separator, $items);
8990

90-
$base_url = Str::finish(implode($separator, $items),'/');
91+
$base_url = Str::finish(implode($separator, $items), '/');
9192
unset($separator);
9293

9394
reset($items);
@@ -112,34 +113,38 @@
112113
unset($base_url);
113114
}
114115

115-
if (! preg_match('/\/$/', MODX_BASE_PATH)) {
116+
if (!preg_match('/\/$/', MODX_BASE_PATH)) {
116117
throw new RuntimeException('Please, use trailing slash at the end of MODX_BASE_PATH');
117118
}
118119

119-
if (! preg_match('/\/$/', MODX_BASE_URL)) {
120+
if (!preg_match('/\/$/', MODX_BASE_URL)) {
120121
throw new RuntimeException('Please, use trailing slash at the end of MODX_BASE_URL');
121122
}
122123

123-
if (! defined('MODX_MANAGER_PATH')) {
124+
if (!defined('MODX_MANAGER_PATH')) {
124125
define('MODX_MANAGER_PATH', env('MODX_MANAGER_PATH', MODX_BASE_PATH . MGR_DIR . '/'));
125126
}
126127

127-
if (! defined('MODX_SITE_URL')) {
128+
if (!defined('MODX_SITE_URL')) {
128129
// check for valid hostnames
129130
$site_hostname = 'localhost';
130-
if (! is_cli()) {
131+
if (!is_cli()) {
131132
$site_hostname = str_replace(
132133
':' . $_SERVER['SERVER_PORT'],
133134
'',
134135
get_by_key($_SERVER, 'HTTP_HOST', $site_hostname)
135136
);
136137
}
137138
$site_hostnames = explode(',', MODX_SITE_HOSTNAMES);
138-
if (! empty($site_hostnames[0]) && ! in_array($site_hostname, $site_hostnames)) {
139+
if (!empty($site_hostnames[0]) && !in_array($site_hostname, $site_hostnames)) {
139140
$site_hostname = $site_hostnames[0];
140141
}
141142
unset($site_hostnames);
142143

144+
if (!isset($_SERVER['SERVER_PORT'])) {
145+
$_SERVER['SERVER_PORT'] = 80;
146+
}
147+
143148
// assign site_url
144149
if ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') ||
145150
$_SERVER['SERVER_PORT'] == HTTPS_PORT ||
@@ -155,10 +160,10 @@
155160
$site_url = str_replace(':' . $_SERVER['SERVER_PORT'], '', $site_url);
156161
}
157162

158-
if (! in_array((int)$_SERVER['SERVER_PORT'], [80, (int)HTTPS_PORT], true) &&
163+
if (!in_array((int)$_SERVER['SERVER_PORT'], [80, (int)HTTPS_PORT], true) &&
159164
strtolower(get_by_key($_SERVER, 'HTTPS', 'off'))
160165
) {
161-
$site_url .= ':' . $_SERVER['SERVER_PORT'];
166+
$site_url .= ':' . $_SERVER['SERVER_PORT'];
162167
}
163168

164169
$site_url .= MODX_BASE_URL;
@@ -167,25 +172,25 @@
167172
unset($site_url);
168173
}
169174

170-
if (! preg_match('/\/$/', MODX_SITE_URL)) {
175+
if (!preg_match('/\/$/', MODX_SITE_URL)) {
171176
throw new RuntimeException('Please, use trailing slash at the end of MODX_SITE_URL');
172177
}
173178

174-
if (! defined('MODX_MANAGER_URL')) {
179+
if (!defined('MODX_MANAGER_URL')) {
175180
define('MODX_MANAGER_URL', env('MODX_MANAGER_URL', MODX_SITE_URL . MGR_DIR . '/'));
176181
}
177182

178-
if (! defined('MODX_SANITIZE_SEED')) {
183+
if (!defined('MODX_SANITIZE_SEED')) {
179184
define('MODX_SANITIZE_SEED', 'sanitize_seed_' . base_convert(md5(__FILE__), 16, 36));
180185
}
181186

182187
if (is_cli()) {
183188
define('MODX_CLI', true);
184-
if (! (defined('MODX_BASE_PATH') || defined('MODX_BASE_URL'))) {
189+
if (!(defined('MODX_BASE_PATH') || defined('MODX_BASE_URL'))) {
185190
throw new RuntimeException('Please, define MODX_BASE_PATH and MODX_BASE_URL on cli mode');
186191
}
187192

188-
if (! defined('MODX_SITE_URL')) {
193+
if (!defined('MODX_SITE_URL')) {
189194
throw new RuntimeException('Please, define MODX_SITE_URL on cli mode');
190195
}
191196
}

core/src/ExceptionHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public function messageQuit(
409409
}
410410

411411
echo "\n", $this->renderConsoleBacktrace($backtrace);
412-
} else if ($this->shouldDisplay()) {
412+
} else if (!$this->shouldDisplay()) {
413413
$version = isset($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
414414
$release_date = isset($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
415415

core/src/Middleware/VerifyCsrfToken.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class VerifyCsrfToken
66
{
77
public function handle($request, Closure $next)
88
{
9-
if ($_SESSION['_token'] !== $request->input('_token')) {
9+
if ($request->has('_token') && isset($_SESSION['_token']) && $_SESSION['_token'] !== $request->input('_token')) {
1010
return \Response::json(['error' => 'CSRF token mismatch'], '403');
1111

1212
}

0 commit comments

Comments
 (0)