Mapper module interface
Description
Note: This is the only required module in the CTLF.
The purpose of this module is to implement a way to map HTTP (or other protocol) request directly to a object method call.
Example: Implementation in CTLF Demo
In CTLF Demo package mapping is implemented by ctlRequestMapper class instance defined in ./system/lib/ctl/ctlRequestMapper.class.php. The object created from this class checks for values in $_REQUEST PHP variable.
- If "object" and "action" parameters are found, object with the same name is loaded and a method with name corresponding to action parameter value is called.
- If "page" parameter is found, Site.Site->showPage() is called with its value.
- If "script" parameter is found, Site.Site->showScript() is called with its value.
- If no parameters are found, or parameters are missing, default object and method (that are defined in $config['Mapper']) are called.
- If an error occurs while loading target object Site.Site->showError(404) is called.
Of course object&action parameter pair could allow a malicious person to load objects that are not intended for that (e.g. object=adodb.adodb&action=GetAll).
To prevent this a security mechanism is installed in the mapper class that takes configuration parameters:
$config['Mapper']['allow_deny_order']
$config['Mapper']['deny']
$config['Mapper']['allow']
Look at the config file for the values of these parameters.
Configuration
...
Interface
| Method Summary | |
|---|---|
| string | mapRequest() Maps HTTP request to object method. |
| void | redirect(string $call, [array $params]) Redirects HTTP client to another object method |
| Method Detail |
|---|
mapRequest()
string mapRequest ()
Maps HTTP request to object method.
$Revision: 1.2 $, $Date: 2005/11/22 07:11:00 $
