@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | if(file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
22 | 22 | include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
23 | 23 | if(isset($installStartTime)) { |
24 | - if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
24 | + if((time() - $installStartTime) > 5 * 60) { |
|
25 | +// if install flag older than 5 minutes, discard |
|
25 | 26 | unset($installStartTime); |
26 | 27 | @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
27 | 28 | unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
@@ -155,7 +156,8 @@ discard block |
||
155 | 156 | } elseif(is_file($theme_path . 'templates/actions/login.tpl')) { |
156 | 157 | $target = $theme_path . 'templates/actions/login.tpl'; |
157 | 158 | $login_tpl = file_get_contents($target); |
158 | - } elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
159 | + } elseif(is_file($theme_path . 'html/login.html')) { |
|
160 | +// ClipperCMS compatible |
|
159 | 161 | $target = $theme_path . 'html/login.html'; |
160 | 162 | $login_tpl = file_get_contents($target); |
161 | 163 | } else { |
@@ -1,193 +1,193 @@ |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
7 | - header('HTTP/1.0 404 Not Found'); |
|
8 | - exit; |
|
7 | + header('HTTP/1.0 404 Not Found'); |
|
8 | + exit; |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | if(isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') { |
12 | - // if (isset($_COOKIE[session_name()])) { |
|
13 | - // setcookie(session_name(), '', 0, MODX_BASE_URL); |
|
14 | - // } |
|
15 | - @session_destroy(); |
|
16 | - // start session |
|
17 | - // startCMSSession(); |
|
12 | + // if (isset($_COOKIE[session_name()])) { |
|
13 | + // setcookie(session_name(), '', 0, MODX_BASE_URL); |
|
14 | + // } |
|
15 | + @session_destroy(); |
|
16 | + // start session |
|
17 | + // startCMSSession(); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | // andrazk 20070416 - if installer is running, destroy active sessions |
21 | 21 | if(file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
22 | - include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
23 | - if(isset($installStartTime)) { |
|
24 | - if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
25 | - unset($installStartTime); |
|
26 | - @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
|
27 | - unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
28 | - } else { |
|
29 | - if($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
30 | - if(isset($_COOKIE[session_name()])) { |
|
31 | - session_unset(); |
|
32 | - @session_destroy(); |
|
33 | - // setcookie(session_name(), '', 0, MODX_BASE_URL); |
|
34 | - } |
|
35 | - $installGoingOn = 1; |
|
36 | - } |
|
37 | - } |
|
38 | - } |
|
22 | + include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
23 | + if(isset($installStartTime)) { |
|
24 | + if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
25 | + unset($installStartTime); |
|
26 | + @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
|
27 | + unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
28 | + } else { |
|
29 | + if($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
30 | + if(isset($_COOKIE[session_name()])) { |
|
31 | + session_unset(); |
|
32 | + @session_destroy(); |
|
33 | + // setcookie(session_name(), '', 0, MODX_BASE_URL); |
|
34 | + } |
|
35 | + $installGoingOn = 1; |
|
36 | + } |
|
37 | + } |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // andrazk 20070416 - if session started before install and was not destroyed yet |
42 | 42 | if(isset($lastInstallTime)) { |
43 | - if(isset($_SESSION['mgrValidated'])) { |
|
44 | - if(isset($_SESSION['modx.session.created.time'])) { |
|
45 | - if($_SESSION['modx.session.created.time'] < $lastInstallTime) { |
|
46 | - if($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
47 | - if(isset($_COOKIE[session_name()])) { |
|
48 | - session_unset(); |
|
49 | - @session_destroy(); |
|
50 | - // setcookie(session_name(), '', 0, MODX_BASE_URL); |
|
51 | - } |
|
52 | - header('HTTP/1.0 307 Redirect'); |
|
53 | - header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2'); |
|
54 | - } |
|
55 | - } |
|
56 | - } |
|
57 | - } |
|
43 | + if(isset($_SESSION['mgrValidated'])) { |
|
44 | + if(isset($_SESSION['modx.session.created.time'])) { |
|
45 | + if($_SESSION['modx.session.created.time'] < $lastInstallTime) { |
|
46 | + if($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
47 | + if(isset($_COOKIE[session_name()])) { |
|
48 | + session_unset(); |
|
49 | + @session_destroy(); |
|
50 | + // setcookie(session_name(), '', 0, MODX_BASE_URL); |
|
51 | + } |
|
52 | + header('HTTP/1.0 307 Redirect'); |
|
53 | + header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2'); |
|
54 | + } |
|
55 | + } |
|
56 | + } |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if(!isset($_SESSION['mgrValidated'])) { |
61 | - if(isset($manager_language)) { |
|
62 | - // establish fallback to English default |
|
63 | - include_once "lang/english.inc.php"; |
|
64 | - // include localized overrides |
|
65 | - include_once "lang/" . $manager_language . ".inc.php"; |
|
66 | - } else { |
|
67 | - include_once "lang/english.inc.php"; |
|
68 | - } |
|
69 | - |
|
70 | - $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
|
71 | - $modx->setPlaceholder('theme', $manager_theme); |
|
61 | + if(isset($manager_language)) { |
|
62 | + // establish fallback to English default |
|
63 | + include_once "lang/english.inc.php"; |
|
64 | + // include localized overrides |
|
65 | + include_once "lang/" . $manager_language . ".inc.php"; |
|
66 | + } else { |
|
67 | + include_once "lang/english.inc.php"; |
|
68 | + } |
|
69 | + |
|
70 | + $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
|
71 | + $modx->setPlaceholder('theme', $manager_theme); |
|
72 | 72 | $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico')); |
73 | 73 | |
74 | - // invoke OnManagerLoginFormPrerender event |
|
75 | - $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender'); |
|
76 | - $html = is_array($evtOut) ? implode('', $evtOut) : ''; |
|
77 | - $modx->setPlaceholder('OnManagerLoginFormPrerender', $html); |
|
78 | - |
|
79 | - $modx->setPlaceholder('site_name', $site_name); |
|
80 | - $modx->setPlaceholder('manager_path', MGR_DIR); |
|
81 | - $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
|
82 | - $modx->setPlaceholder('login_message', $_lang["login_message"]); |
|
83 | - $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
84 | - $modx->setPlaceholder('year', date('Y')); |
|
85 | - $modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : '')); |
|
86 | - |
|
87 | - // andrazk 20070416 - notify user of install/update |
|
88 | - if(isset($_GET['installGoingOn'])) { |
|
89 | - $installGoingOn = $_GET['installGoingOn']; |
|
90 | - } |
|
91 | - if(isset($installGoingOn)) { |
|
92 | - switch($installGoingOn) { |
|
93 | - case 1 : |
|
94 | - $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
95 | - break; |
|
96 | - case 2 : |
|
97 | - $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
98 | - break; |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - if($modx->config['use_captcha'] == 1) { |
|
103 | - $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
|
104 | - $modx->setPlaceholder('captcha_image', '<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>'); |
|
105 | - $modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
106 | - } |
|
107 | - |
|
108 | - // login info |
|
109 | - $uid = isset($_COOKIE['modx_remember_manager']) ? preg_replace('/[^a-zA-Z0-9\-_@\.]*/', '', $_COOKIE['modx_remember_manager']) : ''; |
|
110 | - $modx->setPlaceholder('uid', $uid); |
|
111 | - $modx->setPlaceholder('username', $_lang["username"]); |
|
112 | - $modx->setPlaceholder('password', $_lang["password"]); |
|
113 | - |
|
114 | - // remember me |
|
115 | - $html = isset($_COOKIE['modx_remember_manager']) ? 'checked="checked"' : ''; |
|
116 | - $modx->setPlaceholder('remember_me', $html); |
|
117 | - $modx->setPlaceholder('remember_username', $_lang["remember_username"]); |
|
118 | - $modx->setPlaceholder('login_button', $_lang["login_button"]); |
|
119 | - |
|
120 | - // invoke OnManagerLoginFormRender event |
|
121 | - $evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
|
122 | - $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
123 | - $modx->setPlaceholder('OnManagerLoginFormRender', $html); |
|
124 | - |
|
125 | - // load template |
|
126 | - $target = $modx->getConfig('manager_login_tpl'); |
|
127 | - $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
|
128 | - $target = $modx->mergeSettingsContent($target); |
|
129 | - |
|
130 | - $login_tpl = null; |
|
131 | - if(substr($target, 0, 1) === '@') { |
|
132 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
133 | - $target = trim(substr($target, 7)); |
|
134 | - $login_tpl = $modx->getChunk($target); |
|
135 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
136 | - $target = trim(substr($target, 6)); |
|
137 | - $login_tpl = file_get_contents($target); |
|
138 | - } |
|
139 | - } else { |
|
140 | - $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
141 | - if(is_file($theme_path . 'style.php')) { |
|
142 | - include($theme_path . 'style.php'); |
|
143 | - } |
|
144 | - $chunk = $modx->getChunk($target); |
|
145 | - if($chunk !== false && !empty($chunk)) { |
|
146 | - $login_tpl = $chunk; |
|
147 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
148 | - $target = MODX_BASE_PATH . $target; |
|
149 | - $login_tpl = file_get_contents($target); |
|
150 | - } elseif(is_file($target)) { |
|
151 | - $login_tpl = file_get_contents($target); |
|
152 | - } elseif(is_file($theme_path . 'login.tpl')) { |
|
153 | - $target = $theme_path . 'login.tpl'; |
|
154 | - $login_tpl = file_get_contents($target); |
|
155 | - } elseif(is_file($theme_path . 'templates/actions/login.tpl')) { |
|
156 | - $target = $theme_path . 'templates/actions/login.tpl'; |
|
157 | - $login_tpl = file_get_contents($target); |
|
158 | - } elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
159 | - $target = $theme_path . 'html/login.html'; |
|
160 | - $login_tpl = file_get_contents($target); |
|
161 | - } else { |
|
162 | - $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
163 | - $login_tpl = file_get_contents($target); |
|
164 | - } |
|
165 | - } |
|
166 | - |
|
167 | - // merge placeholders |
|
168 | - $login_tpl = $modx->mergePlaceholderContent($login_tpl); |
|
169 | - $regx = strpos($login_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers |
|
170 | - $login_tpl = preg_replace($regx, '', $login_tpl); //cleanup |
|
171 | - |
|
172 | - echo $login_tpl; |
|
173 | - |
|
174 | - exit; |
|
74 | + // invoke OnManagerLoginFormPrerender event |
|
75 | + $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender'); |
|
76 | + $html = is_array($evtOut) ? implode('', $evtOut) : ''; |
|
77 | + $modx->setPlaceholder('OnManagerLoginFormPrerender', $html); |
|
78 | + |
|
79 | + $modx->setPlaceholder('site_name', $site_name); |
|
80 | + $modx->setPlaceholder('manager_path', MGR_DIR); |
|
81 | + $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
|
82 | + $modx->setPlaceholder('login_message', $_lang["login_message"]); |
|
83 | + $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
84 | + $modx->setPlaceholder('year', date('Y')); |
|
85 | + $modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : '')); |
|
86 | + |
|
87 | + // andrazk 20070416 - notify user of install/update |
|
88 | + if(isset($_GET['installGoingOn'])) { |
|
89 | + $installGoingOn = $_GET['installGoingOn']; |
|
90 | + } |
|
91 | + if(isset($installGoingOn)) { |
|
92 | + switch($installGoingOn) { |
|
93 | + case 1 : |
|
94 | + $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
95 | + break; |
|
96 | + case 2 : |
|
97 | + $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
98 | + break; |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + if($modx->config['use_captcha'] == 1) { |
|
103 | + $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
|
104 | + $modx->setPlaceholder('captcha_image', '<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>'); |
|
105 | + $modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
106 | + } |
|
107 | + |
|
108 | + // login info |
|
109 | + $uid = isset($_COOKIE['modx_remember_manager']) ? preg_replace('/[^a-zA-Z0-9\-_@\.]*/', '', $_COOKIE['modx_remember_manager']) : ''; |
|
110 | + $modx->setPlaceholder('uid', $uid); |
|
111 | + $modx->setPlaceholder('username', $_lang["username"]); |
|
112 | + $modx->setPlaceholder('password', $_lang["password"]); |
|
113 | + |
|
114 | + // remember me |
|
115 | + $html = isset($_COOKIE['modx_remember_manager']) ? 'checked="checked"' : ''; |
|
116 | + $modx->setPlaceholder('remember_me', $html); |
|
117 | + $modx->setPlaceholder('remember_username', $_lang["remember_username"]); |
|
118 | + $modx->setPlaceholder('login_button', $_lang["login_button"]); |
|
119 | + |
|
120 | + // invoke OnManagerLoginFormRender event |
|
121 | + $evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
|
122 | + $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
123 | + $modx->setPlaceholder('OnManagerLoginFormRender', $html); |
|
124 | + |
|
125 | + // load template |
|
126 | + $target = $modx->getConfig('manager_login_tpl'); |
|
127 | + $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
|
128 | + $target = $modx->mergeSettingsContent($target); |
|
129 | + |
|
130 | + $login_tpl = null; |
|
131 | + if(substr($target, 0, 1) === '@') { |
|
132 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
133 | + $target = trim(substr($target, 7)); |
|
134 | + $login_tpl = $modx->getChunk($target); |
|
135 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
136 | + $target = trim(substr($target, 6)); |
|
137 | + $login_tpl = file_get_contents($target); |
|
138 | + } |
|
139 | + } else { |
|
140 | + $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
141 | + if(is_file($theme_path . 'style.php')) { |
|
142 | + include($theme_path . 'style.php'); |
|
143 | + } |
|
144 | + $chunk = $modx->getChunk($target); |
|
145 | + if($chunk !== false && !empty($chunk)) { |
|
146 | + $login_tpl = $chunk; |
|
147 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
148 | + $target = MODX_BASE_PATH . $target; |
|
149 | + $login_tpl = file_get_contents($target); |
|
150 | + } elseif(is_file($target)) { |
|
151 | + $login_tpl = file_get_contents($target); |
|
152 | + } elseif(is_file($theme_path . 'login.tpl')) { |
|
153 | + $target = $theme_path . 'login.tpl'; |
|
154 | + $login_tpl = file_get_contents($target); |
|
155 | + } elseif(is_file($theme_path . 'templates/actions/login.tpl')) { |
|
156 | + $target = $theme_path . 'templates/actions/login.tpl'; |
|
157 | + $login_tpl = file_get_contents($target); |
|
158 | + } elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
159 | + $target = $theme_path . 'html/login.html'; |
|
160 | + $login_tpl = file_get_contents($target); |
|
161 | + } else { |
|
162 | + $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
163 | + $login_tpl = file_get_contents($target); |
|
164 | + } |
|
165 | + } |
|
166 | + |
|
167 | + // merge placeholders |
|
168 | + $login_tpl = $modx->mergePlaceholderContent($login_tpl); |
|
169 | + $regx = strpos($login_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers |
|
170 | + $login_tpl = preg_replace($regx, '', $login_tpl); //cleanup |
|
171 | + |
|
172 | + echo $login_tpl; |
|
173 | + |
|
174 | + exit; |
|
175 | 175 | |
176 | 176 | } else { |
177 | - // Update table active_user_sessions |
|
178 | - $modx->updateValidatedUserSession(); |
|
179 | - |
|
180 | - // Update last action in table active_users |
|
181 | - $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
182 | - $lasthittime = time(); |
|
183 | - $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
|
184 | - |
|
185 | - if($action !== 1) { |
|
186 | - if(!intval($itemid)) { |
|
187 | - $itemid = null; |
|
188 | - } |
|
189 | - $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table |
|
190 | - , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, $itemid == null ? var_export(null, true) : $itemid); |
|
191 | - $modx->db->query($sql); |
|
192 | - } |
|
177 | + // Update table active_user_sessions |
|
178 | + $modx->updateValidatedUserSession(); |
|
179 | + |
|
180 | + // Update last action in table active_users |
|
181 | + $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
182 | + $lasthittime = time(); |
|
183 | + $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
|
184 | + |
|
185 | + if($action !== 1) { |
|
186 | + if(!intval($itemid)) { |
|
187 | + $itemid = null; |
|
188 | + } |
|
189 | + $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table |
|
190 | + , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, $itemid == null ? var_export(null, true) : $itemid); |
|
191 | + $modx->db->query($sql); |
|
192 | + } |
|
193 | 193 | } |
@@ -1,14 +1,14 @@ 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 />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
6 | +if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
7 | 7 | header('HTTP/1.0 404 Not Found'); |
8 | 8 | exit; |
9 | 9 | } |
10 | 10 | |
11 | -if(isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') { |
|
11 | +if (isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') { |
|
12 | 12 | // if (isset($_COOKIE[session_name()])) { |
13 | 13 | // setcookie(session_name(), '', 0, MODX_BASE_URL); |
14 | 14 | // } |
@@ -18,16 +18,16 @@ discard block |
||
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'); |
|
23 | - if(isset($installStartTime)) { |
|
24 | - if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
21 | +if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) { |
|
22 | + include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
23 | + if (isset($installStartTime)) { |
|
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 | - if($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
30 | - if(isset($_COOKIE[session_name()])) { |
|
29 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
30 | + if (isset($_COOKIE[session_name()])) { |
|
31 | 31 | session_unset(); |
32 | 32 | @session_destroy(); |
33 | 33 | // setcookie(session_name(), '', 0, MODX_BASE_URL); |
@@ -39,37 +39,37 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | // andrazk 20070416 - if session started before install and was not destroyed yet |
42 | -if(isset($lastInstallTime)) { |
|
43 | - if(isset($_SESSION['mgrValidated'])) { |
|
44 | - if(isset($_SESSION['modx.session.created.time'])) { |
|
45 | - if($_SESSION['modx.session.created.time'] < $lastInstallTime) { |
|
46 | - if($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
47 | - if(isset($_COOKIE[session_name()])) { |
|
42 | +if (isset($lastInstallTime)) { |
|
43 | + if (isset($_SESSION['mgrValidated'])) { |
|
44 | + if (isset($_SESSION['modx.session.created.time'])) { |
|
45 | + if ($_SESSION['modx.session.created.time'] < $lastInstallTime) { |
|
46 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
47 | + if (isset($_COOKIE[session_name()])) { |
|
48 | 48 | session_unset(); |
49 | 49 | @session_destroy(); |
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 | } |
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | -if(!isset($_SESSION['mgrValidated'])) { |
|
61 | - if(isset($manager_language)) { |
|
60 | +if (!isset($_SESSION['mgrValidated'])) { |
|
61 | + if (isset($manager_language)) { |
|
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 | } |
69 | 69 | |
70 | 70 | $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
71 | 71 | $modx->setPlaceholder('theme', $manager_theme); |
72 | - $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico')); |
|
72 | + $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico')); |
|
73 | 73 | |
74 | 74 | // invoke OnManagerLoginFormPrerender event |
75 | 75 | $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender'); |
@@ -80,29 +80,29 @@ discard block |
||
80 | 80 | $modx->setPlaceholder('manager_path', MGR_DIR); |
81 | 81 | $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
82 | 82 | $modx->setPlaceholder('login_message', $_lang["login_message"]); |
83 | - $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
83 | + $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
84 | 84 | $modx->setPlaceholder('year', date('Y')); |
85 | 85 | $modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : '')); |
86 | 86 | |
87 | 87 | // andrazk 20070416 - notify user of install/update |
88 | - if(isset($_GET['installGoingOn'])) { |
|
88 | + if (isset($_GET['installGoingOn'])) { |
|
89 | 89 | $installGoingOn = $_GET['installGoingOn']; |
90 | 90 | } |
91 | - if(isset($installGoingOn)) { |
|
92 | - switch($installGoingOn) { |
|
91 | + if (isset($installGoingOn)) { |
|
92 | + switch ($installGoingOn) { |
|
93 | 93 | case 1 : |
94 | - $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
94 | + $modx->setPlaceholder('login_message', "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>"); |
|
95 | 95 | break; |
96 | 96 | case 2 : |
97 | - $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
97 | + $modx->setPlaceholder('login_message', "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>"); |
|
98 | 98 | break; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - if($modx->config['use_captcha'] == 1) { |
|
102 | + if ($modx->config['use_captcha'] == 1) { |
|
103 | 103 | $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
104 | - $modx->setPlaceholder('captcha_image', '<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>'); |
|
105 | - $modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
104 | + $modx->setPlaceholder('captcha_image', '<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>'); |
|
105 | + $modx->setPlaceholder('captcha_input', '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // login info |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // invoke OnManagerLoginFormRender event |
121 | 121 | $evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
122 | - $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
122 | + $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : ''; |
|
123 | 123 | $modx->setPlaceholder('OnManagerLoginFormRender', $html); |
124 | 124 | |
125 | 125 | // load template |
@@ -128,38 +128,38 @@ discard block |
||
128 | 128 | $target = $modx->mergeSettingsContent($target); |
129 | 129 | |
130 | 130 | $login_tpl = null; |
131 | - if(substr($target, 0, 1) === '@') { |
|
132 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
131 | + if (substr($target, 0, 1) === '@') { |
|
132 | + if (substr($target, 0, 6) === '@CHUNK') { |
|
133 | 133 | $target = trim(substr($target, 7)); |
134 | 134 | $login_tpl = $modx->getChunk($target); |
135 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
135 | + } elseif (substr($target, 0, 5) === '@FILE') { |
|
136 | 136 | $target = trim(substr($target, 6)); |
137 | 137 | $login_tpl = file_get_contents($target); |
138 | 138 | } |
139 | 139 | } else { |
140 | - $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
141 | - if(is_file($theme_path . 'style.php')) { |
|
142 | - include($theme_path . 'style.php'); |
|
140 | + $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/'; |
|
141 | + if (is_file($theme_path.'style.php')) { |
|
142 | + include($theme_path.'style.php'); |
|
143 | 143 | } |
144 | 144 | $chunk = $modx->getChunk($target); |
145 | - if($chunk !== false && !empty($chunk)) { |
|
145 | + if ($chunk !== false && !empty($chunk)) { |
|
146 | 146 | $login_tpl = $chunk; |
147 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
148 | - $target = MODX_BASE_PATH . $target; |
|
147 | + } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
148 | + $target = MODX_BASE_PATH.$target; |
|
149 | 149 | $login_tpl = file_get_contents($target); |
150 | - } elseif(is_file($target)) { |
|
150 | + } elseif (is_file($target)) { |
|
151 | 151 | $login_tpl = file_get_contents($target); |
152 | - } elseif(is_file($theme_path . 'login.tpl')) { |
|
153 | - $target = $theme_path . 'login.tpl'; |
|
152 | + } elseif (is_file($theme_path.'login.tpl')) { |
|
153 | + $target = $theme_path.'login.tpl'; |
|
154 | 154 | $login_tpl = file_get_contents($target); |
155 | - } elseif(is_file($theme_path . 'templates/actions/login.tpl')) { |
|
156 | - $target = $theme_path . 'templates/actions/login.tpl'; |
|
155 | + } elseif (is_file($theme_path.'templates/actions/login.tpl')) { |
|
156 | + $target = $theme_path.'templates/actions/login.tpl'; |
|
157 | 157 | $login_tpl = file_get_contents($target); |
158 | - } elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
159 | - $target = $theme_path . 'html/login.html'; |
|
158 | + } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible |
|
159 | + $target = $theme_path.'html/login.html'; |
|
160 | 160 | $login_tpl = file_get_contents($target); |
161 | 161 | } else { |
162 | - $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
162 | + $target = MODX_MANAGER_PATH.'media/style/common/login.tpl'; |
|
163 | 163 | $login_tpl = file_get_contents($target); |
164 | 164 | } |
165 | 165 | } |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | $lasthittime = time(); |
183 | 183 | $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
184 | 184 | |
185 | - if($action !== 1) { |
|
186 | - if(!intval($itemid)) { |
|
185 | + if ($action !== 1) { |
|
186 | + if (!intval($itemid)) { |
|
187 | 187 | $itemid = null; |
188 | 188 | } |
189 | 189 | $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table |
@@ -7,364 +7,364 @@ |
||
7 | 7 | // Added by Raymond 20-Jan-2005 |
8 | 8 | function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
9 | 9 | |
10 | - global $modx; |
|
10 | + global $modx; |
|
11 | 11 | |
12 | - // process any TV commands in value |
|
13 | - $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier; |
|
14 | - $value = ProcessTVCommand($value, $name, $docid); |
|
12 | + // process any TV commands in value |
|
13 | + $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier; |
|
14 | + $value = ProcessTVCommand($value, $name, $docid); |
|
15 | 15 | |
16 | - $params = array(); |
|
17 | - if($paramstring) { |
|
18 | - $cp = explode("&", $paramstring); |
|
19 | - foreach($cp as $p => $v) { |
|
20 | - $v = trim($v); // trim |
|
21 | - $ar = explode("=", $v); |
|
22 | - if(is_array($ar) && count($ar) == 2) { |
|
23 | - $params[$ar[0]] = decodeParamValue($ar[1]); |
|
24 | - } |
|
25 | - } |
|
26 | - } |
|
16 | + $params = array(); |
|
17 | + if($paramstring) { |
|
18 | + $cp = explode("&", $paramstring); |
|
19 | + foreach($cp as $p => $v) { |
|
20 | + $v = trim($v); // trim |
|
21 | + $ar = explode("=", $v); |
|
22 | + if(is_array($ar) && count($ar) == 2) { |
|
23 | + $params[$ar[0]] = decodeParamValue($ar[1]); |
|
24 | + } |
|
25 | + } |
|
26 | + } |
|
27 | 27 | |
28 | - $id = "tv$name"; |
|
29 | - switch($format) { |
|
30 | - case 'image': |
|
31 | - $images = parseInput($value, '||', 'array'); |
|
32 | - $o = ''; |
|
33 | - foreach($images as $image) { |
|
34 | - if(!is_array($image)) { |
|
35 | - $image = explode('==', $image); |
|
36 | - } |
|
37 | - $src = $image[0]; |
|
28 | + $id = "tv$name"; |
|
29 | + switch($format) { |
|
30 | + case 'image': |
|
31 | + $images = parseInput($value, '||', 'array'); |
|
32 | + $o = ''; |
|
33 | + foreach($images as $image) { |
|
34 | + if(!is_array($image)) { |
|
35 | + $image = explode('==', $image); |
|
36 | + } |
|
37 | + $src = $image[0]; |
|
38 | 38 | |
39 | - if($src) { |
|
40 | - // We have a valid source |
|
41 | - $attributes = ''; |
|
42 | - $attr = array( |
|
43 | - 'class' => $params['class'], |
|
44 | - 'src' => $src, |
|
45 | - 'id' => ($params['id'] ? $params['id'] : ''), |
|
46 | - 'alt' => $modx->htmlspecialchars($params['alttext']), |
|
47 | - 'style' => $params['style'] |
|
48 | - ); |
|
49 | - if(isset($params['align']) && $params['align'] != 'none') { |
|
50 | - $attr['align'] = $params['align']; |
|
51 | - } |
|
52 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
53 | - $attributes .= ' ' . $params['attrib']; |
|
39 | + if($src) { |
|
40 | + // We have a valid source |
|
41 | + $attributes = ''; |
|
42 | + $attr = array( |
|
43 | + 'class' => $params['class'], |
|
44 | + 'src' => $src, |
|
45 | + 'id' => ($params['id'] ? $params['id'] : ''), |
|
46 | + 'alt' => $modx->htmlspecialchars($params['alttext']), |
|
47 | + 'style' => $params['style'] |
|
48 | + ); |
|
49 | + if(isset($params['align']) && $params['align'] != 'none') { |
|
50 | + $attr['align'] = $params['align']; |
|
51 | + } |
|
52 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
53 | + $attributes .= ' ' . $params['attrib']; |
|
54 | 54 | |
55 | - // Output the image with attributes |
|
56 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
57 | - } |
|
58 | - } |
|
59 | - break; |
|
55 | + // Output the image with attributes |
|
56 | + $o .= '<img' . rtrim($attributes) . ' />'; |
|
57 | + } |
|
58 | + } |
|
59 | + break; |
|
60 | 60 | |
61 | - case "delim": // display as delimitted list |
|
62 | - $value = parseInput($value, "||"); |
|
63 | - $p = $params['format'] ? $params['format'] : " "; |
|
64 | - if($p == "\\n") { |
|
65 | - $p = "\n"; |
|
66 | - } |
|
67 | - $o = str_replace("||", $p, $value); |
|
68 | - break; |
|
61 | + case "delim": // display as delimitted list |
|
62 | + $value = parseInput($value, "||"); |
|
63 | + $p = $params['format'] ? $params['format'] : " "; |
|
64 | + if($p == "\\n") { |
|
65 | + $p = "\n"; |
|
66 | + } |
|
67 | + $o = str_replace("||", $p, $value); |
|
68 | + break; |
|
69 | 69 | |
70 | - case "string": |
|
71 | - $value = parseInput($value); |
|
72 | - $format = strtolower($params['format']); |
|
73 | - if($format == 'upper case') { |
|
74 | - $o = strtoupper($value); |
|
75 | - } else if($format == 'lower case') { |
|
76 | - $o = strtolower($value); |
|
77 | - } else if($format == 'sentence case') { |
|
78 | - $o = ucfirst($value); |
|
79 | - } else if($format == 'capitalize') { |
|
80 | - $o = ucwords($value); |
|
81 | - } else { |
|
82 | - $o = $value; |
|
83 | - } |
|
84 | - break; |
|
70 | + case "string": |
|
71 | + $value = parseInput($value); |
|
72 | + $format = strtolower($params['format']); |
|
73 | + if($format == 'upper case') { |
|
74 | + $o = strtoupper($value); |
|
75 | + } else if($format == 'lower case') { |
|
76 | + $o = strtolower($value); |
|
77 | + } else if($format == 'sentence case') { |
|
78 | + $o = ucfirst($value); |
|
79 | + } else if($format == 'capitalize') { |
|
80 | + $o = ucwords($value); |
|
81 | + } else { |
|
82 | + $o = $value; |
|
83 | + } |
|
84 | + break; |
|
85 | 85 | |
86 | - case "date": |
|
87 | - if($value != '' || $params['default'] == 'Yes') { |
|
88 | - if(empty($value)) { |
|
89 | - $value = 'now'; |
|
90 | - } |
|
91 | - $timestamp = getUnixtimeFromDateString($value); |
|
92 | - $p = $params['format'] ? $params['format'] : "%A %d, %B %Y"; |
|
93 | - $o = strftime($p, $timestamp); |
|
94 | - } else { |
|
95 | - $value = ''; |
|
96 | - } |
|
97 | - break; |
|
86 | + case "date": |
|
87 | + if($value != '' || $params['default'] == 'Yes') { |
|
88 | + if(empty($value)) { |
|
89 | + $value = 'now'; |
|
90 | + } |
|
91 | + $timestamp = getUnixtimeFromDateString($value); |
|
92 | + $p = $params['format'] ? $params['format'] : "%A %d, %B %Y"; |
|
93 | + $o = strftime($p, $timestamp); |
|
94 | + } else { |
|
95 | + $value = ''; |
|
96 | + } |
|
97 | + break; |
|
98 | 98 | |
99 | - case "hyperlink": |
|
100 | - $value = parseInput($value, "||", "array"); |
|
101 | - $o = ''; |
|
102 | - for($i = 0; $i < count($value); $i++) { |
|
103 | - list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
|
104 | - if(!$url) { |
|
105 | - $url = $name; |
|
106 | - } |
|
107 | - if($url) { |
|
108 | - if($o) { |
|
109 | - $o .= '<br />'; |
|
110 | - } |
|
111 | - $attributes = ''; |
|
112 | - // setup the link attributes |
|
113 | - $attr = array( |
|
114 | - 'href' => $url, |
|
115 | - 'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name, |
|
116 | - 'class' => $params['class'], |
|
117 | - 'style' => $params['style'], |
|
118 | - 'target' => $params['target'], |
|
119 | - ); |
|
120 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
121 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
99 | + case "hyperlink": |
|
100 | + $value = parseInput($value, "||", "array"); |
|
101 | + $o = ''; |
|
102 | + for($i = 0; $i < count($value); $i++) { |
|
103 | + list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
|
104 | + if(!$url) { |
|
105 | + $url = $name; |
|
106 | + } |
|
107 | + if($url) { |
|
108 | + if($o) { |
|
109 | + $o .= '<br />'; |
|
110 | + } |
|
111 | + $attributes = ''; |
|
112 | + // setup the link attributes |
|
113 | + $attr = array( |
|
114 | + 'href' => $url, |
|
115 | + 'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name, |
|
116 | + 'class' => $params['class'], |
|
117 | + 'style' => $params['style'], |
|
118 | + 'target' => $params['target'], |
|
119 | + ); |
|
120 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
121 | + $attributes .= ' ' . $params['attrib']; // add extra |
|
122 | 122 | |
123 | - // Output the link |
|
124 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
125 | - } |
|
126 | - } |
|
127 | - break; |
|
123 | + // Output the link |
|
124 | + $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
125 | + } |
|
126 | + } |
|
127 | + break; |
|
128 | 128 | |
129 | - case "htmltag": |
|
130 | - $value = parseInput($value, "||", "array"); |
|
131 | - $tagid = $params['tagid']; |
|
132 | - $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
|
133 | - $o = ''; |
|
134 | - // Loop through a list of tags |
|
135 | - for($i = 0; $i < count($value); $i++) { |
|
136 | - $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
|
137 | - if(!$tagvalue) { |
|
138 | - continue; |
|
139 | - } |
|
129 | + case "htmltag": |
|
130 | + $value = parseInput($value, "||", "array"); |
|
131 | + $tagid = $params['tagid']; |
|
132 | + $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
|
133 | + $o = ''; |
|
134 | + // Loop through a list of tags |
|
135 | + for($i = 0; $i < count($value); $i++) { |
|
136 | + $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
|
137 | + if(!$tagvalue) { |
|
138 | + continue; |
|
139 | + } |
|
140 | 140 | |
141 | - $attributes = ''; |
|
142 | - $attr = array( |
|
143 | - 'id' => ($tagid ? $tagid : $id), |
|
144 | - // 'tv' already added to id |
|
145 | - 'class' => $params['class'], |
|
146 | - 'style' => $params['style'], |
|
147 | - ); |
|
148 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
149 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
141 | + $attributes = ''; |
|
142 | + $attr = array( |
|
143 | + 'id' => ($tagid ? $tagid : $id), |
|
144 | + // 'tv' already added to id |
|
145 | + 'class' => $params['class'], |
|
146 | + 'style' => $params['style'], |
|
147 | + ); |
|
148 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
149 | + $attributes .= ' ' . $params['attrib']; // add extra |
|
150 | 150 | |
151 | - // Output the HTML Tag |
|
152 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
153 | - } |
|
154 | - break; |
|
151 | + // Output the HTML Tag |
|
152 | + $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
153 | + } |
|
154 | + break; |
|
155 | 155 | |
156 | - case "richtext": |
|
157 | - $value = parseInput($value); |
|
158 | - $w = $params['w'] ? $params['w'] : '100%'; |
|
159 | - $h = $params['h'] ? $params['h'] : '400px'; |
|
160 | - $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
|
161 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
162 | - $o .= $modx->htmlspecialchars($value); |
|
163 | - $o .= '</textarea></div>'; |
|
164 | - $replace_richtext = array($id); |
|
165 | - // setup editors |
|
166 | - if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
167 | - // invoke OnRichTextEditorInit event |
|
168 | - $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
|
169 | - 'editor' => $richtexteditor, |
|
170 | - 'elements' => $replace_richtext, |
|
171 | - 'forfrontend' => 1, |
|
172 | - 'width' => $w, |
|
173 | - 'height' => $h |
|
174 | - )); |
|
175 | - if(is_array($evtOut)) { |
|
176 | - $o .= implode("", $evtOut); |
|
177 | - } |
|
178 | - } |
|
179 | - break; |
|
156 | + case "richtext": |
|
157 | + $value = parseInput($value); |
|
158 | + $w = $params['w'] ? $params['w'] : '100%'; |
|
159 | + $h = $params['h'] ? $params['h'] : '400px'; |
|
160 | + $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
|
161 | + $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
162 | + $o .= $modx->htmlspecialchars($value); |
|
163 | + $o .= '</textarea></div>'; |
|
164 | + $replace_richtext = array($id); |
|
165 | + // setup editors |
|
166 | + if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
167 | + // invoke OnRichTextEditorInit event |
|
168 | + $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
|
169 | + 'editor' => $richtexteditor, |
|
170 | + 'elements' => $replace_richtext, |
|
171 | + 'forfrontend' => 1, |
|
172 | + 'width' => $w, |
|
173 | + 'height' => $h |
|
174 | + )); |
|
175 | + if(is_array($evtOut)) { |
|
176 | + $o .= implode("", $evtOut); |
|
177 | + } |
|
178 | + } |
|
179 | + break; |
|
180 | 180 | |
181 | - case "unixtime": |
|
182 | - $value = parseInput($value); |
|
183 | - $o = getUnixtimeFromDateString($value); |
|
184 | - break; |
|
181 | + case "unixtime": |
|
182 | + $value = parseInput($value); |
|
183 | + $o = getUnixtimeFromDateString($value); |
|
184 | + break; |
|
185 | 185 | |
186 | - case "viewport": |
|
187 | - $value = parseInput($value); |
|
188 | - $id = '_' . time(); |
|
189 | - if(!$params['vpid']) { |
|
190 | - $params['vpid'] = $id; |
|
191 | - } |
|
192 | - $sTag = "<iframe"; |
|
193 | - $eTag = "</iframe>"; |
|
194 | - $autoMode = "0"; |
|
195 | - $w = $params['width']; |
|
196 | - $h = $params['height']; |
|
197 | - if($params['stretch'] == 'Yes') { |
|
198 | - $w = "100%"; |
|
199 | - $h = "100%"; |
|
200 | - } |
|
201 | - if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
202 | - $autoMode = "3"; //both |
|
203 | - } else if($params['awidth'] == 'Yes') { |
|
204 | - $autoMode = "1"; //width only |
|
205 | - } else if($params['aheight'] == 'Yes') { |
|
206 | - $autoMode = "2"; //height only |
|
207 | - } |
|
186 | + case "viewport": |
|
187 | + $value = parseInput($value); |
|
188 | + $id = '_' . time(); |
|
189 | + if(!$params['vpid']) { |
|
190 | + $params['vpid'] = $id; |
|
191 | + } |
|
192 | + $sTag = "<iframe"; |
|
193 | + $eTag = "</iframe>"; |
|
194 | + $autoMode = "0"; |
|
195 | + $w = $params['width']; |
|
196 | + $h = $params['height']; |
|
197 | + if($params['stretch'] == 'Yes') { |
|
198 | + $w = "100%"; |
|
199 | + $h = "100%"; |
|
200 | + } |
|
201 | + if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
202 | + $autoMode = "3"; //both |
|
203 | + } else if($params['awidth'] == 'Yes') { |
|
204 | + $autoMode = "1"; //width only |
|
205 | + } else if($params['aheight'] == 'Yes') { |
|
206 | + $autoMode = "2"; //height only |
|
207 | + } |
|
208 | 208 | |
209 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
210 | - 'name' => 'viewport', |
|
211 | - 'version' => '0', |
|
212 | - 'plaintext' => false |
|
213 | - )); |
|
214 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
215 | - if($params['class']) { |
|
216 | - $o .= " class='" . $params['class'] . "' "; |
|
217 | - } |
|
218 | - if($params['style']) { |
|
219 | - $o .= " style='" . $params['style'] . "' "; |
|
220 | - } |
|
221 | - if($params['attrib']) { |
|
222 | - $o .= $params['attrib'] . " "; |
|
223 | - } |
|
224 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
225 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
226 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
227 | - $o .= ">"; |
|
228 | - $o .= $eTag; |
|
229 | - break; |
|
209 | + $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
210 | + 'name' => 'viewport', |
|
211 | + 'version' => '0', |
|
212 | + 'plaintext' => false |
|
213 | + )); |
|
214 | + $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
215 | + if($params['class']) { |
|
216 | + $o .= " class='" . $params['class'] . "' "; |
|
217 | + } |
|
218 | + if($params['style']) { |
|
219 | + $o .= " style='" . $params['style'] . "' "; |
|
220 | + } |
|
221 | + if($params['attrib']) { |
|
222 | + $o .= $params['attrib'] . " "; |
|
223 | + } |
|
224 | + $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
225 | + $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
226 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
227 | + $o .= ">"; |
|
228 | + $o .= $eTag; |
|
229 | + break; |
|
230 | 230 | |
231 | - case "datagrid": |
|
232 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
233 | - $grd = new DataGrid('', $value); |
|
231 | + case "datagrid": |
|
232 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
233 | + $grd = new DataGrid('', $value); |
|
234 | 234 | |
235 | - $grd->noRecordMsg = $params['egmsg']; |
|
235 | + $grd->noRecordMsg = $params['egmsg']; |
|
236 | 236 | |
237 | - $grd->columnHeaderClass = $params['chdrc']; |
|
238 | - $grd->cssClass = $params['tblc']; |
|
239 | - $grd->itemClass = $params['itmc']; |
|
240 | - $grd->altItemClass = $params['aitmc']; |
|
237 | + $grd->columnHeaderClass = $params['chdrc']; |
|
238 | + $grd->cssClass = $params['tblc']; |
|
239 | + $grd->itemClass = $params['itmc']; |
|
240 | + $grd->altItemClass = $params['aitmc']; |
|
241 | 241 | |
242 | - $grd->columnHeaderStyle = $params['chdrs']; |
|
243 | - $grd->cssStyle = $params['tbls']; |
|
244 | - $grd->itemStyle = $params['itms']; |
|
245 | - $grd->altItemStyle = $params['aitms']; |
|
242 | + $grd->columnHeaderStyle = $params['chdrs']; |
|
243 | + $grd->cssStyle = $params['tbls']; |
|
244 | + $grd->itemStyle = $params['itms']; |
|
245 | + $grd->altItemStyle = $params['aitms']; |
|
246 | 246 | |
247 | - $grd->columns = $params['cols']; |
|
248 | - $grd->fields = $params['flds']; |
|
249 | - $grd->colWidths = $params['cwidth']; |
|
250 | - $grd->colAligns = $params['calign']; |
|
251 | - $grd->colColors = $params['ccolor']; |
|
252 | - $grd->colTypes = $params['ctype']; |
|
247 | + $grd->columns = $params['cols']; |
|
248 | + $grd->fields = $params['flds']; |
|
249 | + $grd->colWidths = $params['cwidth']; |
|
250 | + $grd->colAligns = $params['calign']; |
|
251 | + $grd->colColors = $params['ccolor']; |
|
252 | + $grd->colTypes = $params['ctype']; |
|
253 | 253 | |
254 | - $grd->cellPadding = $params['cpad']; |
|
255 | - $grd->cellSpacing = $params['cspace']; |
|
256 | - $grd->header = $params['head']; |
|
257 | - $grd->footer = $params['foot']; |
|
258 | - $grd->pageSize = $params['psize']; |
|
259 | - $grd->pagerLocation = $params['ploc']; |
|
260 | - $grd->pagerClass = $params['pclass']; |
|
261 | - $grd->pagerStyle = $params['pstyle']; |
|
262 | - $o = $grd->render(); |
|
263 | - break; |
|
254 | + $grd->cellPadding = $params['cpad']; |
|
255 | + $grd->cellSpacing = $params['cspace']; |
|
256 | + $grd->header = $params['head']; |
|
257 | + $grd->footer = $params['foot']; |
|
258 | + $grd->pageSize = $params['psize']; |
|
259 | + $grd->pagerLocation = $params['ploc']; |
|
260 | + $grd->pagerClass = $params['pclass']; |
|
261 | + $grd->pagerStyle = $params['pstyle']; |
|
262 | + $o = $grd->render(); |
|
263 | + break; |
|
264 | 264 | |
265 | - case 'htmlentities': |
|
266 | - $value = parseInput($value); |
|
267 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
268 | - // remove delimiter from checkbox and listbox-multiple TVs |
|
269 | - $value = str_replace('||', '', $value); |
|
270 | - } |
|
271 | - $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
272 | - break; |
|
265 | + case 'htmlentities': |
|
266 | + $value = parseInput($value); |
|
267 | + if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
268 | + // remove delimiter from checkbox and listbox-multiple TVs |
|
269 | + $value = str_replace('||', '', $value); |
|
270 | + } |
|
271 | + $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
272 | + break; |
|
273 | 273 | |
274 | - case 'custom_widget': |
|
275 | - $widget_output = ''; |
|
276 | - $o = ''; |
|
277 | - /* If we are loading a file */ |
|
278 | - if(substr($params['output'], 0, 5) == "@FILE") { |
|
279 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
280 | - if(!file_exists($file_name)) { |
|
281 | - $widget_output = $file_name . ' does not exist'; |
|
282 | - } else { |
|
283 | - $widget_output = file_get_contents($file_name); |
|
284 | - } |
|
285 | - } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
286 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
287 | - if(!file_exists($file_name)) { |
|
288 | - $widget_output = $file_name . ' does not exist'; |
|
289 | - } else { |
|
290 | - /* The included file needs to set $widget_output. Can be string, array, object */ |
|
291 | - include $file_name; |
|
292 | - } |
|
293 | - } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
294 | - $chunk_name = trim(substr($params['output'], 7)); |
|
295 | - $widget_output = $modx->getChunk($chunk_name); |
|
296 | - } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
297 | - $eval_str = trim(substr($params['output'], 6)); |
|
298 | - $widget_output = eval($eval_str); |
|
299 | - } elseif($value !== '') { |
|
300 | - $widget_output = $params['output']; |
|
301 | - } else { |
|
302 | - $widget_output = ''; |
|
303 | - } |
|
304 | - if(is_string($widget_output)) { |
|
305 | - $_ = $modx->config['enable_filter']; |
|
306 | - $modx->config['enable_filter'] = 1; |
|
307 | - $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
|
308 | - $modx->config['enable_filter'] = $_; |
|
309 | - $o = $modx->parseDocumentSource($widget_output); |
|
310 | - } else { |
|
311 | - $o = $widget_output; |
|
312 | - } |
|
313 | - break; |
|
274 | + case 'custom_widget': |
|
275 | + $widget_output = ''; |
|
276 | + $o = ''; |
|
277 | + /* If we are loading a file */ |
|
278 | + if(substr($params['output'], 0, 5) == "@FILE") { |
|
279 | + $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
280 | + if(!file_exists($file_name)) { |
|
281 | + $widget_output = $file_name . ' does not exist'; |
|
282 | + } else { |
|
283 | + $widget_output = file_get_contents($file_name); |
|
284 | + } |
|
285 | + } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
286 | + $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
287 | + if(!file_exists($file_name)) { |
|
288 | + $widget_output = $file_name . ' does not exist'; |
|
289 | + } else { |
|
290 | + /* The included file needs to set $widget_output. Can be string, array, object */ |
|
291 | + include $file_name; |
|
292 | + } |
|
293 | + } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
294 | + $chunk_name = trim(substr($params['output'], 7)); |
|
295 | + $widget_output = $modx->getChunk($chunk_name); |
|
296 | + } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
297 | + $eval_str = trim(substr($params['output'], 6)); |
|
298 | + $widget_output = eval($eval_str); |
|
299 | + } elseif($value !== '') { |
|
300 | + $widget_output = $params['output']; |
|
301 | + } else { |
|
302 | + $widget_output = ''; |
|
303 | + } |
|
304 | + if(is_string($widget_output)) { |
|
305 | + $_ = $modx->config['enable_filter']; |
|
306 | + $modx->config['enable_filter'] = 1; |
|
307 | + $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
|
308 | + $modx->config['enable_filter'] = $_; |
|
309 | + $o = $modx->parseDocumentSource($widget_output); |
|
310 | + } else { |
|
311 | + $o = $widget_output; |
|
312 | + } |
|
313 | + break; |
|
314 | 314 | |
315 | - default: |
|
316 | - $value = parseInput($value); |
|
317 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
318 | - // add separator |
|
319 | - $value = explode('||', $value); |
|
320 | - $value = implode($sep, $value); |
|
321 | - } |
|
322 | - $o = $value; |
|
323 | - break; |
|
324 | - } |
|
325 | - return $o; |
|
315 | + default: |
|
316 | + $value = parseInput($value); |
|
317 | + if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
318 | + // add separator |
|
319 | + $value = explode('||', $value); |
|
320 | + $value = implode($sep, $value); |
|
321 | + } |
|
322 | + $o = $value; |
|
323 | + break; |
|
324 | + } |
|
325 | + return $o; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | function decodeParamValue($s) { |
329 | - $s = str_replace("%3D", '=', $s); // = |
|
330 | - $s = str_replace("%26", '&', $s); // & |
|
331 | - return $s; |
|
329 | + $s = str_replace("%3D", '=', $s); // = |
|
330 | + $s = str_replace("%26", '&', $s); // & |
|
331 | + return $s; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | // returns an array if a delimiter is present. returns array is a recordset is present |
335 | 335 | function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
336 | - global $modx; |
|
337 | - if($modx->db->isResult($src)) { |
|
338 | - // must be a recordset |
|
339 | - $rows = array(); |
|
340 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
341 | - return ($type == "array") ? $rows : implode($delim, $rows); |
|
342 | - } else { |
|
343 | - // must be a text |
|
344 | - if($type == "array") { |
|
345 | - return explode($delim, $src); |
|
346 | - } else { |
|
347 | - return $src; |
|
348 | - } |
|
349 | - } |
|
336 | + global $modx; |
|
337 | + if($modx->db->isResult($src)) { |
|
338 | + // must be a recordset |
|
339 | + $rows = array(); |
|
340 | + while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
341 | + return ($type == "array") ? $rows : implode($delim, $rows); |
|
342 | + } else { |
|
343 | + // must be a text |
|
344 | + if($type == "array") { |
|
345 | + return explode($delim, $src); |
|
346 | + } else { |
|
347 | + return $src; |
|
348 | + } |
|
349 | + } |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | function getUnixtimeFromDateString($value) { |
353 | - $timestamp = false; |
|
354 | - // Check for MySQL or legacy style date |
|
355 | - $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
356 | - $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
357 | - $matches = array(); |
|
358 | - if(strpos($value, '-') !== false) { |
|
359 | - if(preg_match($date_match_1, $value, $matches)) { |
|
360 | - $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
|
361 | - } elseif(preg_match($date_match_2, $value, $matches)) { |
|
362 | - $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
363 | - } |
|
364 | - } |
|
365 | - // If those didn't work, use strtotime to figure out the date |
|
366 | - if($timestamp === false || $timestamp === -1) { |
|
367 | - $timestamp = strtotime($value); |
|
368 | - } |
|
369 | - return $timestamp; |
|
353 | + $timestamp = false; |
|
354 | + // Check for MySQL or legacy style date |
|
355 | + $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
356 | + $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
357 | + $matches = array(); |
|
358 | + if(strpos($value, '-') !== false) { |
|
359 | + if(preg_match($date_match_1, $value, $matches)) { |
|
360 | + $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
|
361 | + } elseif(preg_match($date_match_2, $value, $matches)) { |
|
362 | + $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
363 | + } |
|
364 | + } |
|
365 | + // If those didn't work, use strtotime to figure out the date |
|
366 | + if($timestamp === false || $timestamp === -1) { |
|
367 | + $timestamp = strtotime($value); |
|
368 | + } |
|
369 | + return $timestamp; |
|
370 | 370 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Added by Raymond 20-Jan-2005 |
8 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
8 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = ''){ |
|
9 | 9 | |
10 | 10 | global $modx; |
11 | 11 | |
@@ -14,29 +14,29 @@ discard block |
||
14 | 14 | $value = ProcessTVCommand($value, $name, $docid); |
15 | 15 | |
16 | 16 | $params = array(); |
17 | - if($paramstring) { |
|
17 | + if ($paramstring) { |
|
18 | 18 | $cp = explode("&", $paramstring); |
19 | - foreach($cp as $p => $v) { |
|
19 | + foreach ($cp as $p => $v) { |
|
20 | 20 | $v = trim($v); // trim |
21 | 21 | $ar = explode("=", $v); |
22 | - if(is_array($ar) && count($ar) == 2) { |
|
22 | + if (is_array($ar) && count($ar) == 2) { |
|
23 | 23 | $params[$ar[0]] = decodeParamValue($ar[1]); |
24 | 24 | } |
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | 28 | $id = "tv$name"; |
29 | - switch($format) { |
|
29 | + switch ($format) { |
|
30 | 30 | case 'image': |
31 | 31 | $images = parseInput($value, '||', 'array'); |
32 | 32 | $o = ''; |
33 | - foreach($images as $image) { |
|
34 | - if(!is_array($image)) { |
|
33 | + foreach ($images as $image) { |
|
34 | + if (!is_array($image)) { |
|
35 | 35 | $image = explode('==', $image); |
36 | 36 | } |
37 | 37 | $src = $image[0]; |
38 | 38 | |
39 | - if($src) { |
|
39 | + if ($src) { |
|
40 | 40 | // We have a valid source |
41 | 41 | $attributes = ''; |
42 | 42 | $attr = array( |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | 'alt' => $modx->htmlspecialchars($params['alttext']), |
47 | 47 | 'style' => $params['style'] |
48 | 48 | ); |
49 | - if(isset($params['align']) && $params['align'] != 'none') { |
|
49 | + if (isset($params['align']) && $params['align'] != 'none') { |
|
50 | 50 | $attr['align'] = $params['align']; |
51 | 51 | } |
52 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
53 | - $attributes .= ' ' . $params['attrib']; |
|
52 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
53 | + $attributes .= ' '.$params['attrib']; |
|
54 | 54 | |
55 | 55 | // Output the image with attributes |
56 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
56 | + $o .= '<img'.rtrim($attributes).' />'; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | break; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | case "delim": // display as delimitted list |
62 | 62 | $value = parseInput($value, "||"); |
63 | 63 | $p = $params['format'] ? $params['format'] : " "; |
64 | - if($p == "\\n") { |
|
64 | + if ($p == "\\n") { |
|
65 | 65 | $p = "\n"; |
66 | 66 | } |
67 | 67 | $o = str_replace("||", $p, $value); |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | case "string": |
71 | 71 | $value = parseInput($value); |
72 | 72 | $format = strtolower($params['format']); |
73 | - if($format == 'upper case') { |
|
73 | + if ($format == 'upper case') { |
|
74 | 74 | $o = strtoupper($value); |
75 | - } else if($format == 'lower case') { |
|
75 | + } else if ($format == 'lower case') { |
|
76 | 76 | $o = strtolower($value); |
77 | - } else if($format == 'sentence case') { |
|
77 | + } else if ($format == 'sentence case') { |
|
78 | 78 | $o = ucfirst($value); |
79 | - } else if($format == 'capitalize') { |
|
79 | + } else if ($format == 'capitalize') { |
|
80 | 80 | $o = ucwords($value); |
81 | 81 | } else { |
82 | 82 | $o = $value; |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | break; |
85 | 85 | |
86 | 86 | case "date": |
87 | - if($value != '' || $params['default'] == 'Yes') { |
|
88 | - if(empty($value)) { |
|
87 | + if ($value != '' || $params['default'] == 'Yes') { |
|
88 | + if (empty($value)) { |
|
89 | 89 | $value = 'now'; |
90 | 90 | } |
91 | 91 | $timestamp = getUnixtimeFromDateString($value); |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | case "hyperlink": |
100 | 100 | $value = parseInput($value, "||", "array"); |
101 | 101 | $o = ''; |
102 | - for($i = 0; $i < count($value); $i++) { |
|
102 | + for ($i = 0; $i < count($value); $i++) { |
|
103 | 103 | list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
104 | - if(!$url) { |
|
104 | + if (!$url) { |
|
105 | 105 | $url = $name; |
106 | 106 | } |
107 | - if($url) { |
|
108 | - if($o) { |
|
107 | + if ($url) { |
|
108 | + if ($o) { |
|
109 | 109 | $o .= '<br />'; |
110 | 110 | } |
111 | 111 | $attributes = ''; |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | 'style' => $params['style'], |
118 | 118 | 'target' => $params['target'], |
119 | 119 | ); |
120 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
121 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
120 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
121 | + $attributes .= ' '.$params['attrib']; // add extra |
|
122 | 122 | |
123 | 123 | // Output the link |
124 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
124 | + $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>'; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | break; |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
133 | 133 | $o = ''; |
134 | 134 | // Loop through a list of tags |
135 | - for($i = 0; $i < count($value); $i++) { |
|
135 | + for ($i = 0; $i < count($value); $i++) { |
|
136 | 136 | $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
137 | - if(!$tagvalue) { |
|
137 | + if (!$tagvalue) { |
|
138 | 138 | continue; |
139 | 139 | } |
140 | 140 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | 'class' => $params['class'], |
146 | 146 | 'style' => $params['style'], |
147 | 147 | ); |
148 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
149 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
148 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
149 | + $attributes .= ' '.$params['attrib']; // add extra |
|
150 | 150 | |
151 | 151 | // Output the HTML Tag |
152 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
152 | + $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>'; |
|
153 | 153 | } |
154 | 154 | break; |
155 | 155 | |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | $w = $params['w'] ? $params['w'] : '100%'; |
159 | 159 | $h = $params['h'] ? $params['h'] : '400px'; |
160 | 160 | $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
161 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
161 | + $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">'; |
|
162 | 162 | $o .= $modx->htmlspecialchars($value); |
163 | 163 | $o .= '</textarea></div>'; |
164 | 164 | $replace_richtext = array($id); |
165 | 165 | // setup editors |
166 | - if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
166 | + if (!empty($replace_richtext) && !empty($richtexteditor)) { |
|
167 | 167 | // invoke OnRichTextEditorInit event |
168 | 168 | $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
169 | 169 | 'editor' => $richtexteditor, |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'width' => $w, |
173 | 173 | 'height' => $h |
174 | 174 | )); |
175 | - if(is_array($evtOut)) { |
|
175 | + if (is_array($evtOut)) { |
|
176 | 176 | $o .= implode("", $evtOut); |
177 | 177 | } |
178 | 178 | } |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | |
186 | 186 | case "viewport": |
187 | 187 | $value = parseInput($value); |
188 | - $id = '_' . time(); |
|
189 | - if(!$params['vpid']) { |
|
188 | + $id = '_'.time(); |
|
189 | + if (!$params['vpid']) { |
|
190 | 190 | $params['vpid'] = $id; |
191 | 191 | } |
192 | 192 | $sTag = "<iframe"; |
@@ -194,42 +194,42 @@ discard block |
||
194 | 194 | $autoMode = "0"; |
195 | 195 | $w = $params['width']; |
196 | 196 | $h = $params['height']; |
197 | - if($params['stretch'] == 'Yes') { |
|
197 | + if ($params['stretch'] == 'Yes') { |
|
198 | 198 | $w = "100%"; |
199 | 199 | $h = "100%"; |
200 | 200 | } |
201 | - if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
202 | - $autoMode = "3"; //both |
|
203 | - } else if($params['awidth'] == 'Yes') { |
|
201 | + if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
202 | + $autoMode = "3"; //both |
|
203 | + } else if ($params['awidth'] == 'Yes') { |
|
204 | 204 | $autoMode = "1"; //width only |
205 | - } else if($params['aheight'] == 'Yes') { |
|
206 | - $autoMode = "2"; //height only |
|
205 | + } else if ($params['aheight'] == 'Yes') { |
|
206 | + $autoMode = "2"; //height only |
|
207 | 207 | } |
208 | 208 | |
209 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
209 | + $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array( |
|
210 | 210 | 'name' => 'viewport', |
211 | 211 | 'version' => '0', |
212 | 212 | 'plaintext' => false |
213 | 213 | )); |
214 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
215 | - if($params['class']) { |
|
216 | - $o .= " class='" . $params['class'] . "' "; |
|
214 | + $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' "; |
|
215 | + if ($params['class']) { |
|
216 | + $o .= " class='".$params['class']."' "; |
|
217 | 217 | } |
218 | - if($params['style']) { |
|
219 | - $o .= " style='" . $params['style'] . "' "; |
|
218 | + if ($params['style']) { |
|
219 | + $o .= " style='".$params['style']."' "; |
|
220 | 220 | } |
221 | - if($params['attrib']) { |
|
222 | - $o .= $params['attrib'] . " "; |
|
221 | + if ($params['attrib']) { |
|
222 | + $o .= $params['attrib']." "; |
|
223 | 223 | } |
224 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
225 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
226 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
224 | + $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' "; |
|
225 | + $o .= "src='".$value."' frameborder='".$params['borsize']."' "; |
|
226 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' "; |
|
227 | 227 | $o .= ">"; |
228 | 228 | $o .= $eTag; |
229 | 229 | break; |
230 | 230 | |
231 | 231 | case "datagrid": |
232 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
232 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
233 | 233 | $grd = new DataGrid('', $value); |
234 | 234 | |
235 | 235 | $grd->noRecordMsg = $params['egmsg']; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | case 'htmlentities': |
266 | 266 | $value = parseInput($value); |
267 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
267 | + if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
268 | 268 | // remove delimiter from checkbox and listbox-multiple TVs |
269 | 269 | $value = str_replace('||', '', $value); |
270 | 270 | } |
@@ -275,33 +275,33 @@ discard block |
||
275 | 275 | $widget_output = ''; |
276 | 276 | $o = ''; |
277 | 277 | /* If we are loading a file */ |
278 | - if(substr($params['output'], 0, 5) == "@FILE") { |
|
279 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
280 | - if(!file_exists($file_name)) { |
|
281 | - $widget_output = $file_name . ' does not exist'; |
|
278 | + if (substr($params['output'], 0, 5) == "@FILE") { |
|
279 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6)); |
|
280 | + if (!file_exists($file_name)) { |
|
281 | + $widget_output = $file_name.' does not exist'; |
|
282 | 282 | } else { |
283 | 283 | $widget_output = file_get_contents($file_name); |
284 | 284 | } |
285 | - } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
286 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
287 | - if(!file_exists($file_name)) { |
|
288 | - $widget_output = $file_name . ' does not exist'; |
|
285 | + } elseif (substr($params['output'], 0, 8) == '@INCLUDE') { |
|
286 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9)); |
|
287 | + if (!file_exists($file_name)) { |
|
288 | + $widget_output = $file_name.' does not exist'; |
|
289 | 289 | } else { |
290 | 290 | /* The included file needs to set $widget_output. Can be string, array, object */ |
291 | 291 | include $file_name; |
292 | 292 | } |
293 | - } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
293 | + } elseif (substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
294 | 294 | $chunk_name = trim(substr($params['output'], 7)); |
295 | 295 | $widget_output = $modx->getChunk($chunk_name); |
296 | - } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
296 | + } elseif (substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
297 | 297 | $eval_str = trim(substr($params['output'], 6)); |
298 | 298 | $widget_output = eval($eval_str); |
299 | - } elseif($value !== '') { |
|
299 | + } elseif ($value !== '') { |
|
300 | 300 | $widget_output = $params['output']; |
301 | 301 | } else { |
302 | 302 | $widget_output = ''; |
303 | 303 | } |
304 | - if(is_string($widget_output)) { |
|
304 | + if (is_string($widget_output)) { |
|
305 | 305 | $_ = $modx->config['enable_filter']; |
306 | 306 | $modx->config['enable_filter'] = 1; |
307 | 307 | $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | default: |
316 | 316 | $value = parseInput($value); |
317 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
317 | + if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
318 | 318 | // add separator |
319 | 319 | $value = explode('||', $value); |
320 | 320 | $value = implode($sep, $value); |
@@ -325,23 +325,23 @@ discard block |
||
325 | 325 | return $o; |
326 | 326 | } |
327 | 327 | |
328 | -function decodeParamValue($s) { |
|
328 | +function decodeParamValue($s){ |
|
329 | 329 | $s = str_replace("%3D", '=', $s); // = |
330 | 330 | $s = str_replace("%26", '&', $s); // & |
331 | 331 | return $s; |
332 | 332 | } |
333 | 333 | |
334 | 334 | // returns an array if a delimiter is present. returns array is a recordset is present |
335 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
335 | +function parseInput($src, $delim = "||", $type = "string", $columns = true){ // type can be: string, array |
|
336 | 336 | global $modx; |
337 | - if($modx->db->isResult($src)) { |
|
337 | + if ($modx->db->isResult($src)) { |
|
338 | 338 | // must be a recordset |
339 | 339 | $rows = array(); |
340 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
340 | + while ($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
341 | 341 | return ($type == "array") ? $rows : implode($delim, $rows); |
342 | 342 | } else { |
343 | 343 | // must be a text |
344 | - if($type == "array") { |
|
344 | + if ($type == "array") { |
|
345 | 345 | return explode($delim, $src); |
346 | 346 | } else { |
347 | 347 | return $src; |
@@ -349,21 +349,21 @@ discard block |
||
349 | 349 | } |
350 | 350 | } |
351 | 351 | |
352 | -function getUnixtimeFromDateString($value) { |
|
352 | +function getUnixtimeFromDateString($value){ |
|
353 | 353 | $timestamp = false; |
354 | 354 | // Check for MySQL or legacy style date |
355 | 355 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
356 | 356 | $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
357 | 357 | $matches = array(); |
358 | - if(strpos($value, '-') !== false) { |
|
359 | - if(preg_match($date_match_1, $value, $matches)) { |
|
358 | + if (strpos($value, '-') !== false) { |
|
359 | + if (preg_match($date_match_1, $value, $matches)) { |
|
360 | 360 | $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
361 | - } elseif(preg_match($date_match_2, $value, $matches)) { |
|
361 | + } elseif (preg_match($date_match_2, $value, $matches)) { |
|
362 | 362 | $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
363 | 363 | } |
364 | 364 | } |
365 | 365 | // If those didn't work, use strtotime to figure out the date |
366 | - if($timestamp === false || $timestamp === -1) { |
|
366 | + if ($timestamp === false || $timestamp === -1) { |
|
367 | 367 | $timestamp = strtotime($value); |
368 | 368 | } |
369 | 369 | return $timestamp; |
@@ -5,7 +5,8 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Added by Raymond 20-Jan-2005 |
8 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
8 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') |
|
9 | +{ |
|
9 | 10 | |
10 | 11 | global $modx; |
11 | 12 | |
@@ -49,7 +50,9 @@ discard block |
||
49 | 50 | if(isset($params['align']) && $params['align'] != 'none') { |
50 | 51 | $attr['align'] = $params['align']; |
51 | 52 | } |
52 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
53 | + foreach($attr as $k => $v) { |
|
54 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
55 | + } |
|
53 | 56 | $attributes .= ' ' . $params['attrib']; |
54 | 57 | |
55 | 58 | // Output the image with attributes |
@@ -117,7 +120,9 @@ discard block |
||
117 | 120 | 'style' => $params['style'], |
118 | 121 | 'target' => $params['target'], |
119 | 122 | ); |
120 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
123 | + foreach($attr as $k => $v) { |
|
124 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
125 | + } |
|
121 | 126 | $attributes .= ' ' . $params['attrib']; // add extra |
122 | 127 | |
123 | 128 | // Output the link |
@@ -145,7 +150,9 @@ discard block |
||
145 | 150 | 'class' => $params['class'], |
146 | 151 | 'style' => $params['style'], |
147 | 152 | ); |
148 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
153 | + foreach($attr as $k => $v) { |
|
154 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
155 | + } |
|
149 | 156 | $attributes .= ' ' . $params['attrib']; // add extra |
150 | 157 | |
151 | 158 | // Output the HTML Tag |
@@ -325,19 +332,24 @@ discard block |
||
325 | 332 | return $o; |
326 | 333 | } |
327 | 334 | |
328 | -function decodeParamValue($s) { |
|
335 | +function decodeParamValue($s) |
|
336 | +{ |
|
329 | 337 | $s = str_replace("%3D", '=', $s); // = |
330 | 338 | $s = str_replace("%26", '&', $s); // & |
331 | 339 | return $s; |
332 | 340 | } |
333 | 341 | |
334 | 342 | // returns an array if a delimiter is present. returns array is a recordset is present |
335 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
343 | +function parseInput($src, $delim = "||", $type = "string", $columns = true) |
|
344 | +{ |
|
345 | +// type can be: string, array |
|
336 | 346 | global $modx; |
337 | 347 | if($modx->db->isResult($src)) { |
338 | 348 | // must be a recordset |
339 | 349 | $rows = array(); |
340 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
350 | + while($cols = $modx->db->getRow($src, 'num')) { |
|
351 | + $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
352 | + } |
|
341 | 353 | return ($type == "array") ? $rows : implode($delim, $rows); |
342 | 354 | } else { |
343 | 355 | // must be a text |
@@ -349,7 +361,8 @@ discard block |
||
349 | 361 | } |
350 | 362 | } |
351 | 363 | |
352 | -function getUnixtimeFromDateString($value) { |
|
364 | +function getUnixtimeFromDateString($value) |
|
365 | +{ |
|
353 | 366 | $timestamp = false; |
354 | 367 | // Check for MySQL or legacy style date |
355 | 368 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
@@ -29,33 +29,33 @@ discard block |
||
29 | 29 | // include MagPieRSS |
30 | 30 | require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
31 | 31 | // Convert relative path into absolute url |
32 | -function rel2abs( $rel, $base ) { |
|
32 | +function rel2abs($rel, $base){ |
|
33 | 33 | // parse base URL and convert to local variables: $scheme, $host, $path |
34 | - extract( parse_url( $base ) ); |
|
35 | - if ( strpos( $rel,"//" ) === 0 ) { |
|
36 | - return $scheme . ':' . $rel; |
|
34 | + extract(parse_url($base)); |
|
35 | + if (strpos($rel, "//") === 0) { |
|
36 | + return $scheme.':'.$rel; |
|
37 | 37 | } |
38 | 38 | // return if already absolute URL |
39 | - if ( parse_url( $rel, PHP_URL_SCHEME ) != '' ) { |
|
39 | + if (parse_url($rel, PHP_URL_SCHEME) != '') { |
|
40 | 40 | return $rel; |
41 | 41 | } |
42 | 42 | // queries and anchors |
43 | - if ( $rel[0] == '#' || $rel[0] == '?' ) { |
|
44 | - return $base . $rel; |
|
43 | + if ($rel[0] == '#' || $rel[0] == '?') { |
|
44 | + return $base.$rel; |
|
45 | 45 | } |
46 | 46 | // remove non-directory element from path |
47 | - $path = preg_replace( '#/[^/]*$#', '', $path ); |
|
47 | + $path = preg_replace('#/[^/]*$#', '', $path); |
|
48 | 48 | // destroy path if relative url points to root |
49 | - if ( $rel[0] == '/' ) { |
|
49 | + if ($rel[0] == '/') { |
|
50 | 50 | $path = ''; |
51 | 51 | } |
52 | 52 | // dirty absolute URL |
53 | - $abs = $host . $path . "/" . $rel; |
|
53 | + $abs = $host.$path."/".$rel; |
|
54 | 54 | // replace '//' or '/./' or '/foo/../' with '/' |
55 | - $abs = preg_replace( "/(\/\.?\/)/", "/", $abs ); |
|
56 | - $abs = preg_replace( "/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs ); |
|
55 | + $abs = preg_replace("/(\/\.?\/)/", "/", $abs); |
|
56 | + $abs = preg_replace("/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs); |
|
57 | 57 | // absolute URL is ready! |
58 | - return $scheme . '://' . $abs; |
|
58 | + return $scheme.'://'.$abs; |
|
59 | 59 | } |
60 | 60 | $feedData = array(); |
61 | 61 | |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | foreach ($urls as $section=>$url) { |
64 | 64 | $output = ''; |
65 | 65 | $rss = @fetch_rss($url); |
66 | - if( !$rss ){ |
|
67 | - $feedData[$section] = 'Failed to retrieve ' . $url; |
|
66 | + if (!$rss) { |
|
67 | + $feedData[$section] = 'Failed to retrieve '.$url; |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | $output .= '<ul>'; |
71 | 71 | |
72 | 72 | $items = array_slice($rss->items, 0, $itemsNumber); |
73 | 73 | foreach ($items as $item) { |
74 | - $href = rel2abs($item['link'],'https://github.com'); |
|
74 | + $href = rel2abs($item['link'], 'https://github.com'); |
|
75 | 75 | $title = $item['title']; |
76 | 76 | $pubdate = $item['pubdate']; |
77 | 77 | $pubdate = $modx->toDateFormat(strtotime($pubdate)); |
@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | // include MagPieRSS |
30 | 30 | require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
31 | 31 | // Convert relative path into absolute url |
32 | -function rel2abs( $rel, $base ) { |
|
32 | +function rel2abs( $rel, $base ) |
|
33 | +{ |
|
33 | 34 | // parse base URL and convert to local variables: $scheme, $host, $path |
34 | 35 | extract( parse_url( $base ) ); |
35 | 36 | if ( strpos( $rel,"//" ) === 0 ) { |
@@ -63,7 +64,7 @@ discard block |
||
63 | 64 | foreach ($urls as $section=>$url) { |
64 | 65 | $output = ''; |
65 | 66 | $rss = @fetch_rss($url); |
66 | - if( !$rss ){ |
|
67 | + if( !$rss ) { |
|
67 | 68 | $feedData[$section] = 'Failed to retrieve ' . $url; |
68 | 69 | continue; |
69 | 70 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - /* |
|
2 | + /* |
|
3 | 3 | * MODX Manager Home Page Implmentation by pixelchutes (www.pixelchutes.com) |
4 | 4 | * Based on kudo's kRSS Module v1.0.72 |
5 | 5 | * |
@@ -30,43 +30,43 @@ discard block |
||
30 | 30 | require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
31 | 31 | // Convert relative path into absolute url |
32 | 32 | function rel2abs( $rel, $base ) { |
33 | - // parse base URL and convert to local variables: $scheme, $host, $path |
|
34 | - extract( parse_url( $base ) ); |
|
35 | - if ( strpos( $rel,"//" ) === 0 ) { |
|
36 | - return $scheme . ':' . $rel; |
|
37 | - } |
|
38 | - // return if already absolute URL |
|
39 | - if ( parse_url( $rel, PHP_URL_SCHEME ) != '' ) { |
|
40 | - return $rel; |
|
41 | - } |
|
42 | - // queries and anchors |
|
43 | - if ( $rel[0] == '#' || $rel[0] == '?' ) { |
|
44 | - return $base . $rel; |
|
45 | - } |
|
46 | - // remove non-directory element from path |
|
47 | - $path = preg_replace( '#/[^/]*$#', '', $path ); |
|
48 | - // destroy path if relative url points to root |
|
49 | - if ( $rel[0] == '/' ) { |
|
50 | - $path = ''; |
|
51 | - } |
|
52 | - // dirty absolute URL |
|
53 | - $abs = $host . $path . "/" . $rel; |
|
54 | - // replace '//' or '/./' or '/foo/../' with '/' |
|
55 | - $abs = preg_replace( "/(\/\.?\/)/", "/", $abs ); |
|
56 | - $abs = preg_replace( "/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs ); |
|
57 | - // absolute URL is ready! |
|
58 | - return $scheme . '://' . $abs; |
|
33 | + // parse base URL and convert to local variables: $scheme, $host, $path |
|
34 | + extract( parse_url( $base ) ); |
|
35 | + if ( strpos( $rel,"//" ) === 0 ) { |
|
36 | + return $scheme . ':' . $rel; |
|
37 | + } |
|
38 | + // return if already absolute URL |
|
39 | + if ( parse_url( $rel, PHP_URL_SCHEME ) != '' ) { |
|
40 | + return $rel; |
|
41 | + } |
|
42 | + // queries and anchors |
|
43 | + if ( $rel[0] == '#' || $rel[0] == '?' ) { |
|
44 | + return $base . $rel; |
|
45 | + } |
|
46 | + // remove non-directory element from path |
|
47 | + $path = preg_replace( '#/[^/]*$#', '', $path ); |
|
48 | + // destroy path if relative url points to root |
|
49 | + if ( $rel[0] == '/' ) { |
|
50 | + $path = ''; |
|
51 | + } |
|
52 | + // dirty absolute URL |
|
53 | + $abs = $host . $path . "/" . $rel; |
|
54 | + // replace '//' or '/./' or '/foo/../' with '/' |
|
55 | + $abs = preg_replace( "/(\/\.?\/)/", "/", $abs ); |
|
56 | + $abs = preg_replace( "/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs ); |
|
57 | + // absolute URL is ready! |
|
58 | + return $scheme . '://' . $abs; |
|
59 | 59 | } |
60 | 60 | $feedData = array(); |
61 | 61 | |
62 | 62 | // create Feed |
63 | 63 | foreach ($urls as $section=>$url) { |
64 | - $output = ''; |
|
64 | + $output = ''; |
|
65 | 65 | $rss = @fetch_rss($url); |
66 | 66 | if( !$rss ){ |
67 | - $feedData[$section] = 'Failed to retrieve ' . $url; |
|
68 | - continue; |
|
69 | - } |
|
67 | + $feedData[$section] = 'Failed to retrieve ' . $url; |
|
68 | + continue; |
|
69 | + } |
|
70 | 70 | $output .= '<ul>'; |
71 | 71 | |
72 | 72 | $items = array_slice($rss->items, 0, $itemsNumber); |
@@ -84,5 +84,5 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | $output .= '</ul>'; |
87 | - $feedData[$section] = $output; |
|
87 | + $feedData[$section] = $output; |
|
88 | 88 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$c = &$settings; |
|
3 | +$c = &$settings; |
|
4 | 4 | |
5 | 5 | $c['site_name'] = 'My MODX Site'; |
6 | 6 | $c['site_start'] = 1; |
@@ -65,26 +65,26 @@ |
||
65 | 65 | $_['macintosh'] = 'Western European (Mac) - macintosh'; |
66 | 66 | $_['Windows-1252'] = 'Western European (Windows) - Windows-1252'; |
67 | 67 | |
68 | -if($modx_charset == 'euc-jp') $_['euc-jp'] = 'Japanese (EUC) - euc-jp'; |
|
69 | -elseif($modx_charset == 'shift_jis') $_['shift_jis'] = 'Japanese (Shift-JIS) - shift_jis'; |
|
70 | -elseif($modx_charset == 'iso-2022-jp') $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp'; |
|
71 | -elseif($modx_charset == 'csISO2022JP') $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP'; |
|
72 | -elseif($modx_charset == 'EUC-CN') $_['EUC-CN'] = 'Chinese Simplified (EUC) - EUC-CN'; |
|
73 | -elseif($modx_charset == 'hz-gb-2312') $_['hz-gb-2312'] = 'Chinese Simplified (HZ) - hz-gb-2312'; |
|
74 | -elseif($modx_charset == 'x-mac-chinesesimp') $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp'; |
|
75 | -elseif($modx_charset == 'x-Chinese-CNS') $_['x-Chinese-CNS'] = 'Chinese Traditional (CNS) - x-Chinese-CNS'; |
|
76 | -elseif($modx_charset == 'x-Chinese-Eten') $_['x-Chinese-Eten'] = 'Chinese Traditional (Eten) - x-Chinese-Eten'; |
|
77 | -elseif($modx_charset == 'x-mac-chinesetrad') $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad'; |
|
78 | -elseif($modx_charset == 'ks_c_5601-1987') $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987'; |
|
79 | -elseif($modx_charset == 'euc-kr') $_['euc-kr'] = 'Korean (EUC) - euc-kr'; |
|
80 | -elseif($modx_charset == 'iso-2022-kr') $_['iso-2022-kr'] = 'Korean (ISO) - iso-2022-kr'; |
|
81 | -elseif($modx_charset == 'Johab') $_['Johab'] = 'Korean (Johab) - Johab'; |
|
82 | -elseif($modx_charset == 'x-mac-korean') $_['x-mac-korean'] = 'Korean (Mac) - x-mac-korean'; |
|
68 | +if ($modx_charset == 'euc-jp') $_['euc-jp'] = 'Japanese (EUC) - euc-jp'; |
|
69 | +elseif ($modx_charset == 'shift_jis') $_['shift_jis'] = 'Japanese (Shift-JIS) - shift_jis'; |
|
70 | +elseif ($modx_charset == 'iso-2022-jp') $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp'; |
|
71 | +elseif ($modx_charset == 'csISO2022JP') $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP'; |
|
72 | +elseif ($modx_charset == 'EUC-CN') $_['EUC-CN'] = 'Chinese Simplified (EUC) - EUC-CN'; |
|
73 | +elseif ($modx_charset == 'hz-gb-2312') $_['hz-gb-2312'] = 'Chinese Simplified (HZ) - hz-gb-2312'; |
|
74 | +elseif ($modx_charset == 'x-mac-chinesesimp') $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp'; |
|
75 | +elseif ($modx_charset == 'x-Chinese-CNS') $_['x-Chinese-CNS'] = 'Chinese Traditional (CNS) - x-Chinese-CNS'; |
|
76 | +elseif ($modx_charset == 'x-Chinese-Eten') $_['x-Chinese-Eten'] = 'Chinese Traditional (Eten) - x-Chinese-Eten'; |
|
77 | +elseif ($modx_charset == 'x-mac-chinesetrad') $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad'; |
|
78 | +elseif ($modx_charset == 'ks_c_5601-1987') $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987'; |
|
79 | +elseif ($modx_charset == 'euc-kr') $_['euc-kr'] = 'Korean (EUC) - euc-kr'; |
|
80 | +elseif ($modx_charset == 'iso-2022-kr') $_['iso-2022-kr'] = 'Korean (ISO) - iso-2022-kr'; |
|
81 | +elseif ($modx_charset == 'Johab') $_['Johab'] = 'Korean (Johab) - Johab'; |
|
82 | +elseif ($modx_charset == 'x-mac-korean') $_['x-mac-korean'] = 'Korean (Mac) - x-mac-korean'; |
|
83 | 83 | |
84 | 84 | $tpl = '<option value="%s" %s>%s</option>'; |
85 | 85 | $options = array(); |
86 | -foreach($_ as $value=>$label) { |
|
87 | - $selected = $value===$modx_charset ? 'selected' : ''; |
|
86 | +foreach ($_ as $value=>$label) { |
|
87 | + $selected = $value === $modx_charset ? 'selected' : ''; |
|
88 | 88 | $options[] = sprintf($tpl, $value, $selected, $label); |
89 | 89 | } |
90 | 90 | echo join("\n", $options); |
@@ -65,21 +65,37 @@ |
||
65 | 65 | $_['macintosh'] = 'Western European (Mac) - macintosh'; |
66 | 66 | $_['Windows-1252'] = 'Western European (Windows) - Windows-1252'; |
67 | 67 | |
68 | -if($modx_charset == 'euc-jp') $_['euc-jp'] = 'Japanese (EUC) - euc-jp'; |
|
69 | -elseif($modx_charset == 'shift_jis') $_['shift_jis'] = 'Japanese (Shift-JIS) - shift_jis'; |
|
70 | -elseif($modx_charset == 'iso-2022-jp') $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp'; |
|
71 | -elseif($modx_charset == 'csISO2022JP') $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP'; |
|
72 | -elseif($modx_charset == 'EUC-CN') $_['EUC-CN'] = 'Chinese Simplified (EUC) - EUC-CN'; |
|
73 | -elseif($modx_charset == 'hz-gb-2312') $_['hz-gb-2312'] = 'Chinese Simplified (HZ) - hz-gb-2312'; |
|
74 | -elseif($modx_charset == 'x-mac-chinesesimp') $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp'; |
|
75 | -elseif($modx_charset == 'x-Chinese-CNS') $_['x-Chinese-CNS'] = 'Chinese Traditional (CNS) - x-Chinese-CNS'; |
|
76 | -elseif($modx_charset == 'x-Chinese-Eten') $_['x-Chinese-Eten'] = 'Chinese Traditional (Eten) - x-Chinese-Eten'; |
|
77 | -elseif($modx_charset == 'x-mac-chinesetrad') $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad'; |
|
78 | -elseif($modx_charset == 'ks_c_5601-1987') $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987'; |
|
79 | -elseif($modx_charset == 'euc-kr') $_['euc-kr'] = 'Korean (EUC) - euc-kr'; |
|
80 | -elseif($modx_charset == 'iso-2022-kr') $_['iso-2022-kr'] = 'Korean (ISO) - iso-2022-kr'; |
|
81 | -elseif($modx_charset == 'Johab') $_['Johab'] = 'Korean (Johab) - Johab'; |
|
82 | -elseif($modx_charset == 'x-mac-korean') $_['x-mac-korean'] = 'Korean (Mac) - x-mac-korean'; |
|
68 | +if($modx_charset == 'euc-jp') { |
|
69 | + $_['euc-jp'] = 'Japanese (EUC) - euc-jp'; |
|
70 | +} elseif($modx_charset == 'shift_jis') { |
|
71 | + $_['shift_jis'] = 'Japanese (Shift-JIS) - shift_jis'; |
|
72 | +} elseif($modx_charset == 'iso-2022-jp') { |
|
73 | + $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp'; |
|
74 | +} elseif($modx_charset == 'csISO2022JP') { |
|
75 | + $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP'; |
|
76 | +} elseif($modx_charset == 'EUC-CN') { |
|
77 | + $_['EUC-CN'] = 'Chinese Simplified (EUC) - EUC-CN'; |
|
78 | +} elseif($modx_charset == 'hz-gb-2312') { |
|
79 | + $_['hz-gb-2312'] = 'Chinese Simplified (HZ) - hz-gb-2312'; |
|
80 | +} elseif($modx_charset == 'x-mac-chinesesimp') { |
|
81 | + $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp'; |
|
82 | +} elseif($modx_charset == 'x-Chinese-CNS') { |
|
83 | + $_['x-Chinese-CNS'] = 'Chinese Traditional (CNS) - x-Chinese-CNS'; |
|
84 | +} elseif($modx_charset == 'x-Chinese-Eten') { |
|
85 | + $_['x-Chinese-Eten'] = 'Chinese Traditional (Eten) - x-Chinese-Eten'; |
|
86 | +} elseif($modx_charset == 'x-mac-chinesetrad') { |
|
87 | + $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad'; |
|
88 | +} elseif($modx_charset == 'ks_c_5601-1987') { |
|
89 | + $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987'; |
|
90 | +} elseif($modx_charset == 'euc-kr') { |
|
91 | + $_['euc-kr'] = 'Korean (EUC) - euc-kr'; |
|
92 | +} elseif($modx_charset == 'iso-2022-kr') { |
|
93 | + $_['iso-2022-kr'] = 'Korean (ISO) - iso-2022-kr'; |
|
94 | +} elseif($modx_charset == 'Johab') { |
|
95 | + $_['Johab'] = 'Korean (Johab) - Johab'; |
|
96 | +} elseif($modx_charset == 'x-mac-korean') { |
|
97 | + $_['x-mac-korean'] = 'Korean (Mac) - x-mac-korean'; |
|
98 | +} |
|
83 | 99 | |
84 | 100 | $tpl = '<option value="%s" %s>%s</option>'; |
85 | 101 | $options = array(); |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | global $site_sessionname; |
4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
5 | 5 | |
6 | -function genEvoSessionName() { |
|
6 | +function genEvoSessionName(){ |
|
7 | 7 | $_ = crc32(__FILE__); |
8 | 8 | $_ = sprintf('%u', $_); |
9 | - return 'evo' . base_convert($_,10,36); |
|
9 | + return 'evo'.base_convert($_, 10, 36); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | function startCMSSession(){ |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | session_name($site_sessionname); |
17 | 17 | removeInvalidCmsSessionIds($site_sessionname); |
18 | - $cookieExpiration= 0; |
|
18 | + $cookieExpiration = 0; |
|
19 | 19 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
20 | 20 | $cookiePath = !empty($session_cookie_path) ? $session_cookie_path : MODX_BASE_URL; |
21 | 21 | $cookieDomain = !empty($session_cookie_domain) ? $session_cookie_domain : ''; |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | |
25 | 25 | $key = "modx.{$context}.session.cookie.lifetime"; |
26 | 26 | if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
27 | - $cookieLifetime= intval($_SESSION[$key]); |
|
28 | - if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
27 | + $cookieLifetime = intval($_SESSION[$key]); |
|
28 | + if ($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
|
29 | 29 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
30 | 30 | } |
31 | 31 | if (!isset($_SESSION['modx.session.created.time'])) { |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) { |
|
36 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name){ |
|
37 | 37 | if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) |
38 | 38 | { |
39 | 39 | unset($storage[$session_name]); |
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -function removeInvalidCmsSessionIds($session_name) { |
|
43 | +function removeInvalidCmsSessionIds($session_name){ |
|
44 | 44 | // session ids is invalid iff it is empty string |
45 | 45 | // storage priorioty can see in PHP source ext/session/session.c |
46 | 46 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -3,13 +3,15 @@ discard block |
||
3 | 3 | global $site_sessionname; |
4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
5 | 5 | |
6 | -function genEvoSessionName() { |
|
6 | +function genEvoSessionName() |
|
7 | +{ |
|
7 | 8 | $_ = crc32(__FILE__); |
8 | 9 | $_ = sprintf('%u', $_); |
9 | 10 | return 'evo' . base_convert($_,10,36); |
10 | 11 | } |
11 | 12 | |
12 | -function startCMSSession(){ |
|
13 | +function startCMSSession() |
|
14 | +{ |
|
13 | 15 | |
14 | 16 | global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain; |
15 | 17 | |
@@ -23,24 +25,27 @@ discard block |
||
23 | 25 | session_start(); |
24 | 26 | |
25 | 27 | $key = "modx.{$context}.session.cookie.lifetime"; |
26 | - if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
28 | + if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
27 | 29 | $cookieLifetime= intval($_SESSION[$key]); |
28 | - if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
30 | + if($cookieLifetime) { |
|
31 | + $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
32 | + } |
|
29 | 33 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
30 | 34 | } |
31 | - if (!isset($_SESSION['modx.session.created.time'])) { |
|
35 | + if (!isset($_SESSION['modx.session.created.time'])) { |
|
32 | 36 | $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME']; |
33 | 37 | } |
34 | 38 | } |
35 | 39 | |
36 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) { |
|
37 | - if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) |
|
38 | - { |
|
40 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
41 | +{ |
|
42 | + if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
39 | 43 | unset($storage[$session_name]); |
40 | 44 | } |
41 | 45 | } |
42 | 46 | |
43 | -function removeInvalidCmsSessionIds($session_name) { |
|
47 | +function removeInvalidCmsSessionIds($session_name) |
|
48 | +{ |
|
44 | 49 | // session ids is invalid iff it is empty string |
45 | 50 | // storage priorioty can see in PHP source ext/session/session.c |
46 | 51 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -5,72 +5,72 @@ discard block |
||
5 | 5 | var $errorcode; |
6 | 6 | var $errors = array(); |
7 | 7 | |
8 | - function __construct() { |
|
8 | + function __construct() { |
|
9 | 9 | |
10 | - $_lang = $this->include_lang('errormsg'); |
|
10 | + $_lang = $this->include_lang('errormsg'); |
|
11 | 11 | |
12 | - $this->errors = array( |
|
13 | - 0 => $_lang["No errors occured."], |
|
14 | - 1 => $_lang["An error occured!"], |
|
15 | - 2 => $_lang["Document's ID not passed in request!"], |
|
16 | - 3 => $_lang["You don't have enough privileges for this action!"], |
|
17 | - 4 => $_lang["ID passed in request is NaN!"], |
|
18 | - 5 => $_lang["The document is locked!"], |
|
19 | - 6 => $_lang["Too many results returned from database!"], |
|
20 | - 7 => $_lang["Not enough/ no results returned from database!"], |
|
21 | - 8 => $_lang["Couldn't find parent document's name!"], |
|
22 | - 9 => $_lang["Logging error!"], |
|
23 | - 10 => $_lang["Table to optimise not found in request!"], |
|
24 | - 11 => $_lang["No settings found in request!"], |
|
25 | - 12 => $_lang["The document must have a title!"], |
|
26 | - 13 => $_lang["No user selected as recipient of this message!"], |
|
27 | - 14 => $_lang["No group selected as recipient of this message!"], |
|
28 | - 15 => $_lang["The document was not found!"], |
|
12 | + $this->errors = array( |
|
13 | + 0 => $_lang["No errors occured."], |
|
14 | + 1 => $_lang["An error occured!"], |
|
15 | + 2 => $_lang["Document's ID not passed in request!"], |
|
16 | + 3 => $_lang["You don't have enough privileges for this action!"], |
|
17 | + 4 => $_lang["ID passed in request is NaN!"], |
|
18 | + 5 => $_lang["The document is locked!"], |
|
19 | + 6 => $_lang["Too many results returned from database!"], |
|
20 | + 7 => $_lang["Not enough/ no results returned from database!"], |
|
21 | + 8 => $_lang["Couldn't find parent document's name!"], |
|
22 | + 9 => $_lang["Logging error!"], |
|
23 | + 10 => $_lang["Table to optimise not found in request!"], |
|
24 | + 11 => $_lang["No settings found in request!"], |
|
25 | + 12 => $_lang["The document must have a title!"], |
|
26 | + 13 => $_lang["No user selected as recipient of this message!"], |
|
27 | + 14 => $_lang["No group selected as recipient of this message!"], |
|
28 | + 15 => $_lang["The document was not found!"], |
|
29 | 29 | |
30 | - 100 => $_lang["Double action (GET & POST) posted!"], |
|
31 | - 600 => $_lang["Document cannot be it's own parent!"], |
|
32 | - 601 => $_lang["Document's ID not passed in request!"], |
|
33 | - 602 => $_lang["New parent not set in request!"], |
|
34 | - 900 => $_lang["don't know the user!"], // don't know the user! |
|
35 | - 901 => $_lang["wrong password!"], // wrong password! |
|
36 | - 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
37 | - 903 => $_lang["You are blocked and cannot log in!"], |
|
38 | - 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
39 | - 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
40 | - ); |
|
41 | - } |
|
30 | + 100 => $_lang["Double action (GET & POST) posted!"], |
|
31 | + 600 => $_lang["Document cannot be it's own parent!"], |
|
32 | + 601 => $_lang["Document's ID not passed in request!"], |
|
33 | + 602 => $_lang["New parent not set in request!"], |
|
34 | + 900 => $_lang["don't know the user!"], // don't know the user! |
|
35 | + 901 => $_lang["wrong password!"], // wrong password! |
|
36 | + 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
37 | + 903 => $_lang["You are blocked and cannot log in!"], |
|
38 | + 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
39 | + 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | - function include_lang($context='common') { |
|
44 | - global $modx; |
|
45 | - $_lang = array(); |
|
43 | + function include_lang($context='common') { |
|
44 | + global $modx; |
|
45 | + $_lang = array(); |
|
46 | 46 | |
47 | - $context = trim($context,'/'); |
|
48 | - if(strpos($context,'..')!==false) return; |
|
47 | + $context = trim($context,'/'); |
|
48 | + if(strpos($context,'..')!==false) return; |
|
49 | 49 | |
50 | - if($context === 'common') |
|
51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | - else |
|
53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | - include_once($lang_path . 'english.inc.php'); |
|
55 | - $manager_language = $modx->config['manager_language']; |
|
56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
58 | - return $_lang; |
|
59 | - } |
|
50 | + if($context === 'common') |
|
51 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | + else |
|
53 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | + include_once($lang_path . 'english.inc.php'); |
|
55 | + $manager_language = $modx->config['manager_language']; |
|
56 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
58 | + return $_lang; |
|
59 | + } |
|
60 | 60 | |
61 | - function setError($errorcode, $custommessage=""){ |
|
62 | - $this->errorcode=$errorcode; |
|
63 | - $this->errormessage=$this->errors[$errorcode]; |
|
64 | - if($custommessage!="") { |
|
65 | - $this->errormessage=$custommessage; |
|
66 | - } |
|
67 | - } |
|
61 | + function setError($errorcode, $custommessage=""){ |
|
62 | + $this->errorcode=$errorcode; |
|
63 | + $this->errormessage=$this->errors[$errorcode]; |
|
64 | + if($custommessage!="") { |
|
65 | + $this->errormessage=$custommessage; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - function getError() { |
|
70 | - return $this->errorcode; |
|
71 | - } |
|
69 | + function getError() { |
|
70 | + return $this->errorcode; |
|
71 | + } |
|
72 | 72 | |
73 | - function dumpError(){ |
|
73 | + function dumpError(){ |
|
74 | 74 | ?> |
75 | 75 | <html> |
76 | 76 | <head> |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | </body> |
89 | 89 | </html> |
90 | 90 | <?php |
91 | - exit; |
|
92 | - } |
|
91 | + exit; |
|
92 | + } |
|
93 | 93 | } |
94 | 94 | ?> |
95 | 95 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | var $errorcode; |
6 | 6 | var $errors = array(); |
7 | 7 | |
8 | - function __construct() { |
|
8 | + function __construct(){ |
|
9 | 9 | |
10 | 10 | $_lang = $this->include_lang('errormsg'); |
11 | 11 | |
@@ -40,33 +40,33 @@ discard block |
||
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
43 | - function include_lang($context='common') { |
|
43 | + function include_lang($context = 'common'){ |
|
44 | 44 | global $modx; |
45 | 45 | $_lang = array(); |
46 | 46 | |
47 | - $context = trim($context,'/'); |
|
48 | - if(strpos($context,'..')!==false) return; |
|
47 | + $context = trim($context, '/'); |
|
48 | + if (strpos($context, '..') !== false) return; |
|
49 | 49 | |
50 | - if($context === 'common') |
|
51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
50 | + if ($context === 'common') |
|
51 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
52 | 52 | else |
53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | - include_once($lang_path . 'english.inc.php'); |
|
53 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
54 | + include_once($lang_path.'english.inc.php'); |
|
55 | 55 | $manager_language = $modx->config['manager_language']; |
56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
56 | + if (is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | 57 | include_once("{$lang_path}{$manager_language}.inc.php"); |
58 | 58 | return $_lang; |
59 | 59 | } |
60 | 60 | |
61 | - function setError($errorcode, $custommessage=""){ |
|
62 | - $this->errorcode=$errorcode; |
|
63 | - $this->errormessage=$this->errors[$errorcode]; |
|
64 | - if($custommessage!="") { |
|
65 | - $this->errormessage=$custommessage; |
|
61 | + function setError($errorcode, $custommessage = ""){ |
|
62 | + $this->errorcode = $errorcode; |
|
63 | + $this->errormessage = $this->errors[$errorcode]; |
|
64 | + if ($custommessage != "") { |
|
65 | + $this->errormessage = $custommessage; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | - function getError() { |
|
69 | + function getError(){ |
|
70 | 70 | return $this->errorcode; |
71 | 71 | } |
72 | 72 |
@@ -1,11 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // this is the old error handler. Here for legacy, until i replace all the old errors. |
3 | -class errorHandler{ |
|
3 | +class errorHandler |
|
4 | +{ |
|
4 | 5 | |
5 | 6 | var $errorcode; |
6 | 7 | var $errors = array(); |
7 | 8 | |
8 | - function __construct() { |
|
9 | + function __construct() |
|
10 | + { |
|
9 | 11 | |
10 | 12 | $_lang = $this->include_lang('errormsg'); |
11 | 13 | |
@@ -40,25 +42,31 @@ discard block |
||
40 | 42 | ); |
41 | 43 | } |
42 | 44 | |
43 | - function include_lang($context='common') { |
|
45 | + function include_lang($context='common') |
|
46 | + { |
|
44 | 47 | global $modx; |
45 | 48 | $_lang = array(); |
46 | 49 | |
47 | 50 | $context = trim($context,'/'); |
48 | - if(strpos($context,'..')!==false) return; |
|
51 | + if(strpos($context,'..')!==false) { |
|
52 | + return; |
|
53 | + } |
|
49 | 54 | |
50 | - if($context === 'common') |
|
51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | - else |
|
53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
55 | + if($context === 'common') { |
|
56 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
57 | + } else { |
|
58 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
59 | + } |
|
54 | 60 | include_once($lang_path . 'english.inc.php'); |
55 | 61 | $manager_language = $modx->config['manager_language']; |
56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
62 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) { |
|
63 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
64 | + } |
|
58 | 65 | return $_lang; |
59 | 66 | } |
60 | 67 | |
61 | - function setError($errorcode, $custommessage=""){ |
|
68 | + function setError($errorcode, $custommessage="") |
|
69 | + { |
|
62 | 70 | $this->errorcode=$errorcode; |
63 | 71 | $this->errormessage=$this->errors[$errorcode]; |
64 | 72 | if($custommessage!="") { |
@@ -66,11 +74,13 @@ discard block |
||
66 | 74 | } |
67 | 75 | } |
68 | 76 | |
69 | - function getError() { |
|
77 | + function getError() |
|
78 | + { |
|
70 | 79 | return $this->errorcode; |
71 | 80 | } |
72 | 81 | |
73 | - function dumpError(){ |
|
82 | + function dumpError() |
|
83 | + { |
|
74 | 84 | ?> |
75 | 85 | <html> |
76 | 86 | <head> |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - /** |
|
4 | - * System Alert Message Queue Display file |
|
5 | - * Written By Raymond Irving, April, 2005 |
|
6 | - * |
|
7 | - * Used to display system alert messages inside the browser |
|
8 | - * |
|
9 | - */ |
|
3 | + /** |
|
4 | + * System Alert Message Queue Display file |
|
5 | + * Written By Raymond Irving, April, 2005 |
|
6 | + * |
|
7 | + * Used to display system alert messages inside the browser |
|
8 | + * |
|
9 | + */ |
|
10 | 10 | |
11 | - require_once(dirname(__FILE__).'/protect.inc.php'); |
|
11 | + require_once(dirname(__FILE__).'/protect.inc.php'); |
|
12 | 12 | |
13 | - $sysMsgs = ""; |
|
14 | - $limit = count($SystemAlertMsgQueque); |
|
15 | - for($i=0;$i<$limit;$i++) { |
|
16 | - $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | - } |
|
18 | - // reset message queque |
|
19 | - unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | - $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
13 | + $sysMsgs = ""; |
|
14 | + $limit = count($SystemAlertMsgQueque); |
|
15 | + for($i=0;$i<$limit;$i++) { |
|
16 | + $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | + } |
|
18 | + // reset message queque |
|
19 | + unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | + $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if($sysMsgs!="") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
27 | - echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
27 | + echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
28 | 28 | ?> |
29 | 29 | <script type="text/javascript"> |
30 | 30 | // <![CDATA[ |
@@ -42,5 +42,5 @@ discard block |
||
42 | 42 | // ]]> |
43 | 43 | </script> |
44 | 44 | <?php |
45 | - } |
|
45 | + } |
|
46 | 46 | ?> |
47 | 47 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $sysMsgs = ""; |
14 | 14 | $limit = count($SystemAlertMsgQueque); |
15 | - for($i=0;$i<$limit;$i++) { |
|
15 | + for ($i = 0; $i < $limit; $i++) { |
|
16 | 16 | $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
17 | 17 | } |
18 | 18 | // reset message queque |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $_SESSION['SystemAlertMsgQueque'] = array(); |
21 | 21 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if ($sysMsgs != "") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | var sysAlert = new Element('div').setProperties({ |
33 | 33 | 'class': 'sysAlert' |
34 | 34 | }); |
35 | - sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs);?>'; |
|
35 | + sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs); ?>'; |
|
36 | 36 | var boxHtml = new MooPrompt('<?php echo $_lang['sys_alert']; ?>', sysAlert, { |
37 | 37 | buttons: 1, |
38 | 38 | button1: 'Ok', |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | class Paging |
32 | 32 | { |
33 | 33 | |
34 | - var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | - var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | - var $int_cur_position;// Current position in recordset |
|
37 | - var $str_ext_argv; // Extra argv of query string |
|
34 | + var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | + var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | + var $int_cur_position; // Current position in recordset |
|
37 | + var $str_ext_argv; // Extra argv of query string |
|
38 | 38 | |
39 | 39 | // ------------------------------------------------------------------------ Constructor |
40 | 40 | // |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | $array_paging['total'] = $this->int_nbr_row; |
65 | 65 | |
66 | 66 | if ($this->int_cur_position != 0) { |
67 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
68 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
67 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
68 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
72 | 72 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
73 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
74 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
73 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
74 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
75 | 75 | } |
76 | 76 | return $array_paging; |
77 | 77 | } // end function |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
87 | 87 | // if current page, do not make a link |
88 | 88 | if ($i == $this->getCurrentPage()) { |
89 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
89 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
90 | 90 | } else { |
91 | 91 | $int_new_position = ($i * $this->int_num_result); |
92 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
92 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | return $array_all_page; |