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

Last change on this file since 48 was 48, checked in by yermol, 15 years ago

now uses PHP_SELF to figure out installation directory URL.
changed plugin to plugin and f to function everywhere.
updated README.

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