@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | $modx->config['enable_filter'] = 1; |
3 | 3 | |
4 | -$modx->addSnippet('hasPermission','return $modx->hasPermission($key);'); |
|
4 | +$modx->addSnippet('hasPermission', 'return $modx->hasPermission($key);'); |
|
5 | 5 | |
6 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) |
|
6 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) |
|
7 | 7 | $hasAnyPermission = 1; |
8 | 8 | else $hasAnyPermission = 0; |
9 | -$modx->addSnippet('hasAnyPermission','global $hasAnyPermission; return $hasAnyPermission;'); |
|
10 | -$modx->addSnippet('getLoginUserName','return $modx->getLoginUserName();'); |
|
9 | +$modx->addSnippet('hasAnyPermission', 'global $hasAnyPermission; return $hasAnyPermission;'); |
|
10 | +$modx->addSnippet('getLoginUserName', 'return $modx->getLoginUserName();'); |
|
11 | 11 | $code = 'global $_lang;return $_SESSION["nrtotalmessages"] ? sprintf($_lang["welcome_messages"], $_SESSION["nrtotalmessages"], \'<span style="color:red;">\' . $_SESSION["nrnewmessages"] . "</span>") : $_lang["messages_no_messages"];'; |
12 | -$modx->addSnippet('getMessageCount',$code); |
|
12 | +$modx->addSnippet('getMessageCount', $code); |
|
13 | 13 | |
14 | 14 | // Large Icons |
15 | 15 | $_style['icons_backup_large'] = 'fa fa-database fa-fw fa-2x'; |
@@ -3,9 +3,11 @@ |
||
3 | 3 | |
4 | 4 | $modx->addSnippet('hasPermission','return $modx->hasPermission($key);'); |
5 | 5 | |
6 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) |
|
7 | - $hasAnyPermission = 1; |
|
8 | -else $hasAnyPermission = 0; |
|
6 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
7 | + $hasAnyPermission = 1; |
|
8 | +} else { |
|
9 | + $hasAnyPermission = 0; |
|
10 | +} |
|
9 | 11 | $modx->addSnippet('hasAnyPermission','global $hasAnyPermission; return $hasAnyPermission;'); |
10 | 12 | $modx->addSnippet('getLoginUserName','return $modx->getLoginUserName();'); |
11 | 13 | $code = 'global $_lang;return $_SESSION["nrtotalmessages"] ? sprintf($_lang["welcome_messages"], $_SESSION["nrtotalmessages"], \'<span style="color:red;">\' . $_SESSION["nrnewmessages"] . "</span>") : $_lang["messages_no_messages"];'; |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | $modx->loadExtension("ManagerAPI"); |
20 | 20 | |
21 | 21 | $_lang = array(); |
22 | -include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
|
22 | +include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php'; |
|
23 | 23 | if ($modx->config['manager_language'] != 'english') { |
24 | - include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
|
24 | + include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php'; |
|
25 | 25 | } |
26 | -include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
|
26 | +include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php'; |
|
27 | 27 | |
28 | 28 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
29 | 29 | $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : ''; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | switch ($frame) { |
42 | 42 | case 'nodes': |
43 | - include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
|
43 | + include_once MODX_MANAGER_PATH.'/frames/nodes.php'; |
|
44 | 44 | |
45 | 45 | break; |
46 | 46 | } |
@@ -58,21 +58,21 @@ discard block |
||
58 | 58 | $sql = ''; |
59 | 59 | $a = ''; |
60 | 60 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : ''; |
61 | - $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
62 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
61 | + $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
62 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
63 | 63 | |
64 | 64 | switch ($elements) { |
65 | 65 | case 'element_templates': |
66 | 66 | $a = 16; |
67 | - $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
67 | + $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
68 | 68 | $sql = $modx->db->query('SELECT t1.*, t1.templatename AS name |
69 | - FROM ' . $modx->getFullTableName('site_templates') . ' AS t1 |
|
70 | - ' . $sqlLike . ' |
|
69 | + FROM ' . $modx->getFullTableName('site_templates').' AS t1 |
|
70 | + ' . $sqlLike.' |
|
71 | 71 | ORDER BY t1.templatename ASC |
72 | 72 | ' . $sqlLimit); |
73 | 73 | |
74 | 74 | if ($modx->hasPermission('new_template')) { |
75 | - $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
|
75 | + $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | break; |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | case 'element_tplvars': |
81 | 81 | $a = 301; |
82 | 82 | $sql = $modx->db->query('SELECT t1.*, IF(t2.templateid,0,1) AS disabled |
83 | - FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1 |
|
84 | - LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid |
|
85 | - ' . $sqlLike . ' |
|
83 | + FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1 |
|
84 | + LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid |
|
85 | + ' . $sqlLike.' |
|
86 | 86 | GROUP BY t1.id |
87 | 87 | ORDER BY t1.name ASC |
88 | 88 | ' . $sqlLimit); |
89 | 89 | |
90 | 90 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
91 | - $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
|
91 | + $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | break; |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | case 'element_htmlsnippets': |
97 | 97 | $a = 78; |
98 | 98 | $sql = $modx->db->query('SELECT t1.* |
99 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1 |
|
100 | - ' . $sqlLike . ' |
|
99 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1 |
|
100 | + ' . $sqlLike.' |
|
101 | 101 | ORDER BY t1.name ASC |
102 | 102 | ' . $sqlLimit); |
103 | 103 | |
104 | 104 | if ($modx->hasPermission('new_chunk')) { |
105 | - $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
|
105 | + $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | break; |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | case 'element_snippets': |
111 | 111 | $a = 22; |
112 | 112 | $sql = $modx->db->query('SELECT t1.* |
113 | - FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1 |
|
114 | - ' . $sqlLike . ' |
|
113 | + FROM ' . $modx->getFullTableName('site_snippets').' AS t1 |
|
114 | + ' . $sqlLike.' |
|
115 | 115 | ORDER BY t1.name ASC |
116 | 116 | ' . $sqlLimit); |
117 | 117 | |
118 | 118 | if ($modx->hasPermission('new_snippet')) { |
119 | - $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
|
119 | + $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | break; |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | case 'element_plugins': |
125 | 125 | $a = 102; |
126 | 126 | $sql = $modx->db->query('SELECT t1.* |
127 | - FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1 |
|
128 | - ' . $sqlLike . ' |
|
127 | + FROM ' . $modx->getFullTableName('site_plugins').' AS t1 |
|
128 | + ' . $sqlLike.' |
|
129 | 129 | ORDER BY t1.name ASC |
130 | 130 | ' . $sqlLimit); |
131 | 131 | |
132 | 132 | if ($modx->hasPermission('new_plugin')) { |
133 | - $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
|
133 | + $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>'; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | break; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
148 | - $items .= '<li class="item ' . ($row['disabled'] ? 'disabled' : '') . ($row['locked'] ? ' locked' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main" data-parent-id="a_76__elements_' . $elements . '">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>' . "\n"; |
|
148 | + $items .= '<li class="item '.($row['disabled'] ? 'disabled' : '').($row['locked'] ? ' locked' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main" data-parent-id="a_76__elements_'.$elements.'">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'."\n"; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | $output = ''; |
167 | 167 | $items = ''; |
168 | 168 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
169 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
170 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
169 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
170 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
171 | 171 | |
172 | 172 | $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked |
173 | - FROM ' . $modx->getFullTableName('manager_users') . ' AS t1 |
|
174 | - LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey |
|
175 | - ' . $sqlLike . ' |
|
173 | + FROM ' . $modx->getFullTableName('manager_users').' AS t1 |
|
174 | + LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey |
|
175 | + ' . $sqlLike.' |
|
176 | 176 | ORDER BY t1.username ASC |
177 | 177 | ' . $sqlLimit); |
178 | 178 | |
179 | 179 | if ($modx->hasPermission('new_user')) { |
180 | - $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
|
180 | + $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>'; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | if ($count = $modx->db->getRecordCount($sql)) { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
186 | 186 | } |
187 | 187 | while ($row = $modx->db->getRow($sql)) { |
188 | - $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
|
188 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | $output = ''; |
206 | 206 | $items = ''; |
207 | 207 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
208 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
209 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
208 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
209 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
210 | 210 | |
211 | 211 | $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked |
212 | - FROM ' . $modx->getFullTableName('web_users') . ' AS t1 |
|
213 | - LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey |
|
214 | - ' . $sqlLike . ' |
|
212 | + FROM ' . $modx->getFullTableName('web_users').' AS t1 |
|
213 | + LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey |
|
214 | + ' . $sqlLike.' |
|
215 | 215 | ORDER BY t1.username ASC |
216 | 216 | ' . $sqlLimit); |
217 | 217 | |
218 | 218 | if ($modx->hasPermission('new_web_user')) { |
219 | - $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
|
219 | + $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>'; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | if ($count = $modx->db->getRecordCount($sql)) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
225 | 225 | } |
226 | 226 | while ($row = $modx->db->getRow($sql)) { |
227 | - $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
|
227 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
@@ -250,35 +250,35 @@ discard block |
||
250 | 250 | case 'SnippetNoCache': { |
251 | 251 | |
252 | 252 | $sql = $modx->db->query('SELECT * |
253 | - FROM ' . $modx->getFullTableName('site_snippets') . ' |
|
254 | - WHERE name="' . $name . '" |
|
253 | + FROM ' . $modx->getFullTableName('site_snippets').' |
|
254 | + WHERE name="' . $name.'" |
|
255 | 255 | LIMIT 1'); |
256 | 256 | |
257 | 257 | if ($modx->db->getRecordCount($sql)) { |
258 | 258 | $row = $modx->db->getRow($sql); |
259 | 259 | $contextmenu = array( |
260 | 260 | 'header' => array( |
261 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
261 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
262 | 262 | ), |
263 | 263 | 'item' => array( |
264 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
265 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
264 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
265 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
266 | 266 | ) |
267 | 267 | ); |
268 | 268 | if (!empty($row['description'])) { |
269 | 269 | $contextmenu['seperator'] = ''; |
270 | 270 | $contextmenu['description'] = array( |
271 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
271 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
272 | 272 | ); |
273 | 273 | } |
274 | 274 | } else { |
275 | 275 | $contextmenu = array( |
276 | 276 | 'header' => array( |
277 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
277 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
278 | 278 | ), |
279 | 279 | 'item' => array( |
280 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
281 | - 'url' => "index.php?a=23&itemname=" . $name |
|
280 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
281 | + 'url' => "index.php?a=23&itemname=".$name |
|
282 | 282 | ) |
283 | 283 | ); |
284 | 284 | } |
@@ -288,35 +288,35 @@ discard block |
||
288 | 288 | case 'Chunk' : { |
289 | 289 | |
290 | 290 | $sql = $modx->db->query('SELECT * |
291 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' |
|
292 | - WHERE name="' . $name . '" |
|
291 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' |
|
292 | + WHERE name="' . $name.'" |
|
293 | 293 | LIMIT 1'); |
294 | 294 | |
295 | 295 | if ($modx->db->getRecordCount($sql)) { |
296 | 296 | $row = $modx->db->getRow($sql); |
297 | 297 | $contextmenu = array( |
298 | 298 | 'header' => array( |
299 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name'] |
|
299 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name'] |
|
300 | 300 | ), |
301 | 301 | 'item' => array( |
302 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
303 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
302 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
303 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
304 | 304 | ) |
305 | 305 | ); |
306 | 306 | if (!empty($row['description'])) { |
307 | 307 | $contextmenu['seperator'] = ''; |
308 | 308 | $contextmenu['description'] = array( |
309 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
309 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
310 | 310 | ); |
311 | 311 | } |
312 | 312 | } else { |
313 | 313 | $contextmenu = array( |
314 | 314 | 'header' => array( |
315 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
|
315 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$name |
|
316 | 316 | ), |
317 | 317 | 'item' => array( |
318 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
319 | - 'url' => "index.php?a=77&itemname=" . $name |
|
318 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
319 | + 'url' => "index.php?a=77&itemname=".$name |
|
320 | 320 | ) |
321 | 321 | ); |
322 | 322 | } |
@@ -325,8 +325,8 @@ discard block |
||
325 | 325 | } |
326 | 326 | case 'AttributeValue': { |
327 | 327 | $sql = $modx->db->query('SELECT * |
328 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' |
|
329 | - WHERE name="' . $name . '" |
|
328 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' |
|
329 | + WHERE name="' . $name.'" |
|
330 | 330 | LIMIT 1'); |
331 | 331 | |
332 | 332 | if ($modx->db->getRecordCount($sql)) { |
@@ -336,52 +336,52 @@ discard block |
||
336 | 336 | 'innerText' => $row['name'] |
337 | 337 | ), |
338 | 338 | 'item' => array( |
339 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
340 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
339 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
340 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
341 | 341 | ) |
342 | 342 | ); |
343 | 343 | if (!empty($row['description'])) { |
344 | 344 | $contextmenu['seperator'] = ''; |
345 | 345 | $contextmenu['description'] = array( |
346 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
346 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
347 | 347 | ); |
348 | 348 | } |
349 | 349 | } else { |
350 | 350 | |
351 | 351 | $sql = $modx->db->query('SELECT * |
352 | - FROM ' . $modx->getFullTableName('site_snippets') . ' |
|
353 | - WHERE name="' . $name . '" |
|
352 | + FROM ' . $modx->getFullTableName('site_snippets').' |
|
353 | + WHERE name="' . $name.'" |
|
354 | 354 | LIMIT 1'); |
355 | 355 | |
356 | 356 | if ($modx->db->getRecordCount($sql)) { |
357 | 357 | $row = $modx->db->getRow($sql); |
358 | 358 | $contextmenu = array( |
359 | 359 | 'header' => array( |
360 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
360 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
361 | 361 | ), |
362 | 362 | 'item' => array( |
363 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
364 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
363 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
364 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
365 | 365 | ) |
366 | 366 | ); |
367 | 367 | if (!empty($row['description'])) { |
368 | 368 | $contextmenu['seperator'] = ''; |
369 | 369 | $contextmenu['description'] = array( |
370 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
370 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
371 | 371 | ); |
372 | 372 | } |
373 | 373 | } else { |
374 | 374 | $contextmenu = array( |
375 | 375 | 'header' => array( |
376 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
376 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
377 | 377 | ), |
378 | 378 | 'item' => array( |
379 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
380 | - 'url' => "index.php?a=77&itemname=" . $name |
|
379 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
380 | + 'url' => "index.php?a=77&itemname=".$name |
|
381 | 381 | ), |
382 | 382 | 'item2' => array( |
383 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
384 | - 'url' => "index.php?a=23&itemname=" . $name |
|
383 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
384 | + 'url' => "index.php?a=23&itemname=".$name |
|
385 | 385 | ) |
386 | 386 | ); |
387 | 387 | } |
@@ -437,35 +437,35 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | $sql = $modx->db->query('SELECT * |
440 | - FROM ' . $modx->getFullTableName('site_tmplvars') . ' |
|
441 | - WHERE name="' . $name . '" |
|
440 | + FROM ' . $modx->getFullTableName('site_tmplvars').' |
|
441 | + WHERE name="' . $name.'" |
|
442 | 442 | LIMIT 1'); |
443 | 443 | |
444 | 444 | if ($modx->db->getRecordCount($sql)) { |
445 | 445 | $row = $modx->db->getRow($sql); |
446 | 446 | $contextmenu = array( |
447 | 447 | 'header' => array( |
448 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name'] |
|
448 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name'] |
|
449 | 449 | ), |
450 | 450 | 'item' => array( |
451 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
452 | - 'url' => "index.php?a=301&id=" . $row['id'] |
|
451 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
452 | + 'url' => "index.php?a=301&id=".$row['id'] |
|
453 | 453 | ) |
454 | 454 | ); |
455 | 455 | if (!empty($row['description'])) { |
456 | 456 | $contextmenu['seperator'] = ''; |
457 | 457 | $contextmenu['description'] = array( |
458 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
458 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
459 | 459 | ); |
460 | 460 | } |
461 | 461 | } else { |
462 | 462 | $contextmenu = array( |
463 | 463 | 'header' => array( |
464 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
|
464 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name |
|
465 | 465 | ), |
466 | 466 | 'item' => array( |
467 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'], |
|
468 | - 'url' => "index.php?a=300&itemname=" . $name |
|
467 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'], |
|
468 | + 'url' => "index.php?a=300&itemname=".$name |
|
469 | 469 | ) |
470 | 470 | ); |
471 | 471 | } |
@@ -484,15 +484,15 @@ discard block |
||
484 | 484 | $json = array(); |
485 | 485 | |
486 | 486 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
487 | - $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
488 | - $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
|
487 | + $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
488 | + $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0; |
|
489 | 489 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
490 | 490 | |
491 | 491 | // set parent |
492 | 492 | if ($id && $parent >= 0) { |
493 | 493 | |
494 | 494 | // find older parent |
495 | - $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id)); |
|
495 | + $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id='.$id)); |
|
496 | 496 | |
497 | 497 | $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [ |
498 | 498 | 'id_document' => $id, |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | if (empty($json['errors'])) { |
514 | 514 | // check privileges user for move docs |
515 | 515 | if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
516 | - $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')'); |
|
516 | + $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')'); |
|
517 | 517 | if ($modx->db->getRecordCount($sql)) { |
518 | 518 | $document_groups = array(); |
519 | 519 | while ($row = $modx->db->getRow($sql)) { |
@@ -538,22 +538,22 @@ discard block |
||
538 | 538 | // set new parent |
539 | 539 | $modx->db->update(array( |
540 | 540 | 'parent' => $parent |
541 | - ), $modx->getFullTableName('site_content'), 'id=' . $id); |
|
541 | + ), $modx->getFullTableName('site_content'), 'id='.$id); |
|
542 | 542 | // set parent isfolder = 1 |
543 | 543 | $modx->db->update(array( |
544 | 544 | 'isfolder' => 1 |
545 | - ), $modx->getFullTableName('site_content'), 'id=' . $parent); |
|
545 | + ), $modx->getFullTableName('site_content'), 'id='.$parent); |
|
546 | 546 | |
547 | 547 | if ($parent != $parentOld) { |
548 | 548 | // check children docs and set parent isfolder |
549 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
549 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) { |
|
550 | 550 | $modx->db->update(array( |
551 | 551 | 'isfolder' => 1 |
552 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
|
552 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld); |
|
553 | 553 | } else { |
554 | 554 | $modx->db->update(array( |
555 | 555 | 'isfolder' => 0 |
556 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
|
556 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld); |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | if (!empty($menuindex)) { |
562 | 562 | $menuindex = explode(',', $menuindex); |
563 | 563 | foreach ($menuindex as $key => $value) { |
564 | - $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value); |
|
564 | + $modx->db->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value); |
|
565 | 565 | } |
566 | 566 | } else { |
567 | 567 | // TODO: max(*) menuindex |
@@ -590,19 +590,19 @@ discard block |
||
590 | 590 | } |
591 | 591 | |
592 | 592 | case 'getLockedElements': { |
593 | - $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0; |
|
594 | - $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
593 | + $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0; |
|
594 | + $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
595 | 595 | |
596 | 596 | $output = !!$modx->elementIsLocked($type, $id, true); |
597 | 597 | |
598 | 598 | if (!$output) { |
599 | 599 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
600 | - $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : ''; |
|
600 | + $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : ''; |
|
601 | 601 | $sql = ' |
602 | - SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked |
|
603 | - FROM ' . $modx->getFullTableName('site_content') . ' AS sc |
|
604 | - LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id |
|
605 | - WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
|
602 | + SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked |
|
603 | + FROM ' . $modx->getFullTableName('site_content').' AS sc |
|
604 | + LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id |
|
605 | + WHERE sc.id=' . $id.' GROUP BY sc.id'; |
|
606 | 606 | $sql = $modx->db->query($sql); |
607 | 607 | if ($modx->db->getRecordCount($sql)) { |
608 | 608 | $row = $modx->db->getRow($sql); |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | |
8 | 8 | $modx->db->connect(); |
9 | 9 | |
10 | -if (empty ($modx->config)) { |
|
10 | +if (empty ($modx->config)) { |
|
11 | 11 | $modx->getSettings(); |
12 | 12 | } |
13 | 13 | |
14 | -if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) { |
|
14 | +if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) { |
|
15 | 15 | $modx->sendErrorPage(); |
16 | 16 | } |
17 | 17 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $_lang = array(); |
22 | 22 | include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
23 | -if ($modx->config['manager_language'] != 'english') { |
|
23 | +if ($modx->config['manager_language'] != 'english') { |
|
24 | 24 | include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
25 | 25 | } |
26 | 26 | include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | // set limit sql query |
34 | 34 | $limit = !empty($modx->config['number_of_results']) ? (int) $modx->config['number_of_results'] : 100; |
35 | 35 | |
36 | -if (isset($action)) { |
|
37 | - switch ($action) { |
|
36 | +if (isset($action)) { |
|
37 | + switch ($action) { |
|
38 | 38 | |
39 | 39 | case '1': { |
40 | 40 | |
41 | - switch ($frame) { |
|
41 | + switch ($frame) { |
|
42 | 42 | case 'nodes': |
43 | 43 | include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : ''; |
54 | 54 | |
55 | - if ($elements) { |
|
55 | + if ($elements) { |
|
56 | 56 | $output = ''; |
57 | 57 | $items = ''; |
58 | 58 | $sql = ''; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
62 | 62 | $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
63 | 63 | |
64 | - switch ($elements) { |
|
64 | + switch ($elements) { |
|
65 | 65 | case 'element_templates': |
66 | 66 | $a = 16; |
67 | 67 | $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | ORDER BY t1.templatename ASC |
72 | 72 | ' . $sqlLimit); |
73 | 73 | |
74 | - if ($modx->hasPermission('new_template')) { |
|
74 | + if ($modx->hasPermission('new_template')) { |
|
75 | 75 | $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
76 | 76 | } |
77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ORDER BY t1.name ASC |
88 | 88 | ' . $sqlLimit); |
89 | 89 | |
90 | - if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
90 | + if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
91 | 91 | $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
92 | 92 | } |
93 | 93 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ORDER BY t1.name ASC |
102 | 102 | ' . $sqlLimit); |
103 | 103 | |
104 | - if ($modx->hasPermission('new_chunk')) { |
|
104 | + if ($modx->hasPermission('new_chunk')) { |
|
105 | 105 | $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
106 | 106 | } |
107 | 107 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ORDER BY t1.name ASC |
116 | 116 | ' . $sqlLimit); |
117 | 117 | |
118 | - if ($modx->hasPermission('new_snippet')) { |
|
118 | + if ($modx->hasPermission('new_snippet')) { |
|
119 | 119 | $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
120 | 120 | } |
121 | 121 | |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | ORDER BY t1.name ASC |
130 | 130 | ' . $sqlLimit); |
131 | 131 | |
132 | - if ($modx->hasPermission('new_plugin')) { |
|
132 | + if ($modx->hasPermission('new_plugin')) { |
|
133 | 133 | $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
134 | 134 | } |
135 | 135 | |
136 | 136 | break; |
137 | 137 | } |
138 | 138 | |
139 | - if ($count = $modx->db->getRecordCount($sql)) { |
|
140 | - if ($count == $limit) { |
|
139 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
140 | + if ($count == $limit) { |
|
141 | 141 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
142 | 142 | } |
143 | - while ($row = $modx->db->getRow($sql)) { |
|
144 | - if (($row['disabled'] || $row['locked']) && $role != 1) { |
|
143 | + while ($row = $modx->db->getRow($sql)) { |
|
144 | + if (($row['disabled'] || $row['locked']) && $role != 1) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - if (isset($_REQUEST['filter'])) { |
|
152 | + if (isset($_REQUEST['filter'])) { |
|
153 | 153 | $output = $items; |
154 | - } else { |
|
154 | + } else { |
|
155 | 155 | $output .= $items; |
156 | 156 | } |
157 | 157 | |
@@ -176,22 +176,22 @@ discard block |
||
176 | 176 | ORDER BY t1.username ASC |
177 | 177 | ' . $sqlLimit); |
178 | 178 | |
179 | - if ($modx->hasPermission('new_user')) { |
|
179 | + if ($modx->hasPermission('new_user')) { |
|
180 | 180 | $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
181 | 181 | } |
182 | 182 | |
183 | - if ($count = $modx->db->getRecordCount($sql)) { |
|
184 | - if ($count == $limit) { |
|
183 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
184 | + if ($count == $limit) { |
|
185 | 185 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
186 | 186 | } |
187 | - while ($row = $modx->db->getRow($sql)) { |
|
187 | + while ($row = $modx->db->getRow($sql)) { |
|
188 | 188 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - if (isset($_REQUEST['filter'])) { |
|
192 | + if (isset($_REQUEST['filter'])) { |
|
193 | 193 | $output = $items; |
194 | - } else { |
|
194 | + } else { |
|
195 | 195 | $output .= $items; |
196 | 196 | } |
197 | 197 | |
@@ -215,22 +215,22 @@ discard block |
||
215 | 215 | ORDER BY t1.username ASC |
216 | 216 | ' . $sqlLimit); |
217 | 217 | |
218 | - if ($modx->hasPermission('new_web_user')) { |
|
218 | + if ($modx->hasPermission('new_web_user')) { |
|
219 | 219 | $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
220 | 220 | } |
221 | 221 | |
222 | - if ($count = $modx->db->getRecordCount($sql)) { |
|
223 | - if ($count == $limit) { |
|
222 | + if ($count = $modx->db->getRecordCount($sql)) { |
|
223 | + if ($count == $limit) { |
|
224 | 224 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
225 | 225 | } |
226 | - while ($row = $modx->db->getRow($sql)) { |
|
226 | + while ($row = $modx->db->getRow($sql)) { |
|
227 | 227 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | - if (isset($_REQUEST['filter'])) { |
|
231 | + if (isset($_REQUEST['filter'])) { |
|
232 | 232 | $output = $items; |
233 | - } else { |
|
233 | + } else { |
|
234 | 234 | $output .= $items; |
235 | 235 | } |
236 | 236 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->db->escape($_REQUEST['type']) : false; |
245 | 245 | $contextmenu = ''; |
246 | 246 | |
247 | - if ($role && $name && $type) { |
|
248 | - switch ($type) { |
|
247 | + if ($role && $name && $type) { |
|
248 | + switch ($type) { |
|
249 | 249 | case 'Snippet': |
250 | 250 | case 'SnippetNoCache': { |
251 | 251 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | WHERE name="' . $name . '" |
255 | 255 | LIMIT 1'); |
256 | 256 | |
257 | - if ($modx->db->getRecordCount($sql)) { |
|
257 | + if ($modx->db->getRecordCount($sql)) { |
|
258 | 258 | $row = $modx->db->getRow($sql); |
259 | 259 | $contextmenu = array( |
260 | 260 | 'header' => array( |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | 'url' => "index.php?a=22&id=" . $row['id'] |
266 | 266 | ) |
267 | 267 | ); |
268 | - if (!empty($row['description'])) { |
|
268 | + if (!empty($row['description'])) { |
|
269 | 269 | $contextmenu['seperator'] = ''; |
270 | 270 | $contextmenu['description'] = array( |
271 | 271 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
272 | 272 | ); |
273 | 273 | } |
274 | - } else { |
|
274 | + } else { |
|
275 | 275 | $contextmenu = array( |
276 | 276 | 'header' => array( |
277 | 277 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | WHERE name="' . $name . '" |
293 | 293 | LIMIT 1'); |
294 | 294 | |
295 | - if ($modx->db->getRecordCount($sql)) { |
|
295 | + if ($modx->db->getRecordCount($sql)) { |
|
296 | 296 | $row = $modx->db->getRow($sql); |
297 | 297 | $contextmenu = array( |
298 | 298 | 'header' => array( |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | 'url' => "index.php?a=78&id=" . $row['id'] |
304 | 304 | ) |
305 | 305 | ); |
306 | - if (!empty($row['description'])) { |
|
306 | + if (!empty($row['description'])) { |
|
307 | 307 | $contextmenu['seperator'] = ''; |
308 | 308 | $contextmenu['description'] = array( |
309 | 309 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
310 | 310 | ); |
311 | 311 | } |
312 | - } else { |
|
312 | + } else { |
|
313 | 313 | $contextmenu = array( |
314 | 314 | 'header' => array( |
315 | 315 | 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | WHERE name="' . $name . '" |
330 | 330 | LIMIT 1'); |
331 | 331 | |
332 | - if ($modx->db->getRecordCount($sql)) { |
|
332 | + if ($modx->db->getRecordCount($sql)) { |
|
333 | 333 | $row = $modx->db->getRow($sql); |
334 | 334 | $contextmenu = array( |
335 | 335 | 'header' => array( |
@@ -340,20 +340,20 @@ discard block |
||
340 | 340 | 'url' => "index.php?a=78&id=" . $row['id'] |
341 | 341 | ) |
342 | 342 | ); |
343 | - if (!empty($row['description'])) { |
|
343 | + if (!empty($row['description'])) { |
|
344 | 344 | $contextmenu['seperator'] = ''; |
345 | 345 | $contextmenu['description'] = array( |
346 | 346 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
347 | 347 | ); |
348 | 348 | } |
349 | - } else { |
|
349 | + } else { |
|
350 | 350 | |
351 | 351 | $sql = $modx->db->query('SELECT * |
352 | 352 | FROM ' . $modx->getFullTableName('site_snippets') . ' |
353 | 353 | WHERE name="' . $name . '" |
354 | 354 | LIMIT 1'); |
355 | 355 | |
356 | - if ($modx->db->getRecordCount($sql)) { |
|
356 | + if ($modx->db->getRecordCount($sql)) { |
|
357 | 357 | $row = $modx->db->getRow($sql); |
358 | 358 | $contextmenu = array( |
359 | 359 | 'header' => array( |
@@ -364,13 +364,13 @@ discard block |
||
364 | 364 | 'url' => "index.php?a=22&id=" . $row['id'] |
365 | 365 | ) |
366 | 366 | ); |
367 | - if (!empty($row['description'])) { |
|
367 | + if (!empty($row['description'])) { |
|
368 | 368 | $contextmenu['seperator'] = ''; |
369 | 369 | $contextmenu['description'] = array( |
370 | 370 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
371 | 371 | ); |
372 | 372 | } |
373 | - } else { |
|
373 | + } else { |
|
374 | 374 | $contextmenu = array( |
375 | 375 | 'header' => array( |
376 | 376 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | 'alias_visible' |
433 | 433 | ); |
434 | 434 | |
435 | - if (in_array($name, $default_field)) { |
|
435 | + if (in_array($name, $default_field)) { |
|
436 | 436 | return; |
437 | 437 | } |
438 | 438 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | WHERE name="' . $name . '" |
442 | 442 | LIMIT 1'); |
443 | 443 | |
444 | - if ($modx->db->getRecordCount($sql)) { |
|
444 | + if ($modx->db->getRecordCount($sql)) { |
|
445 | 445 | $row = $modx->db->getRow($sql); |
446 | 446 | $contextmenu = array( |
447 | 447 | 'header' => array( |
@@ -452,13 +452,13 @@ discard block |
||
452 | 452 | 'url' => "index.php?a=301&id=" . $row['id'] |
453 | 453 | ) |
454 | 454 | ); |
455 | - if (!empty($row['description'])) { |
|
455 | + if (!empty($row['description'])) { |
|
456 | 456 | $contextmenu['seperator'] = ''; |
457 | 457 | $contextmenu['description'] = array( |
458 | 458 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
459 | 459 | ); |
460 | 460 | } |
461 | - } else { |
|
461 | + } else { |
|
462 | 462 | $contextmenu = array( |
463 | 463 | 'header' => array( |
464 | 464 | 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
@@ -483,13 +483,13 @@ discard block |
||
483 | 483 | case 'movedocument' : { |
484 | 484 | $json = array(); |
485 | 485 | |
486 | - if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
486 | + if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
487 | 487 | $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
488 | 488 | $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
489 | 489 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
490 | 490 | |
491 | 491 | // set parent |
492 | - if ($id && $parent >= 0) { |
|
492 | + if ($id && $parent >= 0) { |
|
493 | 493 | |
494 | 494 | // find older parent |
495 | 495 | $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id)); |
@@ -500,31 +500,31 @@ discard block |
||
500 | 500 | 'new_parent' => $parent, |
501 | 501 | ]); |
502 | 502 | |
503 | - if (is_array($eventOut) && count($eventOut) > 0) { |
|
503 | + if (is_array($eventOut) && count($eventOut) > 0) { |
|
504 | 504 | $eventParent = array_pop($eventOut); |
505 | 505 | |
506 | - if ($eventParent == $parentOld) { |
|
506 | + if ($eventParent == $parentOld) { |
|
507 | 507 | $json['errors'] = $_lang['error_movedocument2']; |
508 | - } else { |
|
508 | + } else { |
|
509 | 509 | $parent = $eventParent; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | - if (empty($json['errors'])) { |
|
513 | + if (empty($json['errors'])) { |
|
514 | 514 | // check privileges user for move docs |
515 | - if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
515 | + if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
516 | 516 | $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')'); |
517 | - if ($modx->db->getRecordCount($sql)) { |
|
517 | + if ($modx->db->getRecordCount($sql)) { |
|
518 | 518 | $document_groups = array(); |
519 | - while ($row = $modx->db->getRow($sql)) { |
|
519 | + while ($row = $modx->db->getRow($sql)) { |
|
520 | 520 | $document_groups[$row['document']]['groups'][] = $row['document_group']; |
521 | 521 | } |
522 | - foreach ($document_groups as $key => $value) { |
|
523 | - if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
522 | + foreach ($document_groups as $key => $value) { |
|
523 | + if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
524 | 524 | $json['errors'] = $_lang["error_no_privileges"]; |
525 | 525 | } |
526 | 526 | } |
527 | - if ($json['errors']) { |
|
527 | + if ($json['errors']) { |
|
528 | 528 | header('content-type: application/json'); |
529 | 529 | echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE); |
530 | 530 | break; |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
535 | - if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
535 | + if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
536 | 536 | $json['errors'] = $_lang["error_no_privileges"]; |
537 | - } else { |
|
537 | + } else { |
|
538 | 538 | // set new parent |
539 | 539 | $modx->db->update(array( |
540 | 540 | 'parent' => $parent |
@@ -544,13 +544,13 @@ discard block |
||
544 | 544 | 'isfolder' => 1 |
545 | 545 | ), $modx->getFullTableName('site_content'), 'id=' . $parent); |
546 | 546 | |
547 | - if ($parent != $parentOld) { |
|
547 | + if ($parent != $parentOld) { |
|
548 | 548 | // check children docs and set parent isfolder |
549 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
549 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
550 | 550 | $modx->db->update(array( |
551 | 551 | 'isfolder' => 1 |
552 | 552 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
553 | - } else { |
|
553 | + } else { |
|
554 | 554 | $modx->db->update(array( |
555 | 555 | 'isfolder' => 0 |
556 | 556 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
@@ -558,16 +558,16 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | // set menuindex |
561 | - if (!empty($menuindex)) { |
|
561 | + if (!empty($menuindex)) { |
|
562 | 562 | $menuindex = explode(',', $menuindex); |
563 | - foreach ($menuindex as $key => $value) { |
|
563 | + foreach ($menuindex as $key => $value) { |
|
564 | 564 | $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value); |
565 | 565 | } |
566 | - } else { |
|
566 | + } else { |
|
567 | 567 | // TODO: max(*) menuindex |
568 | 568 | } |
569 | 569 | |
570 | - if (!$json['errors']) { |
|
570 | + if (!$json['errors']) { |
|
571 | 571 | $json['success'] = $_lang["actioncomplete"]; |
572 | 572 | |
573 | 573 | $modx->invokeEvent('onAfterMoveDocument', [ |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | } |
580 | 580 | } |
581 | 581 | } |
582 | - } else { |
|
582 | + } else { |
|
583 | 583 | $json['errors'] = $_lang["error_no_privileges"]; |
584 | 584 | } |
585 | 585 | |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | |
596 | 596 | $output = !!$modx->elementIsLocked($type, $id, true); |
597 | 597 | |
598 | - if (!$output) { |
|
598 | + if (!$output) { |
|
599 | 599 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
600 | 600 | $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : ''; |
601 | 601 | $sql = ' |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id |
605 | 605 | WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
606 | 606 | $sql = $modx->db->query($sql); |
607 | - if ($modx->db->getRecordCount($sql)) { |
|
607 | + if ($modx->db->getRecordCount($sql)) { |
|
608 | 608 | $row = $modx->db->getRow($sql); |
609 | 609 | $output = !!$row['locked']; |
610 | 610 | } |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | $style_path = 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
12 | 12 | $modx->config['mgr_date_picker_path'] = 'media/calendar/datepicker.inc.php'; |
13 | 13 | if(!$modx->config['lang_code']) { |
14 | - global $modx_lang_attribute; |
|
15 | - $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
|
14 | + global $modx_lang_attribute; |
|
15 | + $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if($_GET['a'] == 2) { |
19 | - include_once('welcome.php'); |
|
19 | + include_once('welcome.php'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // Favicon |
@@ -274,66 +274,66 @@ discard block |
||
274 | 274 | $addnew = 0; |
275 | 275 | $run = 0; |
276 | 276 | switch($action) { |
277 | - case '3': |
|
278 | - case '4': |
|
279 | - case '27': |
|
280 | - case '72': |
|
281 | - if($modx->hasPermission('new_document')) { |
|
282 | - $addnew = 1; |
|
283 | - } |
|
284 | - break; |
|
285 | - case '16': |
|
286 | - case '19': |
|
287 | - if($modx->hasPermission('new_template')) { |
|
288 | - $addnew = 1; |
|
289 | - } |
|
290 | - break; |
|
291 | - case '300': |
|
292 | - case '301': |
|
293 | - if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
294 | - $addnew = 1; |
|
295 | - } |
|
296 | - break; |
|
297 | - case '77': |
|
298 | - case '78': |
|
299 | - if($modx->hasPermission('new_chunk')) { |
|
300 | - $addnew = 1; |
|
301 | - } |
|
302 | - break; |
|
303 | - case '22': |
|
304 | - case '23': |
|
305 | - if($modx->hasPermission('new_snippet')) { |
|
306 | - $addnew = 1; |
|
307 | - } |
|
308 | - break; |
|
309 | - case '101': |
|
310 | - case '102': |
|
311 | - if($modx->hasPermission('new_plugin')) { |
|
312 | - $addnew = 1; |
|
313 | - } |
|
314 | - break; |
|
315 | - case '106': |
|
316 | - case '107': |
|
317 | - case '108': |
|
318 | - if($modx->hasPermission('new_module')) { |
|
319 | - $addnew = 1; |
|
320 | - } |
|
321 | - if($modx->hasPermission('exec_module')) { |
|
322 | - $run = 1; |
|
323 | - } |
|
324 | - break; |
|
325 | - case '88': |
|
326 | - if($modx->hasPermission('new_web_user')) { |
|
327 | - $addnew = 1; |
|
328 | - } |
|
329 | - break; |
|
277 | + case '3': |
|
278 | + case '4': |
|
279 | + case '27': |
|
280 | + case '72': |
|
281 | + if($modx->hasPermission('new_document')) { |
|
282 | + $addnew = 1; |
|
283 | + } |
|
284 | + break; |
|
285 | + case '16': |
|
286 | + case '19': |
|
287 | + if($modx->hasPermission('new_template')) { |
|
288 | + $addnew = 1; |
|
289 | + } |
|
290 | + break; |
|
291 | + case '300': |
|
292 | + case '301': |
|
293 | + if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
294 | + $addnew = 1; |
|
295 | + } |
|
296 | + break; |
|
297 | + case '77': |
|
298 | + case '78': |
|
299 | + if($modx->hasPermission('new_chunk')) { |
|
300 | + $addnew = 1; |
|
301 | + } |
|
302 | + break; |
|
303 | + case '22': |
|
304 | + case '23': |
|
305 | + if($modx->hasPermission('new_snippet')) { |
|
306 | + $addnew = 1; |
|
307 | + } |
|
308 | + break; |
|
309 | + case '101': |
|
310 | + case '102': |
|
311 | + if($modx->hasPermission('new_plugin')) { |
|
312 | + $addnew = 1; |
|
313 | + } |
|
314 | + break; |
|
315 | + case '106': |
|
316 | + case '107': |
|
317 | + case '108': |
|
318 | + if($modx->hasPermission('new_module')) { |
|
319 | + $addnew = 1; |
|
320 | + } |
|
321 | + if($modx->hasPermission('exec_module')) { |
|
322 | + $run = 1; |
|
323 | + } |
|
324 | + break; |
|
325 | + case '88': |
|
326 | + if($modx->hasPermission('new_web_user')) { |
|
327 | + $addnew = 1; |
|
328 | + } |
|
329 | + break; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | $disabled = ($action == '19' || $action == '300' || $action == '77' || $action == '23' || $action == '101' || $action == '4' || $action == '72' || $action == '87' || $action == '11' || $action == '107' || $action == '38') ? ' disabled' : ''; |
333 | 333 | |
334 | 334 | $_style['actionbuttons'] = array( |
335 | - 'dynamic' => array( |
|
336 | - 'document' => '<div id="actions"> |
|
335 | + 'dynamic' => array( |
|
336 | + 'document' => '<div id="actions"> |
|
337 | 337 | <div class="btn-group"> |
338 | 338 | <div class="btn-group"> |
339 | 339 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | <option id="stay3" value="" ' . ($stay == '' ? ' selected="selected"' : '') . '>' . $_lang['close'] . '</option> |
349 | 349 | </select> |
350 | 350 | </div>' . |
351 | - ($addnew ? ' |
|
351 | + ($addnew ? ' |
|
352 | 352 | <a id="Button6" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.duplicate();"> |
353 | 353 | <i class="' . $_style["actions_duplicate"] . '"></i><span>' . $_lang['duplicate'] . '</span> |
354 | 354 | </a> |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | </a> |
365 | 365 | </div> |
366 | 366 | </div>', |
367 | - 'user' => '<div id="actions"> |
|
367 | + 'user' => '<div id="actions"> |
|
368 | 368 | <div class="btn-group"> |
369 | 369 | <div class="btn-group"> |
370 | 370 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | </a> |
388 | 388 | </div> |
389 | 389 | </div>', |
390 | - 'element' => '<div id="actions"> |
|
390 | + 'element' => '<div id="actions"> |
|
391 | 391 | <div class="btn-group"> |
392 | 392 | <div class="btn-group"> |
393 | 393 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
@@ -420,21 +420,21 @@ discard block |
||
420 | 420 | ' : '') . ' |
421 | 421 | </div> |
422 | 422 | </div>', |
423 | - 'newmodule' => ($addnew ? '<div id="actions"> |
|
423 | + 'newmodule' => ($addnew ? '<div id="actions"> |
|
424 | 424 | <div class="btn-group"> |
425 | 425 | <a id="newModule" class="btn btn-secondary" href="javascript:;" onclick="actions.new();"> |
426 | 426 | <i class="' . $_style["actions_new"] . '"></i><span>' . $_lang['new_module'] . '</span> |
427 | 427 | </a> |
428 | 428 | </div> |
429 | 429 | </div>' : ''), |
430 | - 'close' => '<div id="actions"> |
|
430 | + 'close' => '<div id="actions"> |
|
431 | 431 | <div class="btn-group"> |
432 | 432 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.close();"> |
433 | 433 | <i class="' . $_style["actions_close"] . '"></i><span>' . $_lang['close'] . '</span> |
434 | 434 | </a> |
435 | 435 | </div> |
436 | 436 | </div>', |
437 | - 'save' => '<div id="actions"> |
|
437 | + 'save' => '<div id="actions"> |
|
438 | 438 | <div class="btn-group"> |
439 | 439 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
440 | 440 | <i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span> |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | </a> |
445 | 445 | </div> |
446 | 446 | </div>', |
447 | - 'savedelete' => '<div id="actions"> |
|
447 | + 'savedelete' => '<div id="actions"> |
|
448 | 448 | <div class="btn-group"> |
449 | 449 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
450 | 450 | <i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span> |
@@ -457,14 +457,14 @@ discard block |
||
457 | 457 | </a> |
458 | 458 | </div> |
459 | 459 | </div>', |
460 | - 'cancel' => '<div id="actions"> |
|
460 | + 'cancel' => '<div id="actions"> |
|
461 | 461 | <div class="btn-group"> |
462 | 462 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
463 | 463 | <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
464 | 464 | </a> |
465 | 465 | </div> |
466 | 466 | </div>', |
467 | - 'canceldelete' => '<div id="actions"> |
|
467 | + 'canceldelete' => '<div id="actions"> |
|
468 | 468 | <div class="btn-group"> |
469 | 469 | <a id="Button3" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.delete();"> |
470 | 470 | <i class="' . $_style["actions_delete"] . '"></i><span>' . $_lang['delete'] . '</span> |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | </a> |
475 | 475 | </div> |
476 | 476 | </div>', |
477 | - ), |
|
478 | - 'static' => array( |
|
479 | - 'document' => '<div id="actions"> |
|
477 | + ), |
|
478 | + 'static' => array( |
|
479 | + 'document' => '<div id="actions"> |
|
480 | 480 | <div class="btn-group">' . |
481 | - ($addnew ? ' |
|
481 | + ($addnew ? ' |
|
482 | 482 | <a class="btn btn-secondary" href="javascript:;" onclick="actions.new();"> |
483 | 483 | <i class="' . $_style["icons_new_document"] . '"></i><span>' . $_lang['create_resource_here'] . '</span> |
484 | 484 | </a> |
@@ -503,12 +503,12 @@ discard block |
||
503 | 503 | </a> |
504 | 504 | </div> |
505 | 505 | </div>', |
506 | - 'cancel' => '<div id="actions"> |
|
506 | + 'cancel' => '<div id="actions"> |
|
507 | 507 | <div class="btn-group"> |
508 | 508 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
509 | 509 | <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
510 | 510 | </a> |
511 | 511 | </div> |
512 | 512 | </div>', |
513 | - ) |
|
513 | + ) |
|
514 | 514 | ); |
@@ -8,19 +8,19 @@ discard block |
||
8 | 8 | * Version: 1.1 |
9 | 9 | * MODX version: 1.0.3 |
10 | 10 | */ |
11 | -$style_path = 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
|
11 | +$style_path = 'media/style/'.$modx->config['manager_theme'].'/images/'; |
|
12 | 12 | $modx->config['mgr_date_picker_path'] = 'media/calendar/datepicker.inc.php'; |
13 | -if(!$modx->config['lang_code']) { |
|
13 | +if (!$modx->config['lang_code']) { |
|
14 | 14 | global $modx_lang_attribute; |
15 | 15 | $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
16 | 16 | } |
17 | 17 | |
18 | -if($_GET['a'] == 2) { |
|
18 | +if ($_GET['a'] == 2) { |
|
19 | 19 | include_once('welcome.php'); |
20 | 20 | } |
21 | 21 | |
22 | 22 | // Favicon |
23 | -$_style['favicon'] = (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico'); |
|
23 | +$_style['favicon'] = (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico'); |
|
24 | 24 | |
25 | 25 | //Main Menu |
26 | 26 | $_style['menu_search'] = '<i class="fa fa-search"></i>'; |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | $_style['tree_page_word'] = "<i class='fa fa-file-word-o'></i>"; |
100 | 100 | $_style['tree_page_excel'] = "<i class='fa fa-file-excel-o'></i>"; |
101 | 101 | |
102 | -$_style['tree_minusnode'] = "<i class='fa fa-angle-down'></i>";//$style_path.'tree/angle-down.png'; |
|
103 | -$_style['tree_plusnode'] = "<i class='fa fa-angle-right'></i>";//$style_path.'tree/angle-right.png'; |
|
102 | +$_style['tree_minusnode'] = "<i class='fa fa-angle-down'></i>"; //$style_path.'tree/angle-down.png'; |
|
103 | +$_style['tree_plusnode'] = "<i class='fa fa-angle-right'></i>"; //$style_path.'tree/angle-right.png'; |
|
104 | 104 | $_style['tree_weblink'] = $style_path.'tree/link.png'; |
105 | -$_style['tree_preview_resource'] = "<i class='fa fa-eye'></i>";//$style_path.'icons/eye.png'; |
|
105 | +$_style['tree_preview_resource'] = "<i class='fa fa-eye'></i>"; //$style_path.'icons/eye.png'; |
|
106 | 106 | |
107 | 107 | $_style['tree_showtree'] = '<i class="fa fa-sitemap"></i>'; |
108 | 108 | $_style['tree_working'] = '<i class="fa fa-warning"></i>'; |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | $_style['icons_edit_document'] = $style_path.'icons/save.png'; |
138 | 138 | $_style['icons_delete_document'] = $style_path.'icons/trash.png'; |
139 | 139 | //locks |
140 | -$_style['icons_preview_resource'] = $style_path.'icons/eye.png';//$style_path.'icons/eye.png'; |
|
141 | -$_style['icons_secured'] = "<i class='fa fa-lock'></i>";//$style_path.'icons/lock.png'; |
|
140 | +$_style['icons_preview_resource'] = $style_path.'icons/eye.png'; //$style_path.'icons/eye.png'; |
|
141 | +$_style['icons_secured'] = "<i class='fa fa-lock'></i>"; //$style_path.'icons/lock.png'; |
|
142 | 142 | |
143 | 143 | //file manager icons |
144 | 144 | $_style['files_save'] = 'fa fa-floppy-o'; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $_style['icons_set_parent'] = $style_path.'icons/folder-open.png'; |
214 | 214 | |
215 | 215 | //modules |
216 | -$_style['icons_module'] = 'fa fa-cube'; |
|
216 | +$_style['icons_module'] = 'fa fa-cube'; |
|
217 | 217 | $_style['icons_modules'] = 'fa fa-cubes'; //$style_path.'icons/modules.png'; |
218 | 218 | $_style['icons_run'] = $style_path.'icons/play.png'; |
219 | 219 | |
@@ -273,57 +273,57 @@ discard block |
||
273 | 273 | $stay = isset($_REQUEST['stay']) ? $_REQUEST['stay'] : ''; |
274 | 274 | $addnew = 0; |
275 | 275 | $run = 0; |
276 | -switch($action) { |
|
276 | +switch ($action) { |
|
277 | 277 | case '3': |
278 | 278 | case '4': |
279 | 279 | case '27': |
280 | 280 | case '72': |
281 | - if($modx->hasPermission('new_document')) { |
|
281 | + if ($modx->hasPermission('new_document')) { |
|
282 | 282 | $addnew = 1; |
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case '16': |
286 | 286 | case '19': |
287 | - if($modx->hasPermission('new_template')) { |
|
287 | + if ($modx->hasPermission('new_template')) { |
|
288 | 288 | $addnew = 1; |
289 | 289 | } |
290 | 290 | break; |
291 | 291 | case '300': |
292 | 292 | case '301': |
293 | - if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
293 | + if ($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
294 | 294 | $addnew = 1; |
295 | 295 | } |
296 | 296 | break; |
297 | 297 | case '77': |
298 | 298 | case '78': |
299 | - if($modx->hasPermission('new_chunk')) { |
|
299 | + if ($modx->hasPermission('new_chunk')) { |
|
300 | 300 | $addnew = 1; |
301 | 301 | } |
302 | 302 | break; |
303 | 303 | case '22': |
304 | 304 | case '23': |
305 | - if($modx->hasPermission('new_snippet')) { |
|
305 | + if ($modx->hasPermission('new_snippet')) { |
|
306 | 306 | $addnew = 1; |
307 | 307 | } |
308 | 308 | break; |
309 | 309 | case '101': |
310 | 310 | case '102': |
311 | - if($modx->hasPermission('new_plugin')) { |
|
311 | + if ($modx->hasPermission('new_plugin')) { |
|
312 | 312 | $addnew = 1; |
313 | 313 | } |
314 | 314 | break; |
315 | 315 | case '106': |
316 | 316 | case '107': |
317 | 317 | case '108': |
318 | - if($modx->hasPermission('new_module')) { |
|
318 | + if ($modx->hasPermission('new_module')) { |
|
319 | 319 | $addnew = 1; |
320 | 320 | } |
321 | - if($modx->hasPermission('exec_module')) { |
|
321 | + if ($modx->hasPermission('exec_module')) { |
|
322 | 322 | $run = 1; |
323 | 323 | } |
324 | 324 | break; |
325 | 325 | case '88': |
326 | - if($modx->hasPermission('new_web_user')) { |
|
326 | + if ($modx->hasPermission('new_web_user')) { |
|
327 | 327 | $addnew = 1; |
328 | 328 | } |
329 | 329 | break; |
@@ -337,30 +337,30 @@ discard block |
||
337 | 337 | <div class="btn-group"> |
338 | 338 | <div class="btn-group"> |
339 | 339 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
340 | - <i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span> |
|
340 | + <i class="' . $_style["actions_save"].'"></i><span>'.$_lang['save'].'</span> |
|
341 | 341 | </a> |
342 | 342 | <span class="btn btn-success plus dropdown-toggle"></span> |
343 | 343 | <select id="stay" name="stay"> |
344 | 344 | ' . ($addnew ? ' |
345 | - <option id="stay1" value="1" ' . ($stay == '1' ? ' selected="selected"' : '') . '>' . $_lang['stay_new'] . '</option> |
|
346 | - ' : '') . ' |
|
347 | - <option id="stay2" value="2" ' . ($stay == '2' ? ' selected="selected"' : '') . '>' . $_lang['stay'] . '</option> |
|
348 | - <option id="stay3" value="" ' . ($stay == '' ? ' selected="selected"' : '') . '>' . $_lang['close'] . '</option> |
|
345 | + <option id="stay1" value="1" ' . ($stay == '1' ? ' selected="selected"' : '').'>'.$_lang['stay_new'].'</option> |
|
346 | + ' : '').' |
|
347 | + <option id="stay2" value="2" ' . ($stay == '2' ? ' selected="selected"' : '').'>'.$_lang['stay'].'</option> |
|
348 | + <option id="stay3" value="" ' . ($stay == '' ? ' selected="selected"' : '').'>'.$_lang['close'].'</option> |
|
349 | 349 | </select> |
350 | 350 | </div>' . |
351 | 351 | ($addnew ? ' |
352 | - <a id="Button6" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.duplicate();"> |
|
353 | - <i class="' . $_style["actions_duplicate"] . '"></i><span>' . $_lang['duplicate'] . '</span> |
|
352 | + <a id="Button6" class="btn btn-secondary' . $disabled.'" href="javascript:;" onclick="actions.duplicate();"> |
|
353 | + <i class="' . $_style["actions_duplicate"].'"></i><span>'.$_lang['duplicate'].'</span> |
|
354 | 354 | </a> |
355 | - ' : '') . ' |
|
356 | - <a id="Button3" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.delete();"> |
|
357 | - <i class="' . $_style["actions_delete"] . '"></i><span>' . $_lang['delete'] . '</span> |
|
355 | + ' : '').' |
|
356 | + <a id="Button3" class="btn btn-secondary' . $disabled.'" href="javascript:;" onclick="actions.delete();"> |
|
357 | + <i class="' . $_style["actions_delete"].'"></i><span>'.$_lang['delete'].'</span> |
|
358 | 358 | </a> |
359 | 359 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
360 | - <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
|
360 | + <i class="' . $_style["actions_cancel"].'"></i><span>'.$_lang['cancel'].'</span> |
|
361 | 361 | </a> |
362 | 362 | <a id="Button4" class="btn btn-secondary" href="javascript:;" onclick="actions.view();"> |
363 | - <i class="' . $_style["actions_preview"] . '"></i><span>' . $_lang['preview'] . '</span> |
|
363 | + <i class="' . $_style["actions_preview"].'"></i><span>'.$_lang['preview'].'</span> |
|
364 | 364 | </a> |
365 | 365 | </div> |
366 | 366 | </div>', |
@@ -368,22 +368,22 @@ discard block |
||
368 | 368 | <div class="btn-group"> |
369 | 369 | <div class="btn-group"> |
370 | 370 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
371 | - <i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span> |
|
371 | + <i class="' . $_style["actions_save"].'"></i><span>'.$_lang['save'].'</span> |
|
372 | 372 | </a> |
373 | 373 | <span class="btn btn-success plus dropdown-toggle"></span> |
374 | 374 | <select id="stay" name="stay"> |
375 | 375 | ' . ($addnew ? ' |
376 | - <option id="stay1" value="1" ' . ($stay == '1' ? ' selected="selected"' : '') . '>' . $_lang['stay_new'] . '</option> |
|
377 | - ' : '') . ' |
|
378 | - <option id="stay2" value="2" ' . ($stay == '2' ? ' selected="selected"' : '') . '>' . $_lang['stay'] . '</option> |
|
379 | - <option id="stay3" value="" ' . ($stay == '' ? ' selected="selected"' : '') . '>' . $_lang['close'] . '</option> |
|
376 | + <option id="stay1" value="1" ' . ($stay == '1' ? ' selected="selected"' : '').'>'.$_lang['stay_new'].'</option> |
|
377 | + ' : '').' |
|
378 | + <option id="stay2" value="2" ' . ($stay == '2' ? ' selected="selected"' : '').'>'.$_lang['stay'].'</option> |
|
379 | + <option id="stay3" value="" ' . ($stay == '' ? ' selected="selected"' : '').'>'.$_lang['close'].'</option> |
|
380 | 380 | </select> |
381 | 381 | </div> |
382 | - <a id="Button3" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.delete();"> |
|
383 | - <i class="' . $_style["actions_delete"] . '"></i><span>' . $_lang['delete'] . '</span> |
|
382 | + <a id="Button3" class="btn btn-secondary' . $disabled.'" href="javascript:;" onclick="actions.delete();"> |
|
383 | + <i class="' . $_style["actions_delete"].'"></i><span>'.$_lang['delete'].'</span> |
|
384 | 384 | </a> |
385 | 385 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
386 | - <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
|
386 | + <i class="' . $_style["actions_cancel"].'"></i><span>'.$_lang['cancel'].'</span> |
|
387 | 387 | </a> |
388 | 388 | </div> |
389 | 389 | </div>', |
@@ -391,86 +391,86 @@ discard block |
||
391 | 391 | <div class="btn-group"> |
392 | 392 | <div class="btn-group"> |
393 | 393 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
394 | - <i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span> |
|
394 | + <i class="' . $_style["actions_save"].'"></i><span>'.$_lang['save'].'</span> |
|
395 | 395 | </a> |
396 | 396 | <span class="btn btn-success plus dropdown-toggle"></span> |
397 | 397 | <select id="stay" name="stay"> |
398 | 398 | ' . ($addnew ? ' |
399 | - <option id="stay1" value="1" ' . ($stay == '1' ? ' selected="selected"' : '') . '>' . $_lang['stay_new'] . '</option> |
|
400 | - ' : '') . ' |
|
401 | - <option id="stay2" value="2" ' . ($stay == '2' ? ' selected="selected"' : '') . '>' . $_lang['stay'] . '</option> |
|
402 | - <option id="stay3" value="" ' . ($stay == '' ? ' selected="selected"' : '') . '>' . $_lang['close'] . '</option> |
|
399 | + <option id="stay1" value="1" ' . ($stay == '1' ? ' selected="selected"' : '').'>'.$_lang['stay_new'].'</option> |
|
400 | + ' : '').' |
|
401 | + <option id="stay2" value="2" ' . ($stay == '2' ? ' selected="selected"' : '').'>'.$_lang['stay'].'</option> |
|
402 | + <option id="stay3" value="" ' . ($stay == '' ? ' selected="selected"' : '').'>'.$_lang['close'].'</option> |
|
403 | 403 | </select> |
404 | 404 | </div> |
405 | 405 | ' . ($addnew ? ' |
406 | - <a id="Button6" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.duplicate();"> |
|
407 | - <i class="' . $_style["actions_duplicate"] . '"></i><span>' . $_lang['duplicate'] . '</span> |
|
406 | + <a id="Button6" class="btn btn-secondary' . $disabled.'" href="javascript:;" onclick="actions.duplicate();"> |
|
407 | + <i class="' . $_style["actions_duplicate"].'"></i><span>'.$_lang['duplicate'].'</span> |
|
408 | 408 | </a> |
409 | - ' : '') . ' |
|
410 | - <a id="Button3" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.delete();"> |
|
411 | - <i class="' . $_style["actions_delete"] . '"></i><span>' . $_lang['delete'] . '</span> |
|
409 | + ' : '').' |
|
410 | + <a id="Button3" class="btn btn-secondary' . $disabled.'" href="javascript:;" onclick="actions.delete();"> |
|
411 | + <i class="' . $_style["actions_delete"].'"></i><span>'.$_lang['delete'].'</span> |
|
412 | 412 | </a> |
413 | 413 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
414 | - <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
|
414 | + <i class="' . $_style["actions_cancel"].'"></i><span>'.$_lang['cancel'].'</span> |
|
415 | 415 | </a> |
416 | 416 | ' . ($run ? ' |
417 | - <a id="Button4" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.run();"> |
|
418 | - <i class="' . $_style["actions_run"] . '"></i><span>' . $_lang['run_module'] . '</span> |
|
417 | + <a id="Button4" class="btn btn-secondary' . $disabled.'" href="javascript:;" onclick="actions.run();"> |
|
418 | + <i class="' . $_style["actions_run"].'"></i><span>'.$_lang['run_module'].'</span> |
|
419 | 419 | </a> |
420 | - ' : '') . ' |
|
420 | + ' : '').' |
|
421 | 421 | </div> |
422 | 422 | </div>', |
423 | 423 | 'newmodule' => ($addnew ? '<div id="actions"> |
424 | 424 | <div class="btn-group"> |
425 | 425 | <a id="newModule" class="btn btn-secondary" href="javascript:;" onclick="actions.new();"> |
426 | - <i class="' . $_style["actions_new"] . '"></i><span>' . $_lang['new_module'] . '</span> |
|
426 | + <i class="' . $_style["actions_new"].'"></i><span>'.$_lang['new_module'].'</span> |
|
427 | 427 | </a> |
428 | 428 | </div> |
429 | 429 | </div>' : ''), |
430 | 430 | 'close' => '<div id="actions"> |
431 | 431 | <div class="btn-group"> |
432 | 432 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.close();"> |
433 | - <i class="' . $_style["actions_close"] . '"></i><span>' . $_lang['close'] . '</span> |
|
433 | + <i class="' . $_style["actions_close"].'"></i><span>'.$_lang['close'].'</span> |
|
434 | 434 | </a> |
435 | 435 | </div> |
436 | 436 | </div>', |
437 | 437 | 'save' => '<div id="actions"> |
438 | 438 | <div class="btn-group"> |
439 | 439 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
440 | - <i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span> |
|
440 | + <i class="' . $_style["actions_save"].'"></i><span>'.$_lang['save'].'</span> |
|
441 | 441 | </a> |
442 | 442 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
443 | - <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
|
443 | + <i class="' . $_style["actions_cancel"].'"></i><span>'.$_lang['cancel'].'</span> |
|
444 | 444 | </a> |
445 | 445 | </div> |
446 | 446 | </div>', |
447 | 447 | 'savedelete' => '<div id="actions"> |
448 | 448 | <div class="btn-group"> |
449 | 449 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.save();"> |
450 | - <i class="' . $_style["actions_save"] . '"></i><span>' . $_lang['save'] . '</span> |
|
450 | + <i class="' . $_style["actions_save"].'"></i><span>'.$_lang['save'].'</span> |
|
451 | 451 | </a> |
452 | - <a id="Button3" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.delete();"> |
|
453 | - <i class="' . $_style["actions_delete"] . '"></i><span>' . $_lang['delete'] . '</span> |
|
452 | + <a id="Button3" class="btn btn-secondary' . $disabled.'" href="javascript:;" onclick="actions.delete();"> |
|
453 | + <i class="' . $_style["actions_delete"].'"></i><span>'.$_lang['delete'].'</span> |
|
454 | 454 | </a> |
455 | 455 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
456 | - <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
|
456 | + <i class="' . $_style["actions_cancel"].'"></i><span>'.$_lang['cancel'].'</span> |
|
457 | 457 | </a> |
458 | 458 | </div> |
459 | 459 | </div>', |
460 | 460 | 'cancel' => '<div id="actions"> |
461 | 461 | <div class="btn-group"> |
462 | 462 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
463 | - <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
|
463 | + <i class="' . $_style["actions_cancel"].'"></i><span>'.$_lang['cancel'].'</span> |
|
464 | 464 | </a> |
465 | 465 | </div> |
466 | 466 | </div>', |
467 | 467 | 'canceldelete' => '<div id="actions"> |
468 | 468 | <div class="btn-group"> |
469 | - <a id="Button3" class="btn btn-secondary' . $disabled . '" href="javascript:;" onclick="actions.delete();"> |
|
470 | - <i class="' . $_style["actions_delete"] . '"></i><span>' . $_lang['delete'] . '</span> |
|
469 | + <a id="Button3" class="btn btn-secondary' . $disabled.'" href="javascript:;" onclick="actions.delete();"> |
|
470 | + <i class="' . $_style["actions_delete"].'"></i><span>'.$_lang['delete'].'</span> |
|
471 | 471 | </a> |
472 | 472 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
473 | - <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
|
473 | + <i class="' . $_style["actions_cancel"].'"></i><span>'.$_lang['cancel'].'</span> |
|
474 | 474 | </a> |
475 | 475 | </div> |
476 | 476 | </div>', |
@@ -480,33 +480,33 @@ discard block |
||
480 | 480 | <div class="btn-group">' . |
481 | 481 | ($addnew ? ' |
482 | 482 | <a class="btn btn-secondary" href="javascript:;" onclick="actions.new();"> |
483 | - <i class="' . $_style["icons_new_document"] . '"></i><span>' . $_lang['create_resource_here'] . '</span> |
|
483 | + <i class="' . $_style["icons_new_document"].'"></i><span>'.$_lang['create_resource_here'].'</span> |
|
484 | 484 | </a> |
485 | 485 | <a class="btn btn-secondary" href="javascript:;" onclick="actions.newlink();"> |
486 | - <i class="' . $_style["icons_new_weblink"] . '"></i><span>' . $_lang['create_weblink_here'] . '</span> |
|
486 | + <i class="' . $_style["icons_new_weblink"].'"></i><span>'.$_lang['create_weblink_here'].'</span> |
|
487 | 487 | </a> |
488 | - ' : '') . ' |
|
488 | + ' : '').' |
|
489 | 489 | <a id="Button1" class="btn btn-success" href="javascript:;" onclick="actions.edit();"> |
490 | - <i class="' . $_style["actions_edit"] . '"></i><span>' . $_lang['edit'] . '</span> |
|
490 | + <i class="' . $_style["actions_edit"].'"></i><span>'.$_lang['edit'].'</span> |
|
491 | 491 | </a> |
492 | 492 | <a id="Button2" class="btn btn-secondary" href="javascript:;" onclick="actions.move();"> |
493 | - <i class="' . $_style["actions_move"] . '"></i><span>' . $_lang['move'] . '</span> |
|
493 | + <i class="' . $_style["actions_move"].'"></i><span>'.$_lang['move'].'</span> |
|
494 | 494 | </a> |
495 | 495 | <a id="Button6" class="btn btn-secondary" href="javascript:;" onclick="actions.duplicate();"> |
496 | - <i class="' . $_style["actions_duplicate"] . '"></i><span>' . $_lang['duplicate'] . '</span> |
|
496 | + <i class="' . $_style["actions_duplicate"].'"></i><span>'.$_lang['duplicate'].'</span> |
|
497 | 497 | </a> |
498 | 498 | <a id="Button3" class="btn btn-secondary" href="javascript:;" onclick="actions.delete();"> |
499 | - <i class="' . $_style["actions_delete"] . '"></i><span>' . $_lang['delete'] . '</span> |
|
499 | + <i class="' . $_style["actions_delete"].'"></i><span>'.$_lang['delete'].'</span> |
|
500 | 500 | </a> |
501 | 501 | <a id="Button4" class="btn btn-secondary" href="javascript:;" onclick="actions.view();"> |
502 | - <i class="' . $_style["actions_preview"] . '"></i><span>' . $_lang['preview'] . '</span> |
|
502 | + <i class="' . $_style["actions_preview"].'"></i><span>'.$_lang['preview'].'</span> |
|
503 | 503 | </a> |
504 | 504 | </div> |
505 | 505 | </div>', |
506 | 506 | 'cancel' => '<div id="actions"> |
507 | 507 | <div class="btn-group"> |
508 | 508 | <a id="Button5" class="btn btn-secondary" href="javascript:;" onclick="actions.cancel();"> |
509 | - <i class="' . $_style["actions_cancel"] . '"></i><span>' . $_lang['cancel'] . '</span> |
|
509 | + <i class="' . $_style["actions_cancel"].'"></i><span>'.$_lang['cancel'].'</span> |
|
510 | 510 | </a> |
511 | 511 | </div> |
512 | 512 | </div>', |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | */ |
11 | 11 | $style_path = 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
12 | 12 | $modx->config['mgr_date_picker_path'] = 'media/calendar/datepicker.inc.php'; |
13 | -if(!$modx->config['lang_code']) { |
|
13 | +if(!$modx->config['lang_code']) { |
|
14 | 14 | global $modx_lang_attribute; |
15 | 15 | $modx->config['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
16 | 16 | } |
17 | 17 | |
18 | -if($_GET['a'] == 2) { |
|
18 | +if($_GET['a'] == 2) { |
|
19 | 19 | include_once('welcome.php'); |
20 | 20 | } |
21 | 21 | |
@@ -262,68 +262,68 @@ discard block |
||
262 | 262 | |
263 | 263 | // actions buttons templates |
264 | 264 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
265 | -if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) { |
|
265 | +if (!empty($modx->config['global_tabs']) && !isset($_SESSION['stay'])) { |
|
266 | 266 | $_REQUEST['stay'] = 2; |
267 | 267 | } |
268 | -if (isset($_REQUEST['stay'])) { |
|
268 | +if (isset($_REQUEST['stay'])) { |
|
269 | 269 | $_SESSION['stay'] = $_REQUEST['stay']; |
270 | -} else if (isset($_SESSION['stay'])) { |
|
270 | +} else if (isset($_SESSION['stay'])) { |
|
271 | 271 | $_REQUEST['stay'] = $_SESSION['stay']; |
272 | 272 | } |
273 | 273 | $stay = isset($_REQUEST['stay']) ? $_REQUEST['stay'] : ''; |
274 | 274 | $addnew = 0; |
275 | 275 | $run = 0; |
276 | -switch($action) { |
|
276 | +switch($action) { |
|
277 | 277 | case '3': |
278 | 278 | case '4': |
279 | 279 | case '27': |
280 | 280 | case '72': |
281 | - if($modx->hasPermission('new_document')) { |
|
281 | + if($modx->hasPermission('new_document')) { |
|
282 | 282 | $addnew = 1; |
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case '16': |
286 | 286 | case '19': |
287 | - if($modx->hasPermission('new_template')) { |
|
287 | + if($modx->hasPermission('new_template')) { |
|
288 | 288 | $addnew = 1; |
289 | 289 | } |
290 | 290 | break; |
291 | 291 | case '300': |
292 | 292 | case '301': |
293 | - if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
293 | + if($modx->hasPermission('new_snippet') && $modx->hasPermission('new_chunk') && $modx->hasPermission('new_plugin')) { |
|
294 | 294 | $addnew = 1; |
295 | 295 | } |
296 | 296 | break; |
297 | 297 | case '77': |
298 | 298 | case '78': |
299 | - if($modx->hasPermission('new_chunk')) { |
|
299 | + if($modx->hasPermission('new_chunk')) { |
|
300 | 300 | $addnew = 1; |
301 | 301 | } |
302 | 302 | break; |
303 | 303 | case '22': |
304 | 304 | case '23': |
305 | - if($modx->hasPermission('new_snippet')) { |
|
305 | + if($modx->hasPermission('new_snippet')) { |
|
306 | 306 | $addnew = 1; |
307 | 307 | } |
308 | 308 | break; |
309 | 309 | case '101': |
310 | 310 | case '102': |
311 | - if($modx->hasPermission('new_plugin')) { |
|
311 | + if($modx->hasPermission('new_plugin')) { |
|
312 | 312 | $addnew = 1; |
313 | 313 | } |
314 | 314 | break; |
315 | 315 | case '106': |
316 | 316 | case '107': |
317 | 317 | case '108': |
318 | - if($modx->hasPermission('new_module')) { |
|
318 | + if($modx->hasPermission('new_module')) { |
|
319 | 319 | $addnew = 1; |
320 | 320 | } |
321 | - if($modx->hasPermission('exec_module')) { |
|
321 | + if($modx->hasPermission('exec_module')) { |
|
322 | 322 | $run = 1; |
323 | 323 | } |
324 | 324 | break; |
325 | 325 | case '88': |
326 | - if($modx->hasPermission('new_web_user')) { |
|
326 | + if($modx->hasPermission('new_web_user')) { |
|
327 | 327 | $addnew = 1; |
328 | 328 | } |
329 | 329 | break; |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER{ |
|
3 | + function __construct(){ |
|
4 | 4 | } |
5 | - function getDP() { |
|
6 | - global $modx,$_lang; |
|
5 | + function getDP(){ |
|
6 | + global $modx, $_lang; |
|
7 | 7 | |
8 | 8 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
9 | - return $modx->parseText($tpl,$_lang,'[%','%]'); |
|
9 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
10 | 10 | } |
11 | 11 | } |
@@ -1,8 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
4 | + function __construct() |
|
5 | + { |
|
4 | 6 | } |
5 | - function getDP() { |
|
7 | + function getDP() |
|
8 | + { |
|
6 | 9 | global $modx,$_lang; |
7 | 10 | |
8 | 11 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | NOTE: http://www.w3.org/TR/NOTE-datetime |
23 | 23 | \*======================================================================*/ |
24 | 24 | |
25 | -function parse_w3cdtf ( $date_str ) { |
|
25 | +function parse_w3cdtf ( $date_str ) |
|
26 | +{ |
|
26 | 27 | |
27 | 28 | # regex to match wc3dtf |
28 | 29 | $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; |
@@ -37,8 +38,7 @@ discard block |
||
37 | 38 | $offset = 0; |
38 | 39 | if ( $match[10] == 'Z' ) { |
39 | 40 | # zulu time, aka GMT |
40 | - } |
|
41 | - else { |
|
41 | + } else { |
|
42 | 42 | list( $tz_mod, $tz_hour, $tz_min ) = |
43 | 43 | array( $match[8], $match[9], $match[10]); |
44 | 44 | |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | $epoch = $epoch + $offset; |
60 | 60 | return $epoch; |
61 | - } |
|
62 | - else { |
|
61 | + } else { |
|
63 | 62 | return -1; |
64 | 63 | } |
65 | 64 | } |
@@ -22,35 +22,35 @@ |
||
22 | 22 | NOTE: http://www.w3.org/TR/NOTE-datetime |
23 | 23 | \*======================================================================*/ |
24 | 24 | |
25 | -function parse_w3cdtf ( $date_str ) { |
|
25 | +function parse_w3cdtf($date_str){ |
|
26 | 26 | |
27 | 27 | # regex to match wc3dtf |
28 | 28 | $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; |
29 | 29 | |
30 | - if ( preg_match( $pat, $date_str, $match ) ) { |
|
31 | - list( $year, $month, $day, $hours, $minutes, $seconds) = |
|
32 | - array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); |
|
30 | + if (preg_match($pat, $date_str, $match)) { |
|
31 | + list($year, $month, $day, $hours, $minutes, $seconds) = |
|
32 | + array($match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); |
|
33 | 33 | |
34 | 34 | # calc epoch for current date assuming GMT |
35 | - $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); |
|
35 | + $epoch = gmmktime($hours, $minutes, $seconds, $month, $day, $year); |
|
36 | 36 | |
37 | 37 | $offset = 0; |
38 | - if ( $match[10] == 'Z' ) { |
|
38 | + if ($match[10] == 'Z') { |
|
39 | 39 | # zulu time, aka GMT |
40 | 40 | } |
41 | 41 | else { |
42 | - list( $tz_mod, $tz_hour, $tz_min ) = |
|
43 | - array( $match[8], $match[9], $match[10]); |
|
42 | + list($tz_mod, $tz_hour, $tz_min) = |
|
43 | + array($match[8], $match[9], $match[10]); |
|
44 | 44 | |
45 | 45 | # zero out the variables |
46 | - if ( ! $tz_hour ) { $tz_hour = 0; } |
|
47 | - if ( ! $tz_min ) { $tz_min = 0; } |
|
46 | + if (!$tz_hour) { $tz_hour = 0; } |
|
47 | + if (!$tz_min) { $tz_min = 0; } |
|
48 | 48 | |
49 | - $offset_secs = (($tz_hour*60)+$tz_min)*60; |
|
49 | + $offset_secs = (($tz_hour * 60) + $tz_min) * 60; |
|
50 | 50 | |
51 | 51 | # is timezone ahead of GMT? then subtract offset |
52 | 52 | # |
53 | - if ( $tz_mod == '+' ) { |
|
53 | + if ($tz_mod == '+') { |
|
54 | 54 | $offset_secs = $offset_secs * -1; |
55 | 55 | } |
56 | 56 |
@@ -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; |