|
@@ -18,13 +18,13 @@ discard block |
|
|
block discarded – undo |
|
18
|
18
|
} |
|
19
|
19
|
|
|
20
|
20
|
// andrazk 20070416 - if installer is running, destroy active sessions |
|
21
|
|
-if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
|
22
|
|
- include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
|
21
|
+if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) { |
|
|
22
|
+ include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
23
|
23
|
if (isset($installStartTime)) { |
|
24
|
24
|
if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
25
|
25
|
unset($installStartTime); |
|
26
|
|
- @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
|
27
|
|
- unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
|
26
|
+ @ chmod(MODX_BASE_PATH.'assets/cache/installProc.inc.php', 0755); |
|
|
27
|
+ unlink(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
28
|
28
|
} else { |
|
29
|
29
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
30
|
30
|
if (isset($_COOKIE[session_name()])) { |
|
@@ -50,7 +50,7 @@ discard block |
|
|
block discarded – undo |
|
50
|
50
|
// setcookie(session_name(), '', 0, MODX_BASE_URL); |
|
51
|
51
|
} |
|
52
|
52
|
header('HTTP/1.0 307 Redirect'); |
|
53
|
|
- header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2'); |
|
|
53
|
+ header('Location: '.MODX_MANAGER_URL.'index.php?installGoingOn=2'); |
|
54
|
54
|
} |
|
55
|
55
|
} |
|
56
|
56
|
} |
|
@@ -62,7 +62,7 @@ discard block |
|
|
block discarded – undo |
|
62
|
62
|
// establish fallback to English default |
|
63
|
63
|
include_once "lang/english.inc.php"; |
|
64
|
64
|
// include localized overrides |
|
65
|
|
- include_once "lang/" . $manager_language . ".inc.php"; |
|
|
65
|
+ include_once "lang/".$manager_language.".inc.php"; |
|
66
|
66
|
} else { |
|
67
|
67
|
include_once "lang/english.inc.php"; |
|
68
|
68
|
} |
|
@@ -70,7 +70,7 @@ discard block |
|
|
block discarded – undo |
|
70
|
70
|
$modx->setPlaceholder('modx_charset', $modx_manager_charset); |
|
71
|
71
|
$modx->setPlaceholder('theme', $manager_theme); |
|
72
|
72
|
$modx->setPlaceholder('favicon', |
|
73
|
|
- (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico')); |
|
|
73
|
+ (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico')); |
|
74
|
74
|
|
|
75
|
75
|
// invoke OnManagerLoginFormPrerender event |
|
76
|
76
|
$evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender'); |
|
@@ -81,25 +81,25 @@ discard block |
|
|
block discarded – undo |
|
81
|
81
|
$modx->setPlaceholder('manager_path', MGR_DIR); |
|
82
|
82
|
$modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
|
83
|
83
|
$modx->setPlaceholder('login_message', $_lang["login_message"]); |
|
84
|
|
- $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
|
84
|
+ $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
85
|
85
|
$modx->setPlaceholder('year', date('Y')); |
|
86
|
86
|
|
|
87
|
87
|
// set login logo image |
|
88
|
|
- if ( !empty($modx->config['login_logo']) ) { |
|
89
|
|
- $modx->setPlaceholder('login_logo', MODX_SITE_URL . $modx->config['login_logo']); |
|
|
88
|
+ if (!empty($modx->config['login_logo'])) { |
|
|
89
|
+ $modx->setPlaceholder('login_logo', MODX_SITE_URL.$modx->config['login_logo']); |
|
90
|
90
|
} else { |
|
91
|
|
- $modx->setPlaceholder('login_logo', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-logo.png'); |
|
|
91
|
+ $modx->setPlaceholder('login_logo', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-logo.png'); |
|
92
|
92
|
} |
|
93
|
93
|
|
|
94
|
94
|
// set login background image |
|
95
|
|
- if ( !empty($modx->config['login_bg']) ) { |
|
96
|
|
- $modx->setPlaceholder('login_bg', MODX_SITE_URL . $modx->config['login_bg']); |
|
|
95
|
+ if (!empty($modx->config['login_bg'])) { |
|
|
96
|
+ $modx->setPlaceholder('login_bg', MODX_SITE_URL.$modx->config['login_bg']); |
|
97
|
97
|
} else { |
|
98
|
|
- $modx->setPlaceholder('login_bg', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-background.jpg'); |
|
|
98
|
+ $modx->setPlaceholder('login_bg', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-background.jpg'); |
|
99
|
99
|
} |
|
100
|
100
|
|
|
101
|
101
|
// set form position css class |
|
102
|
|
- $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']); |
|
|
102
|
+ $modx->setPlaceholder('login_form_position_class', 'loginbox-'.$modx->config['login_form_position']); |
|
103
|
103
|
|
|
104
|
104
|
switch ($modx->config['manager_theme_mode']) { |
|
105
|
105
|
case '1': |
|
@@ -124,11 +124,11 @@ discard block |
|
|
block discarded – undo |
|
124
|
124
|
switch ($installGoingOn) { |
|
125
|
125
|
case 1 : |
|
126
|
126
|
$modx->setPlaceholder('login_message', |
|
127
|
|
- "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
|
127
|
+ "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>"); |
|
128
|
128
|
break; |
|
129
|
129
|
case 2 : |
|
130
|
130
|
$modx->setPlaceholder('login_message', |
|
131
|
|
- "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
|
131
|
+ "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>"); |
|
132
|
132
|
break; |
|
133
|
133
|
} |
|
134
|
134
|
} |
|
@@ -136,9 +136,9 @@ discard block |
|
|
block discarded – undo |
|
136
|
136
|
if ($modx->config['use_captcha'] == 1) { |
|
137
|
137
|
$modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
|
138
|
138
|
$modx->setPlaceholder('captcha_image', |
|
139
|
|
- '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>'); |
|
|
139
|
+ '<a href="'.MODX_MANAGER_URL.'" class="loginCaptcha"><img id="captcha_image" src="'.MODX_MANAGER_URL.'includes/veriword.php?rand='.rand().'" alt="'.$_lang["login_captcha_message"].'" /></a>'); |
|
140
|
140
|
$modx->setPlaceholder('captcha_input', |
|
141
|
|
- '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
|
141
|
+ '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
142
|
142
|
} |
|
143
|
143
|
|
|
144
|
144
|
// login info |
|
@@ -156,7 +156,7 @@ discard block |
|
|
block discarded – undo |
|
156
|
156
|
|
|
157
|
157
|
// invoke OnManagerLoginFormRender event |
|
158
|
158
|
$evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
|
159
|
|
- $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
|
159
|
+ $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : ''; |
|
160
|
160
|
$modx->setPlaceholder('OnManagerLoginFormRender', $html); |
|
161
|
161
|
|
|
162
|
162
|
// load template |
|
@@ -174,29 +174,29 @@ discard block |
|
|
block discarded – undo |
|
174
|
174
|
$login_tpl = file_get_contents($target); |
|
175
|
175
|
} |
|
176
|
176
|
} else { |
|
177
|
|
- $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
178
|
|
- if (is_file($theme_path . 'style.php')) { |
|
179
|
|
- include($theme_path . 'style.php'); |
|
|
177
|
+ $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/'; |
|
|
178
|
+ if (is_file($theme_path.'style.php')) { |
|
|
179
|
+ include($theme_path.'style.php'); |
|
180
|
180
|
} |
|
181
|
181
|
$chunk = $modx->getChunk($target); |
|
182
|
182
|
if ($chunk !== false && !empty($chunk)) { |
|
183
|
183
|
$login_tpl = $chunk; |
|
184
|
|
- } elseif (is_file(MODX_BASE_PATH . $target)) { |
|
185
|
|
- $target = MODX_BASE_PATH . $target; |
|
|
184
|
+ } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
|
185
|
+ $target = MODX_BASE_PATH.$target; |
|
186
|
186
|
$login_tpl = file_get_contents($target); |
|
187
|
187
|
} elseif (is_file($target)) { |
|
188
|
188
|
$login_tpl = file_get_contents($target); |
|
189
|
|
- } elseif (is_file($theme_path . 'login.tpl')) { |
|
190
|
|
- $target = $theme_path . 'login.tpl'; |
|
|
189
|
+ } elseif (is_file($theme_path.'login.tpl')) { |
|
|
190
|
+ $target = $theme_path.'login.tpl'; |
|
191
|
191
|
$login_tpl = file_get_contents($target); |
|
192
|
|
- } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
|
193
|
|
- $target = $theme_path . 'templates/actions/login.tpl'; |
|
|
192
|
+ } elseif (is_file($theme_path.'templates/actions/login.tpl')) { |
|
|
193
|
+ $target = $theme_path.'templates/actions/login.tpl'; |
|
194
|
194
|
$login_tpl = file_get_contents($target); |
|
195
|
|
- } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
196
|
|
- $target = $theme_path . 'html/login.html'; |
|
|
195
|
+ } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible |
|
|
196
|
+ $target = $theme_path.'html/login.html'; |
|
197
|
197
|
$login_tpl = file_get_contents($target); |
|
198
|
198
|
} else { |
|
199
|
|
- $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
|
199
|
+ $target = MODX_MANAGER_PATH.'media/style/common/login.tpl'; |
|
200
|
200
|
$login_tpl = file_get_contents($target); |
|
201
|
201
|
} |
|
202
|
202
|
} |
|
@@ -216,17 +216,17 @@ discard block |
|
|
block discarded – undo |
|
216
|
216
|
$modx->updateValidatedUserSession(); |
|
217
|
217
|
|
|
218
|
218
|
// Update last action in table active_users |
|
219
|
|
- $itemid = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
|
219
|
+ $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
220
|
220
|
$lasthittime = time(); |
|
221
|
|
- $action = isset($_REQUEST['a']) ? (int)$_REQUEST['a'] : 1; |
|
|
221
|
+ $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
|
222
|
222
|
|
|
223
|
223
|
if ($action !== 1) { |
|
224
|
|
- if ((int)$itemid <= 0) { |
|
|
224
|
+ if ((int) $itemid <= 0) { |
|
225
|
225
|
$itemid = null; |
|
226
|
226
|
} |
|
227
|
227
|
$sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", |
|
228
|
228
|
$modx->getFullTableName('active_users') // Table |
|
229
|
|
- , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string)$action, |
|
|
229
|
+ , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, |
|
230
|
230
|
$itemid == null ? var_export(null, true) : $itemid); |
|
231
|
231
|
$modx->db->query($sql); |
|
232
|
232
|
} |