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

Last change on this file since 311 was 270, checked in by gogo, 14 years ago

Change short-php-tags to full php tags ( ticket:121 )

File size: 3.2 KB
Line 
1<?php
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*
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
36require_once('config.inc.php');
37
38/**
39* debug message library
40*/
41
42include_once( "ddt.php" );
43
44// uncomment to turn on debugging
45// _ddtOn();
46
47_ddt( __FILE__, __LINE__, "backend.php: top with query '" . $_SERVER["PHP_SELF"] . "' string '" . $_SERVER["QUERY_STRING"] . "'" );
48
49$formVars = empty($_POST) ? $_GET : $_POST;
50
51// make sure the request is for us (this gives us the ability to eventually organize
52// a backend event handler system) For an include file the return doesn't make alot of
53// sense but eventually we'll want to turn all of this into at least functions
54// separating out all the presentation HTML from the logic. (Right now all the HTML
55// used by ImageManager is in the same files as the PHP code ...)
56
57if ( @$formVars[ "__plugin" ] != "ImageManager" )
58        {
59        // not for us.
60
61        _ddt( __FILE__, __LINE__, "request was not for us" );
62
63        return true;
64        }
65
66// so we don't have to re-engineer the entire thing right now, since it's probably
67// going to get rewritten anyway, we just include the correct file based on the
68// function request.
69
70_ddt( __FILE__, __LINE__, "backend.php(): handling function '" . $formVars[ "__function" ] . "' base_dir is '" . $IMConfig["base_dir"] . "'" );
71
72switch ( @$formVars[ "__function" ] )
73        {
74
75        case "editor":
76
77                include_once( $IMConfig['base_dir'] . "/editor.php" );
78                exit();
79               
80                break;
81
82        case "editorFrame":
83
84                include_once( $IMConfig['base_dir'] . "/editorFrame.php" );
85                exit();
86
87                break;
88
89        case "manager":
90
91                _ddt( __FILE__, __LINE__, "including '" . $IMConfig['base_dir'] . "/manager.php" );
92
93                include_once( $IMConfig['base_dir'] . "/manager.php" );
94                exit();
95
96                break;
97
98        case "images":
99
100                include_once( $IMConfig['base_dir'] . "/images.php" );
101                exit();
102
103                break;
104
105        case "thumbs":
106
107                include_once( $IMConfig['base_dir'] . "/thumbs.php" );
108                exit();
109
110                break;
111
112        case "resizer":
113
114                include_once( $IMConfig['base_dir'] . "/resizer.php" );
115                exit();
116
117                break;
118
119        default:
120
121                _ddt( __FILE__, __LINE__, "function request not supported" );
122                _error( __FILE__, __LINE__, "function request not supported" );
123
124                break;
125
126        }       // end of switch.
127
128return false ;
129
130// END
131
132?>
Note: See TracBrowser for help on using the repository browser.