<?php
/**
 * YANA library
 *
 * @package yana
 * @licence http://creativecommons.org/licenses/by-nc-sa/2.5/
 */

/**
 * «utility» controller
 *
 * this implements the main program
 *
 * @static
 * @access      public
 * @name        class_index
 * @package     yana
 */
class Index
{
    /**
     * Static function "main" is an YANA controller, used to untaint user data and operate an YANA-instance.
     *
     * @static
     * @access  public
     * @uses    YANA::main()
     */
    function main()
    {
        /* Set error reporting to 'off' by default */
        if (!defined('YANA_ERROR_REPORTING')) {
            ErrorUtility::setErrorReporting(YANA_ERROR_OFF);
        }
        global $YANA;
        /* NOTE: PHP's policy on which vars to import in what order to the super-global
         * $_REQUEST-var could have been changed in php.ini. Thus it might contain
         * other values than expected. This work-around ensures the expected behaviour.
         */
        $ARGS = mergeArrays($_GET, $_POST);
        /* Get a new yana-instance */
        $YANA = new Yana("config/system.config", $ARGS);
        /* Handle the request */
        $YANA->handle();
        /* Create the output */
        $YANA->writeView();
    }

}

?>