@@ -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 | } |
@@ -9,178 +9,178 @@ |
||
9 | 9 | |
10 | 10 | Class TemplateParser { |
11 | 11 | |
12 | - function __construct() { |
|
13 | - } |
|
14 | - |
|
15 | - /** |
|
16 | - * @param array $config [action, tabs, toArray] |
|
17 | - * @param array $data |
|
18 | - * @return string |
|
19 | - */ |
|
20 | - public function output($config = array(), $data = array()) { |
|
21 | - global $modx; |
|
22 | - |
|
23 | - $output = ''; |
|
24 | - $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
26 | - |
|
27 | - if($action) { |
|
28 | - $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
12 | + function __construct() { |
|
13 | + } |
|
14 | + |
|
15 | + /** |
|
16 | + * @param array $config [action, tabs, toArray] |
|
17 | + * @param array $data |
|
18 | + * @return string |
|
19 | + */ |
|
20 | + public function output($config = array(), $data = array()) { |
|
21 | + global $modx; |
|
22 | + |
|
23 | + $output = ''; |
|
24 | + $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
25 | + $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
26 | + |
|
27 | + if($action) { |
|
28 | + $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
29 | 29 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
30 | 30 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
31 | 31 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 33 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
35 | - $tabs = array(); |
|
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | - $row['value'] = $data[$row['name']]; |
|
39 | - } |
|
40 | - $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
41 | - $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
42 | - } |
|
43 | - |
|
44 | - if(!empty($config['toArray'])) { |
|
45 | - $output = $tabs; |
|
46 | - } else { |
|
47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
48 | - $output .= ' |
|
34 | + if($modx->db->getRecordCount($sql)) { |
|
35 | + $tabs = array(); |
|
36 | + while($row = $modx->db->getRow($sql)) { |
|
37 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | + $row['value'] = $data[$row['name']]; |
|
39 | + } |
|
40 | + $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
41 | + $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
42 | + } |
|
43 | + |
|
44 | + if(!empty($config['toArray'])) { |
|
45 | + $output = $tabs; |
|
46 | + } else { |
|
47 | + $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
48 | + $output .= ' |
|
49 | 49 | <script type="text/javascript"> |
50 | 50 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
51 | 51 | </script>'; |
52 | 52 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
55 | - $output .= ' |
|
53 | + foreach($tabs as $idTab => $tab) { |
|
54 | + $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
55 | + $output .= ' |
|
56 | 56 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
57 | 57 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
58 | - unset($tab['category_name']); |
|
59 | - foreach($tab as $item) { |
|
60 | - $output .= $item; |
|
61 | - } |
|
62 | - $output .= '</div>'; |
|
63 | - } |
|
64 | - $output .= '</div>'; |
|
65 | - } |
|
66 | - } |
|
67 | - } |
|
68 | - |
|
69 | - return $output; |
|
70 | - } |
|
71 | - |
|
72 | - private function render($data) { |
|
73 | - global $modx, $_lang, $_country_lang; |
|
74 | - |
|
75 | - $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
76 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
77 | - $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
78 | - |
|
79 | - $output = ''; |
|
80 | - $output .= '<div class="form-group row">'; |
|
81 | - |
|
82 | - switch($data['type']) { |
|
83 | - |
|
84 | - case 'text': |
|
85 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
58 | + unset($tab['category_name']); |
|
59 | + foreach($tab as $item) { |
|
60 | + $output .= $item; |
|
61 | + } |
|
62 | + $output .= '</div>'; |
|
63 | + } |
|
64 | + $output .= '</div>'; |
|
65 | + } |
|
66 | + } |
|
67 | + } |
|
68 | + |
|
69 | + return $output; |
|
70 | + } |
|
71 | + |
|
72 | + private function render($data) { |
|
73 | + global $modx, $_lang, $_country_lang; |
|
74 | + |
|
75 | + $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
76 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
77 | + $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
78 | + |
|
79 | + $output = ''; |
|
80 | + $output .= '<div class="form-group row">'; |
|
81 | + |
|
82 | + switch($data['type']) { |
|
83 | + |
|
84 | + case 'text': |
|
85 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
86 | 86 | <div class="col-sm-7"> |
87 | 87 | <input type="text" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
88 | - $output .= $data['content']; |
|
89 | - $output .= '</div>'; |
|
88 | + $output .= $data['content']; |
|
89 | + $output .= '</div>'; |
|
90 | 90 | |
91 | - break; |
|
91 | + break; |
|
92 | 92 | |
93 | - case 'textarea': |
|
94 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
93 | + case 'textarea': |
|
94 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
95 | 95 | <div class="col-sm-7"> |
96 | 96 | <textarea name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;"[+readonly+]>[+value+]</textarea>'; |
97 | - $output .= $data['content']; |
|
98 | - $output .= '</div>'; |
|
97 | + $output .= $data['content']; |
|
98 | + $output .= '</div>'; |
|
99 | 99 | |
100 | - break; |
|
100 | + break; |
|
101 | 101 | |
102 | - case 'date': |
|
103 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
104 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
102 | + case 'date': |
|
103 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
104 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
105 | 105 | <div class="col-sm-7"> |
106 | 106 | <input type="text" name="[+name+]" class="form-control DatePicker" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
107 | - $output .= $data['content']; |
|
108 | - $output .= '</div>'; |
|
109 | - |
|
110 | - break; |
|
111 | - |
|
112 | - case 'select': |
|
113 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
114 | - $output .= '<div class="col-sm-7">'; |
|
115 | - $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | - $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | - foreach($_country_lang as $key => $value) { |
|
120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
121 | - } |
|
122 | - } else { |
|
123 | - if($data['elements']) { |
|
124 | - $elements = explode('||', $data['elements']); |
|
125 | - foreach($elements as $key => $value) { |
|
126 | - $value = explode('==', $value); |
|
127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | - } |
|
129 | - } |
|
130 | - } |
|
131 | - $output .= '</select>'; |
|
132 | - $output .= $data['content']; |
|
133 | - $output .= '</div>'; |
|
134 | - |
|
135 | - break; |
|
136 | - |
|
137 | - case 'checkbox': |
|
138 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
139 | - $output .= '<div class="col-sm-7">'; |
|
140 | - $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
141 | - if($data['elements']) { |
|
142 | - $elements = explode('||', $data['elements']); |
|
143 | - foreach($elements as $key => $value) { |
|
144 | - $value = explode('==', $value); |
|
145 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | - } |
|
147 | - } |
|
148 | - $output .= $data['content']; |
|
149 | - $output .= '</div>'; |
|
150 | - |
|
151 | - break; |
|
152 | - |
|
153 | - case 'radio': |
|
154 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
155 | - $output .= '<div class="col-sm-7">'; |
|
156 | - $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
157 | - if($data['elements']) { |
|
158 | - $elements = explode('||', $data['elements']); |
|
159 | - foreach($elements as $key => $value) { |
|
160 | - $value = explode('==', $value); |
|
161 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | - } |
|
163 | - } |
|
164 | - $output .= $data['content']; |
|
165 | - $output .= '</div>'; |
|
166 | - |
|
167 | - break; |
|
168 | - |
|
169 | - case 'custom': |
|
170 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
171 | - $output .= '<div class="col-sm-7">'; |
|
172 | - $output .= $data['content']; |
|
173 | - $output .= '</div>'; |
|
174 | - |
|
175 | - break; |
|
176 | - } |
|
177 | - |
|
178 | - $output .= '</div>'; |
|
179 | - |
|
180 | - $output = $modx->parseText($output, $data); |
|
181 | - |
|
182 | - return $output; |
|
183 | - } |
|
107 | + $output .= $data['content']; |
|
108 | + $output .= '</div>'; |
|
109 | + |
|
110 | + break; |
|
111 | + |
|
112 | + case 'select': |
|
113 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
114 | + $output .= '<div class="col-sm-7">'; |
|
115 | + $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
116 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | + $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
118 | + $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | + foreach($_country_lang as $key => $value) { |
|
120 | + $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
121 | + } |
|
122 | + } else { |
|
123 | + if($data['elements']) { |
|
124 | + $elements = explode('||', $data['elements']); |
|
125 | + foreach($elements as $key => $value) { |
|
126 | + $value = explode('==', $value); |
|
127 | + $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | + } |
|
129 | + } |
|
130 | + } |
|
131 | + $output .= '</select>'; |
|
132 | + $output .= $data['content']; |
|
133 | + $output .= '</div>'; |
|
134 | + |
|
135 | + break; |
|
136 | + |
|
137 | + case 'checkbox': |
|
138 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
139 | + $output .= '<div class="col-sm-7">'; |
|
140 | + $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
141 | + if($data['elements']) { |
|
142 | + $elements = explode('||', $data['elements']); |
|
143 | + foreach($elements as $key => $value) { |
|
144 | + $value = explode('==', $value); |
|
145 | + $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | + } |
|
147 | + } |
|
148 | + $output .= $data['content']; |
|
149 | + $output .= '</div>'; |
|
150 | + |
|
151 | + break; |
|
152 | + |
|
153 | + case 'radio': |
|
154 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
155 | + $output .= '<div class="col-sm-7">'; |
|
156 | + $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
157 | + if($data['elements']) { |
|
158 | + $elements = explode('||', $data['elements']); |
|
159 | + foreach($elements as $key => $value) { |
|
160 | + $value = explode('==', $value); |
|
161 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | + } |
|
163 | + } |
|
164 | + $output .= $data['content']; |
|
165 | + $output .= '</div>'; |
|
166 | + |
|
167 | + break; |
|
168 | + |
|
169 | + case 'custom': |
|
170 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
171 | + $output .= '<div class="col-sm-7">'; |
|
172 | + $output .= $data['content']; |
|
173 | + $output .= '</div>'; |
|
174 | + |
|
175 | + break; |
|
176 | + } |
|
177 | + |
|
178 | + $output .= '</div>'; |
|
179 | + |
|
180 | + $output = $modx->parseText($output, $data); |
|
181 | + |
|
182 | + return $output; |
|
183 | + } |
|
184 | 184 | |
185 | 185 | } |
186 | 186 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | // show debug information |
5 | 5 | if(isset($enable_debug) && $enable_debug==true) { |
6 | - ?> |
|
6 | + ?> |
|
7 | 7 | <script language="javascript"> |
8 | 8 | //document.onload = removeDebug(); |
9 | 9 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | </style> |
35 | 35 | <?php |
36 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | - ?> |
|
36 | + $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | + ?> |
|
38 | 38 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
39 | 39 | <table border="0" cellspacing="0" cellpadding="0"> |
40 | 40 | <tr> |
@@ -5,10 +5,10 @@ |
||
5 | 5 | $settings = array(); |
6 | 6 | if ($modx && count($modx->config)>0) $settings = $modx->config; |
7 | 7 | else{ |
8 | - $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('system_settings')); |
|
9 | - while ($row = $modx->db->getRow($rs)) { |
|
10 | - $settings[$row['setting_name']] = $row['setting_value']; |
|
11 | - } |
|
8 | + $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('system_settings')); |
|
9 | + while ($row = $modx->db->getRow($rs)) { |
|
10 | + $settings[$row['setting_name']] = $row['setting_value']; |
|
11 | + } |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | extract($settings, EXTR_OVERWRITE); |
@@ -12,13 +12,13 @@ |
||
12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
13 | 13 | $ok = false; |
14 | 14 | if(isset($_SESSION['mgrToken']) && $_GET['tok'] == $_SESSION['mgrToken']) { |
15 | - $ok = true; |
|
16 | - $modx->updateValidatedUserSession(); |
|
15 | + $ok = true; |
|
16 | + $modx->updateValidatedUserSession(); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | header('Content-type: application/json'); |
20 | 20 | if($ok) { |
21 | 21 | echo '{"status":"ok"}'; |
22 | 22 | } else { |
23 | - echo '{"status":"null"}'; |
|
23 | + echo '{"status":"null"}'; |
|
24 | 24 | } |
@@ -363,10 +363,10 @@ |
||
363 | 363 | stopWorker(); |
364 | 364 | |
365 | 365 | <?php |
366 | - if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
|
367 | - echo 'doRefresh(' . $_REQUEST['r'] . ");\n"; |
|
368 | - } |
|
369 | - ?> |
|
366 | + if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
|
367 | + echo 'doRefresh(' . $_REQUEST['r'] . ");\n"; |
|
368 | + } |
|
369 | + ?> |
|
370 | 370 | |
371 | 371 | var actionButtons = document.getElementById('actions'), actionSelect = document.getElementById('stay'); |
372 | 372 | if (actionButtons !== null && actionSelect !== null) { |
@@ -19,60 +19,60 @@ |
||
19 | 19 | </head><body> |
20 | 20 | "; |
21 | 21 | if($is_error) { |
22 | - $parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'> MODX Parse Error </h3> |
|
22 | + $parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'> MODX Parse Error </h3> |
|
23 | 23 | <table border='0' cellpadding='1' cellspacing='0'> |
24 | 24 | <tr><td colspan='3'>MODX encountered the following error while attempting to parse the requested resource:</td></tr> |
25 | 25 | <tr><td colspan='3'><b style='color:red;'>« $msg »</b></td></tr>"; |
26 | 26 | } else { |
27 | - $parsedMessageString .= "<h3 style='color:#003399; background:#eeeeee;padding:2px;'> MODX Debug/ stop message </h3> |
|
27 | + $parsedMessageString .= "<h3 style='color:#003399; background:#eeeeee;padding:2px;'> MODX Debug/ stop message </h3> |
|
28 | 28 | <table border='0' cellpadding='1' cellspacing='0'> |
29 | 29 | <tr><td colspan='3'>The MODX parser recieved the following debug/ stop message:</td></tr> |
30 | 30 | <tr><td colspan='3'><b style='color:#003399;'>« $msg »</b></td></tr>"; |
31 | 31 | } |
32 | 32 | |
33 | 33 | if(!empty($query)) { |
34 | - $parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'> SQL: <span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/> |
|
34 | + $parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'> SQL: <span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/> |
|
35 | 35 | <a href='javascript:copyToClip();' style='color:#821517;font-size: 9px; text-decoration: none'>[Copy SQL to ClipBoard]</a><textarea id='holdtext' style='display:none;'></textarea></td></tr>"; |
36 | 36 | } |
37 | 37 | |
38 | 38 | if($text!='') { |
39 | 39 | |
40 | - $errortype = array ( |
|
41 | - E_ERROR => "Error", |
|
42 | - E_WARNING => "Warning", |
|
43 | - E_PARSE => "Parsing Error", |
|
44 | - E_NOTICE => "Notice", |
|
45 | - E_CORE_ERROR => "Core Error", |
|
46 | - E_CORE_WARNING => "Core Warning", |
|
47 | - E_COMPILE_ERROR => "Compile Error", |
|
48 | - E_COMPILE_WARNING => "Compile Warning", |
|
49 | - E_USER_ERROR => "User Error", |
|
50 | - E_USER_WARNING => "User Warning", |
|
51 | - E_USER_NOTICE => "User Notice", |
|
52 | - ); |
|
40 | + $errortype = array ( |
|
41 | + E_ERROR => "Error", |
|
42 | + E_WARNING => "Warning", |
|
43 | + E_PARSE => "Parsing Error", |
|
44 | + E_NOTICE => "Notice", |
|
45 | + E_CORE_ERROR => "Core Error", |
|
46 | + E_CORE_WARNING => "Core Warning", |
|
47 | + E_COMPILE_ERROR => "Compile Error", |
|
48 | + E_COMPILE_WARNING => "Compile Warning", |
|
49 | + E_USER_ERROR => "User Error", |
|
50 | + E_USER_WARNING => "User Warning", |
|
51 | + E_USER_NOTICE => "User Notice", |
|
52 | + ); |
|
53 | 53 | |
54 | - $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>PHP error debug</b></td></tr>"; |
|
54 | + $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>PHP error debug</b></td></tr>"; |
|
55 | 55 | |
56 | - $parsedMessageString .= "<tr><td valign='top'> Error: </td>"; |
|
57 | - $parsedMessageString .= "<td colspan='2'>$text</td><td> </td>"; |
|
58 | - $parsedMessageString .= "</tr>"; |
|
56 | + $parsedMessageString .= "<tr><td valign='top'> Error: </td>"; |
|
57 | + $parsedMessageString .= "<td colspan='2'>$text</td><td> </td>"; |
|
58 | + $parsedMessageString .= "</tr>"; |
|
59 | 59 | |
60 | - $parsedMessageString .= "<tr><td valign='top'> Error type/ Nr.: </td>"; |
|
61 | - $parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td> </td>"; |
|
62 | - $parsedMessageString .= "</tr>"; |
|
60 | + $parsedMessageString .= "<tr><td valign='top'> Error type/ Nr.: </td>"; |
|
61 | + $parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td> </td>"; |
|
62 | + $parsedMessageString .= "</tr>"; |
|
63 | 63 | |
64 | - $parsedMessageString .= "<tr><td> File: </td>"; |
|
65 | - $parsedMessageString .= "<td colspan='2'>$file</td><td> </td>"; |
|
66 | - $parsedMessageString .= "</tr>"; |
|
64 | + $parsedMessageString .= "<tr><td> File: </td>"; |
|
65 | + $parsedMessageString .= "<td colspan='2'>$file</td><td> </td>"; |
|
66 | + $parsedMessageString .= "</tr>"; |
|
67 | 67 | |
68 | - $parsedMessageString .= "<tr><td> Line: </td>"; |
|
69 | - $parsedMessageString .= "<td colspan='2'>$line</td><td> </td>"; |
|
70 | - $parsedMessageString .= "</tr>"; |
|
71 | - if($source!='') { |
|
72 | - $parsedMessageString .= "<tr><td valign='top'> Line $line source: </td>"; |
|
73 | - $parsedMessageString .= "<td colspan='2'>$source</td><td> </td>"; |
|
74 | - $parsedMessageString .= "</tr>"; |
|
75 | - } |
|
68 | + $parsedMessageString .= "<tr><td> Line: </td>"; |
|
69 | + $parsedMessageString .= "<td colspan='2'>$line</td><td> </td>"; |
|
70 | + $parsedMessageString .= "</tr>"; |
|
71 | + if($source!='') { |
|
72 | + $parsedMessageString .= "<tr><td valign='top'> Line $line source: </td>"; |
|
73 | + $parsedMessageString .= "<td colspan='2'>$source</td><td> </td>"; |
|
74 | + $parsedMessageString .= "</tr>"; |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>Parser timing</b></td></tr>"; |
@@ -10,215 +10,215 @@ |
||
10 | 10 | // Content manager wrapper class |
11 | 11 | class ManagerAPI { |
12 | 12 | |
13 | - var $action; // action directive |
|
13 | + var $action; // action directive |
|
14 | 14 | |
15 | - function __construct(){ |
|
16 | - global $action; |
|
17 | - $this->action = $action; // set action directive |
|
18 | - } |
|
15 | + function __construct(){ |
|
16 | + global $action; |
|
17 | + $this->action = $action; // set action directive |
|
18 | + } |
|
19 | 19 | |
20 | - function initPageViewState($id=0){ |
|
21 | - global $_PAGE; |
|
22 | - $vsid = isset($_SESSION["mgrPageViewSID"]) ? $_SESSION["mgrPageViewSID"] : ''; |
|
23 | - if($vsid!=$this->action) { |
|
24 | - $_SESSION["mgrPageViewSDATA"] = array(); // new view state |
|
25 | - $_SESSION["mgrPageViewSID"] = $id>0 ? $id:$this->action; // set id |
|
26 | - } |
|
27 | - $_PAGE['vs'] = &$_SESSION["mgrPageViewSDATA"]; // restore viewstate |
|
28 | - } |
|
20 | + function initPageViewState($id=0){ |
|
21 | + global $_PAGE; |
|
22 | + $vsid = isset($_SESSION["mgrPageViewSID"]) ? $_SESSION["mgrPageViewSID"] : ''; |
|
23 | + if($vsid!=$this->action) { |
|
24 | + $_SESSION["mgrPageViewSDATA"] = array(); // new view state |
|
25 | + $_SESSION["mgrPageViewSID"] = $id>0 ? $id:$this->action; // set id |
|
26 | + } |
|
27 | + $_PAGE['vs'] = &$_SESSION["mgrPageViewSDATA"]; // restore viewstate |
|
28 | + } |
|
29 | 29 | |
30 | - // save page view state - not really necessary, |
|
31 | - function savePageViewState($id=0){ |
|
32 | - global $_PAGE; |
|
33 | - $_SESSION["mgrPageViewSDATA"] = $_PAGE['vs']; |
|
34 | - $_SESSION["mgrPageViewSID"] = $id>0 ? $id:$this->action; |
|
35 | - } |
|
30 | + // save page view state - not really necessary, |
|
31 | + function savePageViewState($id=0){ |
|
32 | + global $_PAGE; |
|
33 | + $_SESSION["mgrPageViewSDATA"] = $_PAGE['vs']; |
|
34 | + $_SESSION["mgrPageViewSID"] = $id>0 ? $id:$this->action; |
|
35 | + } |
|
36 | 36 | |
37 | - // check for saved form |
|
38 | - function hasFormValues() { |
|
39 | - if(isset($_SESSION["mgrFormValueId"])) { |
|
40 | - if($this->action==$_SESSION["mgrFormValueId"]) { |
|
41 | - return true; |
|
42 | - } |
|
43 | - else { |
|
44 | - $this->clearSavedFormValues(); |
|
45 | - } |
|
46 | - } |
|
47 | - return false; |
|
48 | - } |
|
49 | - // saved form post from $_POST |
|
50 | - function saveFormValues($id=0){ |
|
51 | - $_SESSION["mgrFormValues"] = $_POST; |
|
52 | - $_SESSION["mgrFormValueId"] = $id>0 ? $id:$this->action; |
|
53 | - } |
|
54 | - // load saved form values into $_POST |
|
55 | - function loadFormValues(){ |
|
37 | + // check for saved form |
|
38 | + function hasFormValues() { |
|
39 | + if(isset($_SESSION["mgrFormValueId"])) { |
|
40 | + if($this->action==$_SESSION["mgrFormValueId"]) { |
|
41 | + return true; |
|
42 | + } |
|
43 | + else { |
|
44 | + $this->clearSavedFormValues(); |
|
45 | + } |
|
46 | + } |
|
47 | + return false; |
|
48 | + } |
|
49 | + // saved form post from $_POST |
|
50 | + function saveFormValues($id=0){ |
|
51 | + $_SESSION["mgrFormValues"] = $_POST; |
|
52 | + $_SESSION["mgrFormValueId"] = $id>0 ? $id:$this->action; |
|
53 | + } |
|
54 | + // load saved form values into $_POST |
|
55 | + function loadFormValues(){ |
|
56 | 56 | |
57 | - if(!$this->hasFormValues()) return false; |
|
57 | + if(!$this->hasFormValues()) return false; |
|
58 | 58 | |
59 | - $p = $_SESSION["mgrFormValues"]; |
|
60 | - $this->clearSavedFormValues(); |
|
61 | - foreach($p as $k=>$v) { |
|
62 | - $_POST[$k]=$v; |
|
63 | - } |
|
64 | - return true; |
|
65 | - } |
|
66 | - // clear form post |
|
67 | - function clearSavedFormValues(){ |
|
68 | - unset($_SESSION["mgrFormValues"]); |
|
69 | - unset($_SESSION["mgrFormValueId"]); |
|
70 | - } |
|
59 | + $p = $_SESSION["mgrFormValues"]; |
|
60 | + $this->clearSavedFormValues(); |
|
61 | + foreach($p as $k=>$v) { |
|
62 | + $_POST[$k]=$v; |
|
63 | + } |
|
64 | + return true; |
|
65 | + } |
|
66 | + // clear form post |
|
67 | + function clearSavedFormValues(){ |
|
68 | + unset($_SESSION["mgrFormValues"]); |
|
69 | + unset($_SESSION["mgrFormValueId"]); |
|
70 | + } |
|
71 | 71 | |
72 | - function getHashType($db_value='') { // md5 | v1 | phpass |
|
73 | - $c = substr($db_value,0,1); |
|
74 | - if($c==='$') return 'phpass'; |
|
75 | - elseif(strlen($db_value)===32) return 'md5'; |
|
76 | - elseif($c!=='$' && strpos($db_value,'>')!==false) return 'v1'; |
|
77 | - else return 'unknown'; |
|
78 | - } |
|
72 | + function getHashType($db_value='') { // md5 | v1 | phpass |
|
73 | + $c = substr($db_value,0,1); |
|
74 | + if($c==='$') return 'phpass'; |
|
75 | + elseif(strlen($db_value)===32) return 'md5'; |
|
76 | + elseif($c!=='$' && strpos($db_value,'>')!==false) return 'v1'; |
|
77 | + else return 'unknown'; |
|
78 | + } |
|
79 | 79 | |
80 | - function genV1Hash($password, $seed='1') |
|
81 | - { // $seed is user_id basically |
|
82 | - global $modx; |
|
80 | + function genV1Hash($password, $seed='1') |
|
81 | + { // $seed is user_id basically |
|
82 | + global $modx; |
|
83 | 83 | |
84 | - if(isset($modx->config['pwd_hash_algo']) && !empty($modx->config['pwd_hash_algo'])) |
|
85 | - $algorithm = $modx->config['pwd_hash_algo']; |
|
86 | - else $algorithm = 'UNCRYPT'; |
|
84 | + if(isset($modx->config['pwd_hash_algo']) && !empty($modx->config['pwd_hash_algo'])) |
|
85 | + $algorithm = $modx->config['pwd_hash_algo']; |
|
86 | + else $algorithm = 'UNCRYPT'; |
|
87 | 87 | |
88 | - $salt = md5($password . $seed); |
|
88 | + $salt = md5($password . $seed); |
|
89 | 89 | |
90 | - switch($algorithm) |
|
91 | - { |
|
92 | - case 'BLOWFISH_Y': |
|
93 | - $salt = '$2y$07$' . substr($salt,0,22); |
|
94 | - break; |
|
95 | - case 'BLOWFISH_A': |
|
96 | - $salt = '$2a$07$' . substr($salt,0,22); |
|
97 | - break; |
|
98 | - case 'SHA512': |
|
99 | - $salt = '$6$' . substr($salt,0,16); |
|
100 | - break; |
|
101 | - case 'SHA256': |
|
102 | - $salt = '$5$' . substr($salt,0,16); |
|
103 | - break; |
|
104 | - case 'MD5': |
|
105 | - $salt = '$1$' . substr($salt,0,8); |
|
106 | - break; |
|
107 | - } |
|
90 | + switch($algorithm) |
|
91 | + { |
|
92 | + case 'BLOWFISH_Y': |
|
93 | + $salt = '$2y$07$' . substr($salt,0,22); |
|
94 | + break; |
|
95 | + case 'BLOWFISH_A': |
|
96 | + $salt = '$2a$07$' . substr($salt,0,22); |
|
97 | + break; |
|
98 | + case 'SHA512': |
|
99 | + $salt = '$6$' . substr($salt,0,16); |
|
100 | + break; |
|
101 | + case 'SHA256': |
|
102 | + $salt = '$5$' . substr($salt,0,16); |
|
103 | + break; |
|
104 | + case 'MD5': |
|
105 | + $salt = '$1$' . substr($salt,0,8); |
|
106 | + break; |
|
107 | + } |
|
108 | 108 | |
109 | - if($algorithm!=='UNCRYPT') |
|
110 | - { |
|
111 | - $password = sha1($password) . crypt($password,$salt); |
|
112 | - } |
|
113 | - else $password = sha1($salt.$password); |
|
109 | + if($algorithm!=='UNCRYPT') |
|
110 | + { |
|
111 | + $password = sha1($password) . crypt($password,$salt); |
|
112 | + } |
|
113 | + else $password = sha1($salt.$password); |
|
114 | 114 | |
115 | - $result = strtolower($algorithm) . '>' . md5($salt.$password) . substr(md5($salt),0,8); |
|
115 | + $result = strtolower($algorithm) . '>' . md5($salt.$password) . substr(md5($salt),0,8); |
|
116 | 116 | |
117 | - return $result; |
|
118 | - } |
|
117 | + return $result; |
|
118 | + } |
|
119 | 119 | |
120 | - function getV1UserHashAlgorithm($uid) |
|
121 | - { |
|
122 | - global $modx; |
|
123 | - $tbl_manager_users = $modx->getFullTableName('manager_users'); |
|
124 | - $rs = $modx->db->select('password',$tbl_manager_users,"id='{$uid}'"); |
|
125 | - $password = $modx->db->getValue($rs); |
|
120 | + function getV1UserHashAlgorithm($uid) |
|
121 | + { |
|
122 | + global $modx; |
|
123 | + $tbl_manager_users = $modx->getFullTableName('manager_users'); |
|
124 | + $rs = $modx->db->select('password',$tbl_manager_users,"id='{$uid}'"); |
|
125 | + $password = $modx->db->getValue($rs); |
|
126 | 126 | |
127 | - if(strpos($password,'>')===false) $algo = 'NOSALT'; |
|
128 | - else |
|
129 | - { |
|
130 | - $algo = substr($password,0,strpos($password,'>')); |
|
131 | - } |
|
132 | - return strtoupper($algo); |
|
133 | - } |
|
127 | + if(strpos($password,'>')===false) $algo = 'NOSALT'; |
|
128 | + else |
|
129 | + { |
|
130 | + $algo = substr($password,0,strpos($password,'>')); |
|
131 | + } |
|
132 | + return strtoupper($algo); |
|
133 | + } |
|
134 | 134 | |
135 | - function checkHashAlgorithm($algorithm='') |
|
136 | - { |
|
137 | - $result = false; |
|
138 | - if (!empty($algorithm)) |
|
139 | - { |
|
140 | - switch ($algorithm) |
|
141 | - { |
|
142 | - case 'BLOWFISH_Y': |
|
143 | - if (defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1) |
|
144 | - { |
|
145 | - if (version_compare('5.3.7', PHP_VERSION) <= 0) $result = true; |
|
146 | - } |
|
147 | - break; |
|
148 | - case 'BLOWFISH_A': |
|
149 | - if (defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1) $result = true; |
|
150 | - break; |
|
151 | - case 'SHA512': |
|
152 | - if (defined('CRYPT_SHA512') && CRYPT_SHA512 == 1) $result = true; |
|
153 | - break; |
|
154 | - case 'SHA256': |
|
155 | - if (defined('CRYPT_SHA256') && CRYPT_SHA256 == 1) $result = true; |
|
156 | - break; |
|
157 | - case 'MD5': |
|
158 | - if (defined('CRYPT_MD5') && CRYPT_MD5 == 1 && PHP_VERSION != '5.3.7') $result = true; |
|
159 | - break; |
|
160 | - case 'UNCRYPT': |
|
161 | - $result = true; |
|
162 | - break; |
|
163 | - } |
|
164 | - } |
|
165 | - return $result; |
|
166 | - } |
|
135 | + function checkHashAlgorithm($algorithm='') |
|
136 | + { |
|
137 | + $result = false; |
|
138 | + if (!empty($algorithm)) |
|
139 | + { |
|
140 | + switch ($algorithm) |
|
141 | + { |
|
142 | + case 'BLOWFISH_Y': |
|
143 | + if (defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1) |
|
144 | + { |
|
145 | + if (version_compare('5.3.7', PHP_VERSION) <= 0) $result = true; |
|
146 | + } |
|
147 | + break; |
|
148 | + case 'BLOWFISH_A': |
|
149 | + if (defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1) $result = true; |
|
150 | + break; |
|
151 | + case 'SHA512': |
|
152 | + if (defined('CRYPT_SHA512') && CRYPT_SHA512 == 1) $result = true; |
|
153 | + break; |
|
154 | + case 'SHA256': |
|
155 | + if (defined('CRYPT_SHA256') && CRYPT_SHA256 == 1) $result = true; |
|
156 | + break; |
|
157 | + case 'MD5': |
|
158 | + if (defined('CRYPT_MD5') && CRYPT_MD5 == 1 && PHP_VERSION != '5.3.7') $result = true; |
|
159 | + break; |
|
160 | + case 'UNCRYPT': |
|
161 | + $result = true; |
|
162 | + break; |
|
163 | + } |
|
164 | + } |
|
165 | + return $result; |
|
166 | + } |
|
167 | 167 | |
168 | - function getSystemChecksum($check_files) { |
|
169 | - $_ = array(); |
|
170 | - $check_files = trim($check_files); |
|
171 | - $check_files = explode("\n", $check_files); |
|
172 | - foreach($check_files as $file) { |
|
173 | - $file = trim($file); |
|
174 | - $file = MODX_BASE_PATH . $file; |
|
175 | - if(!is_file($file)) continue; |
|
176 | - $_[$file]= md5_file($file); |
|
177 | - } |
|
178 | - return serialize($_); |
|
179 | - } |
|
168 | + function getSystemChecksum($check_files) { |
|
169 | + $_ = array(); |
|
170 | + $check_files = trim($check_files); |
|
171 | + $check_files = explode("\n", $check_files); |
|
172 | + foreach($check_files as $file) { |
|
173 | + $file = trim($file); |
|
174 | + $file = MODX_BASE_PATH . $file; |
|
175 | + if(!is_file($file)) continue; |
|
176 | + $_[$file]= md5_file($file); |
|
177 | + } |
|
178 | + return serialize($_); |
|
179 | + } |
|
180 | 180 | |
181 | - function getModifiedSystemFilesList($check_files, $checksum) { |
|
182 | - $_ = array(); |
|
183 | - $check_files = trim($check_files); |
|
184 | - $check_files = explode("\n", $check_files); |
|
185 | - $checksum = unserialize($checksum); |
|
186 | - foreach($check_files as $file) { |
|
187 | - $file = trim($file); |
|
188 | - $filePath = MODX_BASE_PATH . $file; |
|
189 | - if(!is_file($filePath)) continue; |
|
190 | - if(md5_file($filePath) != $checksum[$filePath]) $_[] = $file; |
|
191 | - } |
|
192 | - return $_; |
|
193 | - } |
|
181 | + function getModifiedSystemFilesList($check_files, $checksum) { |
|
182 | + $_ = array(); |
|
183 | + $check_files = trim($check_files); |
|
184 | + $check_files = explode("\n", $check_files); |
|
185 | + $checksum = unserialize($checksum); |
|
186 | + foreach($check_files as $file) { |
|
187 | + $file = trim($file); |
|
188 | + $filePath = MODX_BASE_PATH . $file; |
|
189 | + if(!is_file($filePath)) continue; |
|
190 | + if(md5_file($filePath) != $checksum[$filePath]) $_[] = $file; |
|
191 | + } |
|
192 | + return $_; |
|
193 | + } |
|
194 | 194 | |
195 | - function setSystemChecksum($checksum) { |
|
196 | - global $modx; |
|
197 | - $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
198 | - $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->db->escape($checksum) . "')"; |
|
195 | + function setSystemChecksum($checksum) { |
|
196 | + global $modx; |
|
197 | + $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
198 | + $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->db->escape($checksum) . "')"; |
|
199 | 199 | $modx->db->query($sql); |
200 | - } |
|
200 | + } |
|
201 | 201 | |
202 | - function checkSystemChecksum() { |
|
203 | - global $modx; |
|
202 | + function checkSystemChecksum() { |
|
203 | + global $modx; |
|
204 | 204 | |
205 | - if(!isset($modx->config['check_files_onlogin']) || empty($modx->config['check_files_onlogin'])) return '0'; |
|
205 | + if(!isset($modx->config['check_files_onlogin']) || empty($modx->config['check_files_onlogin'])) return '0'; |
|
206 | 206 | |
207 | - $current = $this->getSystemChecksum($modx->config['check_files_onlogin']); |
|
208 | - if(empty($current)) return '0'; |
|
207 | + $current = $this->getSystemChecksum($modx->config['check_files_onlogin']); |
|
208 | + if(empty($current)) return '0'; |
|
209 | 209 | |
210 | - if(!isset($modx->config['sys_files_checksum']) || empty($modx->config['sys_files_checksum'])) |
|
211 | - { |
|
212 | - $this->setSystemChecksum($current); |
|
213 | - return '0'; |
|
214 | - } |
|
215 | - if($current===$modx->config['sys_files_checksum']) $result = '0'; |
|
216 | - else { |
|
217 | - $result = $this->getModifiedSystemFilesList($modx->config['check_files_onlogin'], $modx->config['sys_files_checksum']); |
|
218 | - } |
|
210 | + if(!isset($modx->config['sys_files_checksum']) || empty($modx->config['sys_files_checksum'])) |
|
211 | + { |
|
212 | + $this->setSystemChecksum($current); |
|
213 | + return '0'; |
|
214 | + } |
|
215 | + if($current===$modx->config['sys_files_checksum']) $result = '0'; |
|
216 | + else { |
|
217 | + $result = $this->getModifiedSystemFilesList($modx->config['check_files_onlogin'], $modx->config['sys_files_checksum']); |
|
218 | + } |
|
219 | 219 | |
220 | - return $result; |
|
221 | - } |
|
220 | + return $result; |
|
221 | + } |
|
222 | 222 | |
223 | 223 | function getLastUserSetting($key=false) { |
224 | 224 | global $modx; |
@@ -2,26 +2,26 @@ |
||
2 | 2 | // todo file_put_contents(), strftime(), mb_*() |
3 | 3 | class PHPCOMPAT |
4 | 4 | { |
5 | - function __construct() |
|
6 | - { |
|
7 | - } |
|
5 | + function __construct() |
|
6 | + { |
|
7 | + } |
|
8 | 8 | |
9 | - function htmlspecialchars($str='', $flags = ENT_COMPAT, $encode='') |
|
10 | - { |
|
11 | - global $modx; |
|
9 | + function htmlspecialchars($str='', $flags = ENT_COMPAT, $encode='') |
|
10 | + { |
|
11 | + global $modx; |
|
12 | 12 | |
13 | - if($str=='') return ''; |
|
13 | + if($str=='') return ''; |
|
14 | 14 | |
15 | - if($encode=='') $encode = $modx->config['modx_charset']; |
|
15 | + if($encode=='') $encode = $modx->config['modx_charset']; |
|
16 | 16 | |
17 | - $ent_str = htmlspecialchars($str, $flags, $encode); |
|
17 | + $ent_str = htmlspecialchars($str, $flags, $encode); |
|
18 | 18 | |
19 | - if(!empty($str) && empty($ent_str)) |
|
20 | - { |
|
21 | - $detect_order = implode(',', mb_detect_order()); |
|
22 | - $ent_str = mb_convert_encoding($str, $encode, $detect_order); |
|
23 | - } |
|
19 | + if(!empty($str) && empty($ent_str)) |
|
20 | + { |
|
21 | + $detect_order = implode(',', mb_detect_order()); |
|
22 | + $ent_str = mb_convert_encoding($str, $encode, $detect_order); |
|
23 | + } |
|
24 | 24 | |
25 | - return $ent_str; |
|
26 | - } |
|
25 | + return $ent_str; |
|
26 | + } |
|
27 | 27 | } |