1 | <?php |
---|
2 | die("<html><body><h1>Security precaution</h1> <p>To enable the test code, edit <file>Demos/".basename(__FILE__)."</file> and comment out line 2.</p></body></html>"); |
---|
3 | |
---|
4 | error_reporting(E_ALL | E_STRICT); |
---|
5 | |
---|
6 | define('FILEMANAGER_CODE', true); |
---|
7 | |
---|
8 | |
---|
9 | define('SITE_USES_ALIASES', 01); |
---|
10 | define('DEVELOPMENT', 01); // set to 01 / 1 to enable logging of each incoming event request. |
---|
11 | |
---|
12 | |
---|
13 | require_once('FM-common.php'); |
---|
14 | |
---|
15 | ?> |
---|
16 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
---|
17 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
18 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
19 | <head> |
---|
20 | <title>MooTools FileManager Backend Testground</title> |
---|
21 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
22 | <link rel="shortcut icon" href="http://og5.net/christoph/favicon.png" /> |
---|
23 | <style type="text/css"> |
---|
24 | body { |
---|
25 | font-size: 11px; |
---|
26 | font-family: Tahoma, sans-serif; |
---|
27 | } |
---|
28 | |
---|
29 | h1 { |
---|
30 | margin: 0 0 10px 0; |
---|
31 | padding: 0; |
---|
32 | |
---|
33 | color: #666; |
---|
34 | font-weight: normal; |
---|
35 | font-size: 24px; |
---|
36 | letter-spacing: 1px; |
---|
37 | word-spacing: 2px; |
---|
38 | line-height: 22px; |
---|
39 | min-height: 25px; |
---|
40 | } |
---|
41 | |
---|
42 | h1 span { |
---|
43 | font-size: 11px; |
---|
44 | letter-spacing: 0; |
---|
45 | word-spacing: 0; |
---|
46 | text-shadow: none; |
---|
47 | } |
---|
48 | |
---|
49 | .blue { color: #1f52b0; } |
---|
50 | |
---|
51 | div.content { |
---|
52 | min-height: 200px; |
---|
53 | margin: 23px 34px; |
---|
54 | padding: 10px 17px; |
---|
55 | border: 1px solid #b2b2b2; |
---|
56 | background: #fff; |
---|
57 | box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px; |
---|
58 | -moz-box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px; |
---|
59 | -webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px; |
---|
60 | } |
---|
61 | |
---|
62 | div.content div.example { |
---|
63 | float: left; |
---|
64 | clear: both; |
---|
65 | margin: 10px 0; |
---|
66 | } |
---|
67 | |
---|
68 | button { |
---|
69 | margin: 5px 0; |
---|
70 | } |
---|
71 | |
---|
72 | /* http://labnol.blogspot.com/2006/10/html-css-trick-for-displaying-code.html */ |
---|
73 | pre { |
---|
74 | white-space: pre-wrap; /* css-3 */ |
---|
75 | white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ |
---|
76 | white-space: -pre-wrap; /* Opera 4-6 */ |
---|
77 | white-space: -o-pre-wrap; /* Opera 7 */ |
---|
78 | word-wrap: break-word; /* Internet Explorer 5.5+ */ |
---|
79 | } |
---|
80 | </style> |
---|
81 | |
---|
82 | <script type="text/javascript" src="mootools-core.js"></script> |
---|
83 | <script type="text/javascript" src="mootools-more.js"></script> |
---|
84 | |
---|
85 | <script type="text/javascript" src="../Source/FileManager.js"></script> |
---|
86 | <script type="text/javascript" src="../Source/Gallery.js"></script> |
---|
87 | <script type="text/javascript" src="../Source/Uploader/Fx.ProgressBar.js"></script> |
---|
88 | <script type="text/javascript" src="../Source/Uploader/Swiff.Uploader.js"></script> |
---|
89 | <script type="text/javascript" src="../Source/Uploader.js"></script> |
---|
90 | <script type="text/javascript" src="../Language/Language.en.js"></script> |
---|
91 | <script type="text/javascript" src="../Language/Language.de.js"></script> |
---|
92 | |
---|
93 | <script type="text/javascript"> |
---|
94 | window.addEvent('domready', function() { |
---|
95 | |
---|
96 | }); |
---|
97 | </script> |
---|
98 | </head> |
---|
99 | <body> |
---|
100 | <div id="content" class="content"> |
---|
101 | <h1>FileManager Backend Tests</h1> |
---|
102 | |
---|
103 | <h2>Basic PHP tests</h2> |
---|
104 | <pre> |
---|
105 | <?php |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | // log request data: |
---|
110 | FM_vardumper(null, 'testFM' . (!empty($_GET['event']) ? '-' . $_GET['event'] : null)); |
---|
111 | |
---|
112 | |
---|
113 | |
---|
114 | if (01) // debugging |
---|
115 | { |
---|
116 | $re_extra = '-_., []()~!@+' /* . '#&' */; |
---|
117 | $trim_extra = '-_,~@+#&'; |
---|
118 | |
---|
119 | echo "pagetitle(str, NULL, '$re_extra', '$trim_extra'): regex to filter file & dirnames before they are created:\n"; |
---|
120 | |
---|
121 | // ASCII range |
---|
122 | for ($i = 0; $i < 8; $i++) |
---|
123 | { |
---|
124 | $msg = ''; |
---|
125 | $str = ''; |
---|
126 | for ($j = 0; $j < 16; $j++) |
---|
127 | { |
---|
128 | $c = $i * 16 + $j; |
---|
129 | switch ($c) |
---|
130 | { |
---|
131 | case 9: |
---|
132 | $msg .= "(TAB)"; |
---|
133 | break; |
---|
134 | |
---|
135 | case 13: |
---|
136 | $msg .= "(CR)"; |
---|
137 | break; |
---|
138 | |
---|
139 | case 10: |
---|
140 | $msg .= "(LF)"; |
---|
141 | break; |
---|
142 | |
---|
143 | default: |
---|
144 | $msg .= ($c >= 32 ? htmlentities(chr($c), ENT_NOQUOTES, 'UTF-8') : '&#' . $c . ';'); |
---|
145 | break; |
---|
146 | } |
---|
147 | $str .= chr($c); |
---|
148 | } |
---|
149 | |
---|
150 | echo "ORIG: [X" . $msg . "X]"; |
---|
151 | if ($i < 2) |
---|
152 | { |
---|
153 | echo " (these characters are 'low ASCII' charactercodes " . ($i * 16) . " ... " . ($i * 16 + 15); |
---|
154 | } |
---|
155 | echo "\n"; |
---|
156 | |
---|
157 | $r = FileManagerUtility::pagetitle('X' . $str . 'X', null, $re_extra, $trim_extra); |
---|
158 | |
---|
159 | echo "FILTERED: [" . htmlentities($r, ENT_NOQUOTES, 'UTF-8') . "]\n\n"; |
---|
160 | } |
---|
161 | |
---|
162 | $trimset = '_.'; |
---|
163 | echo "\n\ntrim() with multiple characters in the trim set: [$trimset]\n"; |
---|
164 | |
---|
165 | $test = array( |
---|
166 | '.ignore', |
---|
167 | '___ignore', |
---|
168 | '_._.ignore', |
---|
169 | '._._ignore', |
---|
170 | 'X.ignore', |
---|
171 | 'X___ignore', |
---|
172 | 'X_._.ignore', |
---|
173 | 'X._._ignore', |
---|
174 | '__X_ignore', |
---|
175 | '_._X.ignore', |
---|
176 | '._.X_ignore' |
---|
177 | ); |
---|
178 | foreach ($test as $t) |
---|
179 | { |
---|
180 | $r = trim($t, $trimset); |
---|
181 | |
---|
182 | echo "\nORIG: [" . htmlentities($t, ENT_NOQUOTES, 'UTF-8') . "]\nRES: [" . htmlentities($r, ENT_NOQUOTES, 'UTF-8') . "]\n"; |
---|
183 | } |
---|
184 | } |
---|
185 | |
---|
186 | |
---|
187 | $browser = new FileManagerWithAliasSupport(array( |
---|
188 | 'directory' => 'Files/', // relative paths: are relative to the URI request script path, i.e. dirname(__FILE__) |
---|
189 | //'thumbnailPath' => 'Files/Thumbnails/', |
---|
190 | 'assetBasePath' => '../Assets', |
---|
191 | 'chmod' => 0777, |
---|
192 | //'maxUploadSize' => 1024 * 1024 * 5, |
---|
193 | //'upload' => false, |
---|
194 | //'destroy' => false, |
---|
195 | //'create' => false, |
---|
196 | //'move' => false, |
---|
197 | //'download' => false, |
---|
198 | //'filter' => 'image/', |
---|
199 | 'allowExtChange' => true, // allow file name extensions to be changed; the default however is: NO (FALSE) |
---|
200 | 'UploadIsAuthorized_cb' => 'FM_IsAuthorized', |
---|
201 | 'DownloadIsAuthorized_cb' => 'FM_IsAuthorized', |
---|
202 | 'CreateIsAuthorized_cb' => 'FM_IsAuthorized', |
---|
203 | 'DestroyIsAuthorized_cb' => 'FM_IsAuthorized', |
---|
204 | 'MoveIsAuthorized_cb' => 'FM_IsAuthorized' |
---|
205 | |
---|
206 | // http://httpd.apache.org/docs/2.2/mod/mod_alias.html -- we only emulate the Alias statement. |
---|
207 | // Implementing other path translation features is left as an exercise to the reader: |
---|
208 | , 'Aliases' => array( |
---|
209 | '/c/lib/includes/js/mootools-filemanager/Demos/Files/alias' => "D:/xxx", |
---|
210 | '/c/lib/includes/js/mootools-filemanager/Demos/Files/d' => "D:/xxx.tobesorted", |
---|
211 | '/c/lib/includes/js/mootools-filemanager/Demos/Files/u' => "D:/websites-uploadarea", |
---|
212 | |
---|
213 | '/c/lib/includes/js/mootools-filemanager/Demos/Files' => "D:/experiment" |
---|
214 | ) |
---|
215 | )); |
---|
216 | |
---|
217 | echo "\n\n"; |
---|
218 | $settings = $browser->getSettings(); |
---|
219 | var_dump($settings); |
---|
220 | |
---|
221 | ?> |
---|
222 | </pre> |
---|
223 | <h2>Important server variables</h2> |
---|
224 | |
---|
225 | <p>$_SERVER['DOCUMENT_ROOT'] = '<?php echo $_SERVER['DOCUMENT_ROOT']; ?>'</p> |
---|
226 | <p>$_SERVER['SCRIPT_NAME'] = '<?php echo $_SERVER['SCRIPT_NAME']; ?>'</p> |
---|
227 | |
---|
228 | <h2>FileManagerUtility class static methods</h2> |
---|
229 | |
---|
230 | <?php |
---|
231 | |
---|
232 | $re_extra = '-_., []()~!@+' /* . '#&' */; |
---|
233 | $trim_extra = '-_,~@+#&'; |
---|
234 | |
---|
235 | ?> |
---|
236 | <h3>pagetitle(str, NULL, '<?php echo $re_extra; ?>', '<?php echo $trim_extra; ?>')</h3> |
---|
237 | |
---|
238 | <?php |
---|
239 | |
---|
240 | $test = array( |
---|
241 | array('src' => '.htaccess', 'expect' => 'htaccess'), |
---|
242 | array('src' => 'regular.jpg', 'expect' => 'regular.jpg'), |
---|
243 | array('src' => 'Umgebung Altstadt Ãstgat', 'expect' => 'Umgebung Altstadt Ostgat'), |
---|
244 | array('src' => ' Sed ut perspiciatis unde omnis iste natus error ', 'expect' => 'Sed ut perspiciatis unde omnis iste natus error'), |
---|
245 | array('src' => ' advantage from it? But who has any right ', 'expect' => 'advantage from it_ But who has any right'), |
---|
246 | array('src' => 'welche aus geistiger SchwÀche, d.h.', 'expect' => 'welche aus geistiger Schwaeche, d.h'), |
---|
247 | array('src' => 'MÃŒnchen - AusrÃŒstung - Spaà - Viele GrÃŒÃe!', 'expect' => 'Muenchen - Ausruestung - Spass - Viele Gruesse!'), |
---|
248 | array('src' => 'C:\\Windows\\TEMP\\', 'expect' => 'C_Windows_TEMP'), |
---|
249 | array('src' => '/etc/passwd', 'expect' => 'etc_passwd'), |
---|
250 | array('src' => 'Let\'s see what " quotes do?', 'expect' => 'Let_s see what _ quotes do'), |
---|
251 | array('src' => 'äžåœåºå®ç蜯件å¿
须䜿çšçŒç æ° å æ¹ååéš ç¶æ¯éåžžéœäŒå¯¹åå¥³è¯Žå°æ¹æ¹èš ç°åšéŠæž¯çæ¥åžžäœ¿çšäžåºç°äºè¶æ¥è¶å€çç®äœæ±å åè¯, èµ° èŽµå· çäžæ æž
æµå£°', 'expect' => ''), |
---|
252 | array('src' => 'également appelé lorem ipsum', 'expect' => 'egalement appele lorem ipsum'), |
---|
253 | array('src' => 'ÅaciÅski tekst pochodzÄ
cy ze staroÅŒytnoÅci, zaczerpniÄty', 'expect' => 'aci_ski tekst pochodz_cy ze staro_ytno_ci, zaczerpni_ty'), |
---|
254 | array('src' => 'Ipsum ÑекÑÑ Lorem, кПÑПÑÑе, как пÑавОлП, беÑÑÐŒÑÑлеММÑй ÑпОÑПк пПлÑ-лаÑОМÑкОе ÑлПва', 'expect' => 'Ipsum _ Lorem'), |
---|
255 | array('src' => 'اÙÙ Ø¯Ù ÙØ§Ú٠از Ø±ØŽØªÙ Ø§Û Ø§Ø² Ù
ØªÙ ÙØ§ØªÛÙ Ù
ÙØ±Ø¯ Ø§Ø³ØªÙØ§Ø¯Ù در طراØÛ ÙØš Ø³Ø§ÛØª Ù ÚØ§ÙŸ ØšÙ Ø¬Ø§Û Ø§ÙÚ¯ÙÛØ³Û ؚ٠استرس ٠ؚا تکÛ٠تÙÙØž کرد٠اÙÙ
ÛØª', 'expect' => ''), |
---|
256 | array('src' => 'ì€ëª
íë ê·žëíœ ë±ì ììì ìê°ì íë ì í
ìŽì
, 묞ì ëë êžêŒŽ , íí ìžìì , ê·žëŠ¬ê³ ë ìŽìì . ì ìžë¯ž ëŒíŽìŽ', 'expect' => ''), |
---|
257 | array('src' => '×€××עך ×עקס×) ×Š× ××Ö·××××Ö·×× ×× ×ך×Ö·×€××§ ×¢××¢××¢× ×× ×€×× ×Ö· ××Öž×§×××¢× × ×Öž×עך ×××ס××Ö·× ×€ÖŒ×š×¢××¢× ××ך×× ×, ×Ö·××Ö· ××× ×©×š××€Ö¿× , ××Ö·×€ÖŒ×Ö·×ך×Ö·×€×', 'expect' => ')'), |
---|
258 | array('src' => 'ÏÏηÏιΌοÏοιοÏΜÏαι κείΌεΜο κÏάÏηÏÎ·Ï ÎžÎÏÎ·Ï (κείΌεΜο ÏλήÏÏÏηÏ), για Μα αÏοΎειÏΞεί η γÏαÏικά ÏÏοιÏεία', 'expect' => '(_ _)'), |
---|
259 | array('src' => 'ã«ãããã¹ã ïŒãã£ã©ãŒããã¹ãïŒç€ºãããã«ãã°ã©ãã£ãã¯ãªã©ã®èŠçŽ ãæå®ããã®èŠèŠçãªãã¬ãŒã³ããŒã·ã§ã³ã', 'expect' => ''), |
---|
260 | array('src' => 'SQL: \'\'; DROP TABLE; \'', 'expect' => 'SQL_ _ DROP TABLE'), |
---|
261 | array('src' => '<script>alert(\'boom!\');</script>', 'expect' => 'script_alert(_boom!_)_script'), |
---|
262 | array('src' => '%20%2F%41%39 & X?', 'expect' => '20_2F_41_39 _amp_ X'), |
---|
263 | array('src' => 'https://127893215784/xyz', 'expect' => 'https_127893215784_xyz'), |
---|
264 | ); |
---|
265 | |
---|
266 | foreach ($test as $tc) |
---|
267 | { |
---|
268 | $t = $tc['src']; |
---|
269 | $e = $tc['expect']; |
---|
270 | $r = FileManagerUtility::pagetitle($t, null, $re_extra, $trim_extra); |
---|
271 | |
---|
272 | echo "\n<pre>ORIG: [" . htmlentities($t, ENT_NOQUOTES, 'UTF-8') . "]\nRES: [" . htmlentities($r, ENT_NOQUOTES, 'UTF-8') . "]</pre>\n"; |
---|
273 | |
---|
274 | if (strcmp($e, $r) != 0) |
---|
275 | { |
---|
276 | echo "<p><strong>FAILED!</strong></p>\n"; |
---|
277 | } |
---|
278 | echo "\n<hr />\n"; |
---|
279 | } |
---|
280 | |
---|
281 | ?> |
---|
282 | |
---|
283 | |
---|
284 | <h3>getSiteRoot</h3> |
---|
285 | |
---|
286 | <p>$_SERVER['DOCUMENT_ROOT'] = '<?php echo $_SERVER['DOCUMENT_ROOT']; ?>'</p> |
---|
287 | |
---|
288 | <p>realpath('/') = '<?php echo realpath('/'); ?>'</p> |
---|
289 | |
---|
290 | <h3>getRequestPath</h3> |
---|
291 | |
---|
292 | <p>getRequestPath() => '<?php echo $browser->getRequestPath(); ?>'</p> |
---|
293 | |
---|
294 | |
---|
295 | <h3>URI to abs & file path transform for DocumentRoot based URIs</h3> |
---|
296 | |
---|
297 | <?php |
---|
298 | |
---|
299 | $test = array( |
---|
300 | array('src' => ''), |
---|
301 | array('src' => '/'), |
---|
302 | array('src' => 'Files/'), |
---|
303 | array('src' => '/Files'), |
---|
304 | array('src' => '/Files/'), |
---|
305 | array('src' => 'Files/../alias'), |
---|
306 | array('src' => 'Files/../d'), |
---|
307 | array('src' => 'Files/../u'), |
---|
308 | array('src' => '/alias'), |
---|
309 | array('src' => '/d'), |
---|
310 | array('src' => '/u'), |
---|
311 | array('src' => 'Files/alias'), |
---|
312 | array('src' => 'Files/d'), |
---|
313 | array('src' => 'Files/u'), |
---|
314 | array('src' => '../Demos/Files/u'), |
---|
315 | array('src' => '../Assets/../Demos/Files'), |
---|
316 | array('src' => 'Files/././../../D/.././Demos/Files'), |
---|
317 | ); |
---|
318 | |
---|
319 | foreach ($test as $tc) |
---|
320 | { |
---|
321 | $t = $tc['src']; |
---|
322 | $emsg = null; |
---|
323 | $r1 = ''; |
---|
324 | $r2 = ''; |
---|
325 | |
---|
326 | try |
---|
327 | { |
---|
328 | $r1 = $browser->rel2abs_url_path($t); |
---|
329 | $r2 = $browser->url_path2file_path($t); |
---|
330 | } |
---|
331 | catch(FileManagerException $e) |
---|
332 | { |
---|
333 | $emsg = $e->getMessage(); |
---|
334 | } |
---|
335 | |
---|
336 | echo "\n<pre>ORIG: [" . htmlentities($t, ENT_NOQUOTES, 'UTF-8') . "]\nURI.ABS: [" . htmlentities($r1, ENT_NOQUOTES, 'UTF-8') . "]\nDIR.ABS: [" . htmlentities($r2, ENT_NOQUOTES, 'UTF-8') . "]</pre>\n"; |
---|
337 | |
---|
338 | if ($emsg !== null) |
---|
339 | { |
---|
340 | echo "<p><strong>FileManagerException('$emsg')!</strong></p>\n"; |
---|
341 | } |
---|
342 | echo "\n<hr />\n"; |
---|
343 | } |
---|
344 | |
---|
345 | ?> |
---|
346 | |
---|
347 | <h3>URI to abs & file path transform for options['directory'] based URIs</h3> |
---|
348 | |
---|
349 | <?php |
---|
350 | |
---|
351 | foreach ($test as $tc) |
---|
352 | { |
---|
353 | $t = $tc['src']; |
---|
354 | $emsg = null; |
---|
355 | $r1 = ''; |
---|
356 | $r2 = ''; |
---|
357 | $r3 = ''; |
---|
358 | $r4 = ''; |
---|
359 | $r5 = ''; |
---|
360 | |
---|
361 | try |
---|
362 | { |
---|
363 | $r3 = $settings['directory'] . $t; |
---|
364 | $r5 = $browser->normalize($r3); |
---|
365 | $r4 = $browser->url_path2file_path($r3); |
---|
366 | $r1 = $browser->rel2abs_legal_url_path($t); |
---|
367 | $r2 = $browser->legal_url_path2file_path($t); |
---|
368 | } |
---|
369 | catch(FileManagerException $e) |
---|
370 | { |
---|
371 | $emsg = $e->getMessage(); |
---|
372 | } |
---|
373 | |
---|
374 | echo "\n<pre>ORIG: [" . htmlentities($t, ENT_NOQUOTES, 'UTF-8') . "]\nURI.ABS: [" . htmlentities($r1, ENT_NOQUOTES, 'UTF-8') . "]\nDIR.ABS: [" . htmlentities($r2, ENT_NOQUOTES, 'UTF-8') . "]\nRAW.URI: [" . htmlentities($r3, ENT_NOQUOTES, 'UTF-8') . "]\nNORMLZD: [" . htmlentities($r5, ENT_NOQUOTES, 'UTF-8') . "]\nDIR.ABS: [" . htmlentities($r4, ENT_NOQUOTES, 'UTF-8') . "]</pre>\n"; |
---|
375 | |
---|
376 | if ($emsg !== null) |
---|
377 | { |
---|
378 | echo "<p><strong>FileManagerException('$emsg')!</strong></p>\n"; |
---|
379 | } |
---|
380 | echo "\n<hr />\n"; |
---|
381 | } |
---|
382 | |
---|
383 | ?> |
---|
384 | |
---|
385 | <h3>FM Aliased directory scan output</h3> |
---|
386 | |
---|
387 | <?php |
---|
388 | |
---|
389 | $test = array( |
---|
390 | array('src' => ''), |
---|
391 | array('src' => '/'), |
---|
392 | array('src' => '/Files'), |
---|
393 | array('src' => '/Files/..'), |
---|
394 | array('src' => '/Files/../alias/'), |
---|
395 | array('src' => '/Files/../d'), |
---|
396 | array('src' => '/Files/../u'), |
---|
397 | ); |
---|
398 | |
---|
399 | |
---|
400 | foreach ($test as $tc) |
---|
401 | { |
---|
402 | $t = $tc['src']; |
---|
403 | $emsg = null; |
---|
404 | $r1 = ''; |
---|
405 | $r2 = ''; |
---|
406 | $c1 = ''; |
---|
407 | |
---|
408 | try |
---|
409 | { |
---|
410 | $r1 = $browser->rel2abs_legal_url_path($t); |
---|
411 | $r2 = $browser->legal_url_path2file_path($t); |
---|
412 | |
---|
413 | $c1 = $browser->scandir($r2); |
---|
414 | } |
---|
415 | catch(FileManagerException $e) |
---|
416 | { |
---|
417 | $emsg = $e->getMessage(); |
---|
418 | } |
---|
419 | |
---|
420 | echo "\n<strong><pre>dir = '$r2'</pre></strong>\n"; |
---|
421 | |
---|
422 | echo "\n<h4>scandir output:</h4>\n<pre>"; |
---|
423 | var_dump($c1); |
---|
424 | echo "</pre>\n"; |
---|
425 | |
---|
426 | if ($emsg !== null) |
---|
427 | { |
---|
428 | echo "<p><strong>FileManagerException('$emsg')!</strong></p>\n"; |
---|
429 | } |
---|
430 | echo "\n<hr />\n"; |
---|
431 | } |
---|
432 | |
---|
433 | ?> |
---|
434 | |
---|
435 | |
---|
436 | |
---|
437 | |
---|
438 | |
---|
439 | |
---|
440 | |
---|
441 | |
---|
442 | |
---|
443 | |
---|
444 | <h3>FM 'view' output</h3> |
---|
445 | |
---|
446 | <pre> |
---|
447 | <?php |
---|
448 | $dump = '{}'; |
---|
449 | ob_start(); |
---|
450 | $_POST = array(); |
---|
451 | $_POST['directory'] = '/'; // '/bugger/'; |
---|
452 | $_POST['file'] = '0[]~!@()-._ 90826039_1_1_3.jpg'; |
---|
453 | $_POST['type'] = 'thumb'; |
---|
454 | $browser->fireEvent('detail'); |
---|
455 | $dump = ob_get_clean(); |
---|
456 | |
---|
457 | echo "input:\n"; |
---|
458 | var_dump($_POST); |
---|
459 | echo "\n\noutput for event 'detail':\n\n"; |
---|
460 | |
---|
461 | $json = json_decode($dump); |
---|
462 | var_dump($json); |
---|
463 | |
---|
464 | ?> |
---|
465 | <hr /> |
---|
466 | |
---|
467 | |
---|
468 | <pre> |
---|
469 | <?php |
---|
470 | $dump = '{}'; |
---|
471 | ob_start(); |
---|
472 | $_POST = array(); |
---|
473 | $_POST['directory'] = '/'; // '/bugger/'; |
---|
474 | $_POST['file'] = 'MO mc 5.jpg'; |
---|
475 | $_POST['type'] = 'thumb'; |
---|
476 | $browser->fireEvent('detail'); |
---|
477 | $dump = ob_get_clean(); |
---|
478 | |
---|
479 | echo "input:\n"; |
---|
480 | var_dump($_POST); |
---|
481 | echo "\n\noutput for event 'detail':\n\n"; |
---|
482 | |
---|
483 | //echo "</pre><div>" . htmlentities($dump, ENT_NOQUOTES, 'UTF-8') . "</div><pre>\n"; |
---|
484 | //echo "\n\n"; |
---|
485 | |
---|
486 | $json = json_decode($dump); |
---|
487 | var_dump($json); |
---|
488 | |
---|
489 | ?> |
---|
490 | <hr /> |
---|
491 | |
---|
492 | |
---|
493 | |
---|
494 | <pre> |
---|
495 | <?php |
---|
496 | $dump = '{}'; |
---|
497 | ob_start(); |
---|
498 | $_POST = array(); |
---|
499 | $_POST['directory'] = ''; |
---|
500 | $_POST['filter'] = ''; |
---|
501 | $_POST['type'] = 'list'; |
---|
502 | $browser->fireEvent('view'); |
---|
503 | $dump = ob_get_clean(); |
---|
504 | |
---|
505 | echo "input:\n"; |
---|
506 | var_dump($_POST); |
---|
507 | echo "\n\noutput for event 'view':\n\n"; |
---|
508 | |
---|
509 | $json = json_decode($dump); |
---|
510 | var_dump($json); |
---|
511 | |
---|
512 | ?> |
---|
513 | <hr /> |
---|
514 | |
---|
515 | |
---|
516 | |
---|
517 | |
---|