1 | <?php |
---|
2 | /** |
---|
3 | * Unified backend for ExtendedFileManager - copied from ImageManager |
---|
4 | * |
---|
5 | * Image Manager was originally developed by: |
---|
6 | * Xiang Wei Zhuo, email: xiangweizhuo(at)hotmail.com Wei Shou. |
---|
7 | * |
---|
8 | * Unified backend sponsored by DTLink Software, http://www.dtlink.com |
---|
9 | * Implementation by Yermo Lamers, http://www.formvista.com |
---|
10 | * |
---|
11 | * (c) DTLink, LLC 2005. |
---|
12 | * Distributed under the same terms as HTMLArea itself. |
---|
13 | * This notice MUST stay intact for use (see license.txt). |
---|
14 | * |
---|
15 | * DESCRIPTION: |
---|
16 | * |
---|
17 | * Instead of using separate URL's for each function, ImageManager now |
---|
18 | * routes all requests to the server through this single, replaceable, |
---|
19 | * entry point. backend.php expects at least two URL variable parameters: |
---|
20 | * |
---|
21 | * __plugin=ImageManager for future expansion; identify the plugin being requested. |
---|
22 | * __function=thumbs|images|editorFrame|editor|manager function being called. |
---|
23 | * |
---|
24 | * Having a single entry point that strictly adheres to a defined interface will |
---|
25 | * make the backend code much easier to maintain and expand. It will make it easier |
---|
26 | * on integrators, not to mention it'll make it easier to have separate |
---|
27 | * implementations of the backend in different languages (Perl, Python, ASP, etc.) |
---|
28 | * |
---|
29 | * @see config.inc.php |
---|
30 | */ |
---|
31 | |
---|
32 | /** |
---|
33 | * ImageManager configuration |
---|
34 | */ |
---|
35 | |
---|
36 | require_once('config.inc.php'); |
---|
37 | |
---|
38 | |
---|
39 | // Strip slashes if MQGPC is on |
---|
40 | set_magic_quotes_runtime(0); |
---|
41 | if(get_magic_quotes_gpc()) |
---|
42 | { |
---|
43 | $to_clean = array(&$_GET, &$_POST, &$_REQUEST, &$_COOKIE); |
---|
44 | while(count($to_clean)) |
---|
45 | { |
---|
46 | $cleaning =& $to_clean[array_pop($junk = array_keys($to_clean))]; |
---|
47 | unset($to_clean[array_pop($junk = array_keys($to_clean))]); |
---|
48 | foreach(array_keys($cleaning) as $k) |
---|
49 | { |
---|
50 | if(is_array($cleaning[$k])) |
---|
51 | { |
---|
52 | $to_clean[] =& $cleaning[$k]; |
---|
53 | } |
---|
54 | else |
---|
55 | { |
---|
56 | $cleaning[$k] = stripslashes($cleaning[$k]); |
---|
57 | } |
---|
58 | } |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | /** |
---|
63 | * ImageManager configuration |
---|
64 | */ |
---|
65 | |
---|
66 | $formVars = empty($_POST) ? $_GET : $_POST; |
---|
67 | |
---|
68 | // make sure the request is for us (this gives us the ability to eventually organize |
---|
69 | // a backend event handler system) For an include file the return doesn't make alot of |
---|
70 | // sense but eventually we'll want to turn all of this into at least functions |
---|
71 | // separating out all the presentation HTML from the logic. (Right now all the HTML |
---|
72 | // used by ImageManager is in the same files as the PHP code ...) |
---|
73 | |
---|
74 | if ( @$formVars[ "__plugin" ] != "ExtendedFileManager" ) |
---|
75 | { |
---|
76 | // not for us. |
---|
77 | |
---|
78 | return true; |
---|
79 | } |
---|
80 | |
---|
81 | // so we don't have to re-engineer the entire thing right now, since it's probably |
---|
82 | // going to get rewritten anyway, we just include the correct file based on the |
---|
83 | // function request. |
---|
84 | |
---|
85 | switch ( @$formVars[ "__function" ] ) |
---|
86 | { |
---|
87 | |
---|
88 | case "editor": |
---|
89 | case "editorFrame": |
---|
90 | case "manager": |
---|
91 | case "images": |
---|
92 | case "thumbs": |
---|
93 | case "resizer": |
---|
94 | |
---|
95 | include_once $IMConfig['base_dir'] . '/' . $formVars['__function'] . '.php' ; |
---|
96 | exit(); |
---|
97 | |
---|
98 | break; |
---|
99 | |
---|
100 | default: |
---|
101 | |
---|
102 | break; |
---|
103 | |
---|
104 | } // end of switch. |
---|
105 | |
---|
106 | return false ; |
---|
107 | |
---|
108 | // END |
---|
109 | |
---|
110 | ?> |
---|