Data Handler

Files

/engine/handler.data.php

Introduction

Data Handler is loaded in situations when other handlers were not used, which is most commonly for regular web page requests. Data Handler takes all the input from GET, POST, FILES; SESSION and COOKIE variables, loads Wave Framework API and sends all the input to the API. It first uses URL Controller to find out what page the user agent is looking for and then a View Controller to generate that requested page.

Workflow

This script can only be executed through Index Gateway and it throws a 403 Forbidden message if accessed directly.

It sets URL and View cache timeouts to 0, if either of them are not defined in configuration.

Data Handler loads State Class and creates a new State object with the current configuration array. Configuration is required by the API that Data Handler uses.

If database settings are set in configuration, then it also loads Database class and creates a new database object which is stored in State.

Data Handler also loads autoload script from either /overrides/resources/scripts/script.php or from /resources/scripts/script.php, this file can include function definitions or other PHP-related functionality. It is only recommended to store additional functionality in Autoload script if absolutely necessary, such as for functions that are used by every page call.

Data Handler loads API Class and creates a new API object with the current State.

First it sends the current requested URL to URL Controller with 'url-solve' command, which determines what view the user agent is requesting, what language is currently defined and so on. URL Controller also redirects the client, if the URL seems to be in incorrect format. URL Controller detects the View that should be loaded based on sitemap configuration stored in /resources/[language].sitemap.ini files.

All input data from POST, GET, FILES and COOKIE arrays are merged into a single input array, which works similarly to $_REQUEST. Sessions are also started, if session cookie is detected. Session data is stored as 'www-session', but this is assigned by API itself and not by the handlers.

Data Handler makes a new API call to View Controller, which is usually the file from /controllers/controller.view.php but other View Controllers (and Controller methods) can be called. View Controller will load the appropriate views and return data to user agent.

Data Handler also makes an entry in the log file about the request, if Logger is used.