@@ -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'] : |
@@ -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 |