Mapper module

$Revision$
$Date$

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.

  1. 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.
  2. If "page" parameter is found, Site.Site->showPage() is called with its value.
  3. If "script" parameter is found, Site.Site->showScript() is called with its value.
  4. If no parameters are found, or parameters are missing, default object and method (that are defined in $config['mapper']) are called.
  5. 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.