@@ -4,21 +4,21 @@ discard block |
||
4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
5 | 5 | |
6 | 6 | |
7 | -if( ! function_exists('evolutionCMS')) { |
|
7 | +if( ! function_exists('evolutionCMS')) { |
|
8 | 8 | /** |
9 | 9 | * @return DocumentParser |
10 | 10 | */ |
11 | - function evolutionCMS() |
|
12 | - { |
|
13 | - if( ! defined('MODX_CLASS')) { |
|
14 | - if( ! class_exists('DocumentParser')) { |
|
11 | + function evolutionCMS() |
|
12 | + { |
|
13 | + if( ! defined('MODX_CLASS')) { |
|
14 | + if( ! class_exists('DocumentParser')) { |
|
15 | 15 | throw new RuntimeException('MODX_CLASS not defined and DocumentParser class not exists'); |
16 | 16 | } |
17 | 17 | define('MODX_CLASS', 'DocumentParser'); |
18 | 18 | } |
19 | 19 | |
20 | 20 | global $modx; |
21 | - if ($modx === null) { |
|
21 | + if ($modx === null) { |
|
22 | 22 | $obj = new ReflectionClass(MODX_CLASS); |
23 | 23 | $modx = $obj->newInstanceWithoutConstructor()->getInstance(); |
24 | 24 | } |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @return string |
31 | 31 | */ |
32 | -function genEvoSessionName() |
|
33 | -{ |
|
32 | +function genEvoSessionName() |
|
33 | +{ |
|
34 | 34 | $_ = crc32(__FILE__); |
35 | 35 | $_ = sprintf('%u', $_); |
36 | 36 | |
@@ -40,10 +40,12 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function startCMSSession() |
|
44 | -{ |
|
43 | +function startCMSSession() |
|
44 | +{ |
|
45 | 45 | global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain; |
46 | - if(MODX_CLI) return; |
|
46 | + if(MODX_CLI) { |
|
47 | + return; |
|
48 | + } |
|
47 | 49 | |
48 | 50 | session_name($site_sessionname); |
49 | 51 | removeInvalidCmsSessionIds($site_sessionname); |
@@ -54,14 +56,14 @@ discard block |
||
54 | 56 | session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
55 | 57 | session_start(); |
56 | 58 | $key = "modx.mgr.session.cookie.lifetime"; |
57 | - if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
59 | + if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
58 | 60 | $cookieLifetime = (int)$_SESSION[$key]; |
59 | - if ($cookieLifetime) { |
|
61 | + if ($cookieLifetime) { |
|
60 | 62 | $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
61 | 63 | } |
62 | 64 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
63 | 65 | } |
64 | - if (!isset($_SESSION['modx.session.created.time'])) { |
|
66 | + if (!isset($_SESSION['modx.session.created.time'])) { |
|
65 | 67 | $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME']; |
66 | 68 | } |
67 | 69 | } |
@@ -71,9 +73,9 @@ discard block |
||
71 | 73 | * @param $session_name |
72 | 74 | * @return void |
73 | 75 | */ |
74 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
75 | -{ |
|
76 | - if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
76 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
77 | +{ |
|
78 | + if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
77 | 79 | unset($storage[$session_name]); |
78 | 80 | } |
79 | 81 | } |
@@ -82,9 +84,11 @@ discard block |
||
82 | 84 | * @param $session_name |
83 | 85 | * @return void |
84 | 86 | */ |
85 | -function removeInvalidCmsSessionIds($session_name) |
|
86 | -{ |
|
87 | - if(MODX_CLI) return; |
|
87 | +function removeInvalidCmsSessionIds($session_name) |
|
88 | +{ |
|
89 | + if(MODX_CLI) { |
|
90 | + return; |
|
91 | + } |
|
88 | 92 | // session ids is invalid iff it is empty string |
89 | 93 | // storage priorioty can see in PHP source ext/session/session.c |
90 | 94 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br /> |
4 | 4 | Please use the EVO Content Manager instead of accessing this file directly."); |
5 | 5 | } |
@@ -10,26 +10,26 @@ discard block |
||
10 | 10 | $modx_textdir = isset($modx_textdir) ? $modx_textdir : null; |
11 | 11 | $onManagerMainFrameHeaderHTMLBlock = is_array($evtOut) ? implode("\n", $evtOut) : ''; |
12 | 12 | $textdir = $modx_textdir === 'rtl' ? 'rtl' : 'ltr'; |
13 | -if (!isset($modx->config['mgr_jquery_path'])) { |
|
13 | +if (!isset($modx->config['mgr_jquery_path'])) { |
|
14 | 14 | $modx->config['mgr_jquery_path'] = 'media/script/jquery/jquery.min.js'; |
15 | 15 | } |
16 | -if (!isset($modx->config['mgr_date_picker_path'])) { |
|
16 | +if (!isset($modx->config['mgr_date_picker_path'])) { |
|
17 | 17 | $modx->config['mgr_date_picker_path'] = 'media/script/air-datepicker/datepicker.inc.php'; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $body_class = ''; |
21 | 21 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness'); |
22 | -if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
|
22 | +if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
|
23 | 23 | $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
24 | -} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
|
24 | +} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
|
25 | 25 | $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
26 | 26 | } |
27 | 27 | |
28 | 28 | $css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime; |
29 | 29 | |
30 | -if ($modx->config['manager_theme'] == 'default') { |
|
30 | +if ($modx->config['manager_theme'] == 'default') { |
|
31 | 31 | if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') |
32 | - && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
32 | + && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
33 | 33 | $files = array( |
34 | 34 | 'bootstrap' => MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css', |
35 | 35 | 'font-awesome' => MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css', |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'source' => 'manager', |
49 | 49 | 'theme' => $modx->config['manager_theme'] |
50 | 50 | )); |
51 | - switch (true) { |
|
51 | + switch (true) { |
|
52 | 52 | case empty($evtOut): |
53 | 53 | case is_array($evtOut) && count($evtOut) === 0: |
54 | 54 | break; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $css |
67 | 67 | ); |
68 | 68 | } |
69 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
69 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
70 | 70 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
71 | 71 | } |
72 | 72 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | <script src="media/script/main.js"></script> |
125 | 125 | <script> |
126 | 126 | <?php |
127 | - if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
|
127 | + if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
|
128 | 128 | echo 'doRefresh(' . $_REQUEST['r'] . ");\n"; |
129 | 129 | } |
130 | 130 | ?> |