@@ -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 | ); |
@@ -166,7 +166,7 @@ |
||
166 | 166 | $resp = _fetch_remote_file( $url, $request_headers ); |
167 | 167 | |
168 | 168 | if (isset($resp) and $resp) { |
169 | - if ($resp->status == '304' ) { |
|
169 | + if ($resp->status == '304' ) { |
|
170 | 170 | // we have the most current copy |
171 | 171 | if ( MAGPIE_DEBUG > 1) { |
172 | 172 | debug("Got 304 for $url"); |
@@ -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 | } |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | $useTable = $modx->getFullTableName('categories'); |
20 | 20 | $newCat = $modx->db->escape($newCat); |
21 | 21 | $cats = $modx->db->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'"); |
22 | - if($cat = $modx->db->getValue($cats)) { |
|
23 | - return $cat; |
|
24 | - } |
|
22 | + if($cat = $modx->db->getValue($cats)) { |
|
23 | + return $cat; |
|
24 | + } |
|
25 | 25 | return 0; |
26 | 26 | } |
27 | 27 | //Check for category, create new if not exists |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | global $modx; |
36 | 36 | $useTable = $modx->getFullTableName('categories'); |
37 | 37 | $cats = $modx->db->select('id, category', $modx->getFullTableName('categories'), '', 'category'); |
38 | - $resourceArray = array(); |
|
38 | + $resourceArray = array(); |
|
39 | 39 | while($row = $modx->db->getRow($cats)) { |
40 | 40 | $row['category'] = stripslashes($row['category']); |
41 | 41 | $resourceArray[] = $row; |
@@ -5,72 +5,72 @@ discard block |
||
5 | 5 | var $errorcode; |
6 | 6 | var $errors = array(); |
7 | 7 | |
8 | - function __construct() { |
|
8 | + function __construct() { |
|
9 | 9 | |
10 | - $_lang = $this->include_lang('errormsg'); |
|
10 | + $_lang = $this->include_lang('errormsg'); |
|
11 | 11 | |
12 | - $this->errors = array( |
|
13 | - 0 => $_lang["No errors occured."], |
|
14 | - 1 => $_lang["An error occured!"], |
|
15 | - 2 => $_lang["Document's ID not passed in request!"], |
|
16 | - 3 => $_lang["You don't have enough privileges for this action!"], |
|
17 | - 4 => $_lang["ID passed in request is NaN!"], |
|
18 | - 5 => $_lang["The document is locked!"], |
|
19 | - 6 => $_lang["Too many results returned from database!"], |
|
20 | - 7 => $_lang["Not enough/ no results returned from database!"], |
|
21 | - 8 => $_lang["Couldn't find parent document's name!"], |
|
22 | - 9 => $_lang["Logging error!"], |
|
23 | - 10 => $_lang["Table to optimise not found in request!"], |
|
24 | - 11 => $_lang["No settings found in request!"], |
|
25 | - 12 => $_lang["The document must have a title!"], |
|
26 | - 13 => $_lang["No user selected as recipient of this message!"], |
|
27 | - 14 => $_lang["No group selected as recipient of this message!"], |
|
28 | - 15 => $_lang["The document was not found!"], |
|
12 | + $this->errors = array( |
|
13 | + 0 => $_lang["No errors occured."], |
|
14 | + 1 => $_lang["An error occured!"], |
|
15 | + 2 => $_lang["Document's ID not passed in request!"], |
|
16 | + 3 => $_lang["You don't have enough privileges for this action!"], |
|
17 | + 4 => $_lang["ID passed in request is NaN!"], |
|
18 | + 5 => $_lang["The document is locked!"], |
|
19 | + 6 => $_lang["Too many results returned from database!"], |
|
20 | + 7 => $_lang["Not enough/ no results returned from database!"], |
|
21 | + 8 => $_lang["Couldn't find parent document's name!"], |
|
22 | + 9 => $_lang["Logging error!"], |
|
23 | + 10 => $_lang["Table to optimise not found in request!"], |
|
24 | + 11 => $_lang["No settings found in request!"], |
|
25 | + 12 => $_lang["The document must have a title!"], |
|
26 | + 13 => $_lang["No user selected as recipient of this message!"], |
|
27 | + 14 => $_lang["No group selected as recipient of this message!"], |
|
28 | + 15 => $_lang["The document was not found!"], |
|
29 | 29 | |
30 | - 100 => $_lang["Double action (GET & POST) posted!"], |
|
31 | - 600 => $_lang["Document cannot be it's own parent!"], |
|
32 | - 601 => $_lang["Document's ID not passed in request!"], |
|
33 | - 602 => $_lang["New parent not set in request!"], |
|
34 | - 900 => $_lang["don't know the user!"], // don't know the user! |
|
35 | - 901 => $_lang["wrong password!"], // wrong password! |
|
36 | - 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
37 | - 903 => $_lang["You are blocked and cannot log in!"], |
|
38 | - 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
39 | - 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
40 | - ); |
|
41 | - } |
|
30 | + 100 => $_lang["Double action (GET & POST) posted!"], |
|
31 | + 600 => $_lang["Document cannot be it's own parent!"], |
|
32 | + 601 => $_lang["Document's ID not passed in request!"], |
|
33 | + 602 => $_lang["New parent not set in request!"], |
|
34 | + 900 => $_lang["don't know the user!"], // don't know the user! |
|
35 | + 901 => $_lang["wrong password!"], // wrong password! |
|
36 | + 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
37 | + 903 => $_lang["You are blocked and cannot log in!"], |
|
38 | + 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
39 | + 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | - function include_lang($context='common') { |
|
44 | - global $modx; |
|
45 | - $_lang = array(); |
|
43 | + function include_lang($context='common') { |
|
44 | + global $modx; |
|
45 | + $_lang = array(); |
|
46 | 46 | |
47 | - $context = trim($context,'/'); |
|
48 | - if(strpos($context,'..')!==false) return; |
|
47 | + $context = trim($context,'/'); |
|
48 | + if(strpos($context,'..')!==false) return; |
|
49 | 49 | |
50 | - if($context === 'common') |
|
51 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | - else |
|
53 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | - include_once($lang_path . 'english.inc.php'); |
|
55 | - $manager_language = $modx->config['manager_language']; |
|
56 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
58 | - return $_lang; |
|
59 | - } |
|
50 | + if($context === 'common') |
|
51 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
52 | + else |
|
53 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
54 | + include_once($lang_path . 'english.inc.php'); |
|
55 | + $manager_language = $modx->config['manager_language']; |
|
56 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
57 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
58 | + return $_lang; |
|
59 | + } |
|
60 | 60 | |
61 | - function setError($errorcode, $custommessage=""){ |
|
62 | - $this->errorcode=$errorcode; |
|
63 | - $this->errormessage=$this->errors[$errorcode]; |
|
64 | - if($custommessage!="") { |
|
65 | - $this->errormessage=$custommessage; |
|
66 | - } |
|
67 | - } |
|
61 | + function setError($errorcode, $custommessage=""){ |
|
62 | + $this->errorcode=$errorcode; |
|
63 | + $this->errormessage=$this->errors[$errorcode]; |
|
64 | + if($custommessage!="") { |
|
65 | + $this->errormessage=$custommessage; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - function getError() { |
|
70 | - return $this->errorcode; |
|
71 | - } |
|
69 | + function getError() { |
|
70 | + return $this->errorcode; |
|
71 | + } |
|
72 | 72 | |
73 | - function dumpError(){ |
|
73 | + function dumpError(){ |
|
74 | 74 | ?> |
75 | 75 | <html> |
76 | 76 | <head> |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | </body> |
89 | 89 | </html> |
90 | 90 | <?php |
91 | - exit; |
|
92 | - } |
|
91 | + exit; |
|
92 | + } |
|
93 | 93 | } |
94 | 94 | ?> |
95 | 95 | \ No newline at end of file |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | |
120 | 120 | function ProcessFile($file) { |
121 | 121 | // get the file |
122 | - $buffer = @file_get_contents($file); |
|
123 | - if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
122 | + $buffer = @file_get_contents($file); |
|
123 | + if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
124 | 124 | return $buffer; |
125 | 125 | } |
126 | 126 | |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | // Parse MODX Template-Variables |
145 | 145 | function parseTvValues($param, $tvsArray) |
146 | 146 | { |
147 | - global $modx; |
|
148 | - $tvsArray = is_array($modx->documentObject) ? array_merge($tvsArray, $modx->documentObject) : $tvsArray; |
|
149 | - if (strpos($param, '[*') !== false) { |
|
150 | - $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
|
151 | - foreach ($matches[0] as $i=>$match) { |
|
152 | - if(isset($tvsArray[ $matches[1][$i] ])) { |
|
153 | - if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
154 | - $value = $tvsArray[$matches[1][$i]]['value']; |
|
155 | - $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
|
156 | - } else { |
|
157 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
158 | - } |
|
159 | - $param = str_replace($match, $value, $param); |
|
160 | - } |
|
161 | - } |
|
162 | - } |
|
163 | - return $param; |
|
147 | + global $modx; |
|
148 | + $tvsArray = is_array($modx->documentObject) ? array_merge($tvsArray, $modx->documentObject) : $tvsArray; |
|
149 | + if (strpos($param, '[*') !== false) { |
|
150 | + $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
|
151 | + foreach ($matches[0] as $i=>$match) { |
|
152 | + if(isset($tvsArray[ $matches[1][$i] ])) { |
|
153 | + if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
154 | + $value = $tvsArray[$matches[1][$i]]['value']; |
|
155 | + $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
|
156 | + } else { |
|
157 | + $value = $tvsArray[ $matches[1][$i] ]; |
|
158 | + } |
|
159 | + $param = str_replace($match, $value, $param); |
|
160 | + } |
|
161 | + } |
|
162 | + } |
|
163 | + return $param; |
|
164 | 164 | } |
165 | 165 | \ No newline at end of file |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - /** |
|
4 | - * System Alert Message Queue Display file |
|
5 | - * Written By Raymond Irving, April, 2005 |
|
6 | - * |
|
7 | - * Used to display system alert messages inside the browser |
|
8 | - * |
|
9 | - */ |
|
3 | + /** |
|
4 | + * System Alert Message Queue Display file |
|
5 | + * Written By Raymond Irving, April, 2005 |
|
6 | + * |
|
7 | + * Used to display system alert messages inside the browser |
|
8 | + * |
|
9 | + */ |
|
10 | 10 | |
11 | - require_once(dirname(__FILE__).'/protect.inc.php'); |
|
11 | + require_once(dirname(__FILE__).'/protect.inc.php'); |
|
12 | 12 | |
13 | - $sysMsgs = ""; |
|
14 | - $limit = count($SystemAlertMsgQueque); |
|
15 | - for($i=0;$i<$limit;$i++) { |
|
16 | - $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | - } |
|
18 | - // reset message queque |
|
19 | - unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | - $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
13 | + $sysMsgs = ""; |
|
14 | + $limit = count($SystemAlertMsgQueque); |
|
15 | + for($i=0;$i<$limit;$i++) { |
|
16 | + $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | + } |
|
18 | + // reset message queque |
|
19 | + unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | + $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if($sysMsgs!="") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
27 | - echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
27 | + echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
28 | 28 | ?> |
29 | 29 | <script type="text/javascript"> |
30 | 30 | // <![CDATA[ |
@@ -42,5 +42,5 @@ discard block |
||
42 | 42 | // ]]> |
43 | 43 | </script> |
44 | 44 | <?php |
45 | - } |
|
45 | + } |
|
46 | 46 | ?> |
47 | 47 | \ No newline at end of file |
@@ -21,5 +21,5 @@ |
||
21 | 21 | if($ok) { |
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | - echo '{status:"null"}'; |
|
24 | + echo '{status:"null"}'; |
|
25 | 25 | } |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | |
4 | 4 | // PROCESSOR FIRST |
5 | 5 | if($_SESSION['mgrRole'] == 1) { |
6 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | - $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
8 | - if(!empty($current)) { |
|
9 | - $modx->manager->setSystemChecksum($current); |
|
10 | - $modx->clearCache('full'); |
|
11 | - $modx->config['sys_files_checksum'] = $current; |
|
12 | - }; |
|
13 | - } |
|
6 | + if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | + $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
8 | + if(!empty($current)) { |
|
9 | + $modx->manager->setSystemChecksum($current); |
|
10 | + $modx->clearCache('full'); |
|
11 | + $modx->config['sys_files_checksum'] = $current; |
|
12 | + }; |
|
13 | + } |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | // NOW CHECK CONFIG |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | |
19 | 19 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
20 | 20 | if ($sysfiles_check!=='0'){ |
21 | - $warningspresent = 1; |
|
22 | - $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
21 | + $warningspresent = 1; |
|
22 | + $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | if (is_writable("includes/config.inc.php")){ |
26 | 26 | // Warn if world writable |
27 | 27 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
28 | - $warningspresent = 1; |
|
29 | - $warnings[] = array($_lang['configcheck_configinc']); |
|
28 | + $warningspresent = 1; |
|
29 | + $warnings[] = array($_lang['configcheck_configinc']); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | break; |
178 | 178 | case $_lang['configcheck_sysfiles_mod']: |
179 | 179 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
180 | - $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
181 | - if($modx->hasPermission('settings')) { |
|
182 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
183 | - } |
|
180 | + $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
181 | + if($modx->hasPermission('settings')) { |
|
182 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
183 | + } |
|
184 | 184 | if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
185 | 185 | break; |
186 | 186 | case $_lang['configcheck_lang_difference'] : |