source: trunk/plugins/ImageManager/backend.php @ 1081

Last change on this file since 1081 was 677, checked in by ray, 13 years ago

set svn:keywords property for the new files & all plugins

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 3.8 KB
RevLine 
[270]1<?php
[43]2/**
3* Unified backend for 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*
[48]21* __plugin=ImageManager   for future expansion; identify the plugin being requested.
22* __function=thumbs|images|editorFrame|editor|manager  function being called.
[43]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
[407]32// Strip slashes if MQGPC is on
33set_magic_quotes_runtime(0);
34if(get_magic_quotes_gpc())
35{
36  $to_clean = array(&$_GET, &$_POST, &$_REQUEST, &$_COOKIE);
37  while(count($to_clean))
38  {
39    $cleaning =& $to_clean[array_pop($junk = array_keys($to_clean))];
40    unset($to_clean[array_pop($junk = array_keys($to_clean))]);
41    foreach(array_keys($cleaning) as $k)
42    {
43      if(is_array($cleaning[$k]))
44      {
45        $to_clean[] =& $cleaning[$k];
46      }
47      else
48      {
49        $cleaning[$k] = stripslashes($cleaning[$k]);
50      }
51    }
52  }
53}
54
[43]55/**
56* ImageManager configuration
57*/
58
59require_once('config.inc.php');
60
61/**
62* debug message library
63*/
64
65include_once( "ddt.php" );
66
67// uncomment to turn on debugging
68// _ddtOn();
69
70_ddt( __FILE__, __LINE__, "backend.php: top with query '" . $_SERVER["PHP_SELF"] . "' string '" . $_SERVER["QUERY_STRING"] . "'" );
71
72$formVars = empty($_POST) ? $_GET : $_POST;
73
74// make sure the request is for us (this gives us the ability to eventually organize
75// a backend event handler system) For an include file the return doesn't make alot of
76// sense but eventually we'll want to turn all of this into at least functions
77// separating out all the presentation HTML from the logic. (Right now all the HTML
78// used by ImageManager is in the same files as the PHP code ...)
79
[48]80if ( @$formVars[ "__plugin" ] != "ImageManager" )
[43]81        {
82        // not for us.
83
84        _ddt( __FILE__, __LINE__, "request was not for us" );
85
86        return true;
87        }
88
89// so we don't have to re-engineer the entire thing right now, since it's probably
90// going to get rewritten anyway, we just include the correct file based on the
91// function request.
92
[48]93_ddt( __FILE__, __LINE__, "backend.php(): handling function '" . $formVars[ "__function" ] . "' base_dir is '" . $IMConfig["base_dir"] . "'" );
[43]94
[48]95switch ( @$formVars[ "__function" ] )
[43]96        {
97
98        case "editor":
99
100                include_once( $IMConfig['base_dir'] . "/editor.php" );
101                exit();
102               
103                break;
104
105        case "editorFrame":
106
107                include_once( $IMConfig['base_dir'] . "/editorFrame.php" );
108                exit();
109
110                break;
111
112        case "manager":
113
114                _ddt( __FILE__, __LINE__, "including '" . $IMConfig['base_dir'] . "/manager.php" );
115
116                include_once( $IMConfig['base_dir'] . "/manager.php" );
117                exit();
118
119                break;
120
121        case "images":
122
123                include_once( $IMConfig['base_dir'] . "/images.php" );
124                exit();
125
126                break;
127
128        case "thumbs":
129
130                include_once( $IMConfig['base_dir'] . "/thumbs.php" );
131                exit();
132
133                break;
134
[256]135        case "resizer":
136
137                include_once( $IMConfig['base_dir'] . "/resizer.php" );
138                exit();
139
140                break;
141
[43]142        default:
143
144                _ddt( __FILE__, __LINE__, "function request not supported" );
145                _error( __FILE__, __LINE__, "function request not supported" );
146
147                break;
148
149        }       // end of switch.
150
151return false ;
152
153// END
154
155?>
Note: See TracBrowser for help on using the repository browser.